Closed sschulz92 closed 2 years ago
The fix is hidden by the code-formatter, to clearify I changed the following part on purpose:
Old code:
AttributeType originalAttributeType = originalFeatureType.getType(name); if (originalAttributeType == null && originalAttributeType instanceof GeometryType) { crs = ((GeometryType) originalAttributeType).getCoordinateReferenceSystem(); } else { crs = originalFeatureType.getCoordinateReferenceSystem(); }
New code:
AttributeType originalAttributeType = originalFeatureType.getType(name); if (originalAttributeType != null && originalAttributeType instanceof GeometryType) { crs = ((GeometryType) originalAttributeType).getCoordinateReferenceSystem(); } else { crs = originalFeatureType.getCoordinateReferenceSystem(); }
Note the switch from == null towards != null.
== null
!= null
This will solve a SonarQube issue also, which detects this bug basically.
Thanks a ton for this potential NullPointerException!
The fix is hidden by the code-formatter, to clearify I changed the following part on purpose:
Old code:
New code:
Note the switch from
== null
towards!= null
.This will solve a SonarQube issue also, which detects this bug basically.