Atlassian Crowd 2.1.0 – JDK 1.5 incompatibility

Yesterday we tried to update our Atlassian Crowd server to 2.1.0. Crowd is a SSO and identity management solution from Atlassian. Updating Crowd normally is a breeze, but not this time. At my current client we run Crowd on JBoss 4.2.0.GA with a Sun JDK 1.5.0_22. We did a compatibility check if Crowd 2.1.0 is compatible with JDK 1.5. According to the documentation Crowd should run fine on JDK 1.5.

We deployed the new Crowd war file to JBoss, started the server and tailed the log file. Everything looked ok, Crowd deployed succesfull but when we tried logging in to Crowd the server.log displayed the following exception:

Servlet.service() for servlet default threw exception
java.lang.NoSuchMethodError: java.lang.String.isEmpty()Z
        at com.atlassian.crowd.integration.http.util.CrowdHttpTokenHelperImpl.buildCookie(CrowdHttpTokenHelperImpl.java:194)
        at com.atlassian.crowd.integration.http.util.CrowdHttpTokenHelperImpl.setCrowdToken(CrowdHttpTokenHelperImpl.java:149)
        at com.atlassian.crowd.integration.http.HttpAuthenticatorImpl.setPrincipalToken(HttpAuthenticatorImpl.java:113)

This exception indicates that the CrowdHttpTokenHelperImpl.buildCookie uses the isEmpty method from the class java.lang.String but it does not exist. And that is correct because the isEmpty method was introduced in JDK 1.6.

I decompiled the crowd-integration-client-common-2.1.0.jar which contains the code throwing the exception: CrowdHttpTokenHelperImpl.buildCookie. Line 194 contains the following:

 if ((domain != null) && (!domain.isEmpty()) && (!"localhost".equals(domain)))

This is indeed JDK 1.6 code that is being called. I filed a bug report at Atlassian: CWD-2143.

The problem only occures when Crowd is configured to use SSO. The piece of codes reads the SSO cookie and does some validation.

So be warned if you want to update your Crowd instance that runs on JDK 1.5!

Leave a Reply