rwinch / spring-ldap-migrate-issues

0 stars 0 forks source link

LDAP-295: DefaultObjectDirectoryMapper#isAtLeast30() produces NullPointerException when bundled into an uberjar #297

Closed rwinch closed 10 years ago

rwinch commented 10 years ago

Migrated from LDAP-295

I was trying to leverage Spring LDAP 2.0 within a self contained JAR project (basically, a WAR which is packaged in a JAR file using the maven shade plugin). When doing so, I get the following exception:

Caused by: java.lang.NullPointerException: null at org.springframework.ldap.odm.core.impl.DefaultObjectDirectoryMapper.isAtLeast30(DefaultObjectDirectoryMapper.java:80)

Tracing this back, I determined the following call was failing:

    private boolean isAtLeast30() {
        return SpringVersion.getVersion().compareTo("3.0") > 0;
    }

According to the Spring API documentation, it's perfectly valid for getVersion to return null, but this code doesn't check for that scenario.

There needs to be some fallback scenario for this code to handle that issue.

rwinch commented 10 years ago

Thomas Beauvais said:

Has this yet been pushed to the 2.0.1.CI-SNAPSHOT because I am still experiencing this error.

rwinch commented 10 years ago

Rob Winch said:

Please try 2.0.1.RELEASE