Skip to content

Axis.getDirection() may return null, violating GeoAPI contract #80

Description

@Manas-Dikshit

The Axis class in PROJ-JNI currently retrieves the axis direction using the search method:

final String dir = impl.getStringProperty(Property.DIRECTION);
return search(AxisDirection.class, dir);

If the property is missing or unrecognized, search returns null. Consequently, Axis.getDirection() can return null, which violates the CoordinateSystemAxis GeoAPI contract that expects a valid AxisDirection. This can lead to NullPointerException in downstream code that relies on a non-null direction, breaking transformations or coordinate operations.

Expected Behavior:
getDirection() should never return null. A sensible default such as AxisDirection.OTHER should be returned when the axis direction is unknown.

Impact:

Potential runtime crashes in any application using PROJ-JNI CRS objects.
Violates GeoAPI interface guarantees.
Makes debugging silent failures difficult.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions