Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.2-M2, 2.2, 3.0.0
-
Fix Version/s: 2.3-M3
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
If org.opengis.feature.IllegalAttributeException is constructed with a null descriptor, such as in GeoTools org.geotools.feature.IllegalAttributeException(String), org.opengis.feature.IllegalAttributeException.toString() fails with a NullPointerException, when descriptor.getName() is called. The correct solution would be Do Not Do That Then (TM), or even get rid of the deprecated org.geotools.feature.IllegalAttributeException (this is GEOS-2111). However GEOS-2111 is fiddly, and the problematic constructor is referenced in 17 places.
As a simpler alternative, symptomatic relief may be obtained by adding a ternary operator null pointer check for "descriptor" at line 71 in org.opengis.feature.IllegalAttributeException. Merely change
return ((message != null) ? (s + ": " + message) : s) + ": "descriptor.getName()" value:"+value ;
to
return ((message Unable to render embedded object: File ( " + message) : s) + ": "+((descriptor) not found.=null)?descriptor.getName():null)+" value:"+value;
This change should be applied to GeoAPI 2.2 and all higher branches. And a new SNAPSHOT release would be a nice touch. ![]()
Issue Links
| This issue relates to: | ||||
| GEOT-2111 | Errors in Types cause NPE when printing stack trace |
|
|
|
Oops, all references above should be to
GEOT-2111. Jira won't let me edit this issue, even though I reported it. And perhaps assign it to Jody, who fled fromGEOT-2111.GEOT-2111. Jira won't let me edit this issue, even though I reported it. And perhaps assign it to Jody, who fled fromGEOT-2111.