Categories
Hints

Java String.isEmpty interrupts method call or thread

Does your call of String.isEmpty in your code cause strange behaviour such as:

– sudden interruption of method call (as if return was called)

– thread interruption

?

The problem is quite simple – you had build your code using JDK 1.6 with language compatibility set to previous version (1.4, 1.5) hoping the compiler would use the correct classes. This is, however, not true.

When you use the version switch the current JDK classes signatures are used. That means isEmpty is present as method of String class in 1.6. It is not present in previous releases.

Solution: Remove call of isEmpty and use the JDK you need without language compatibility to build against required version.

Categories
Software & Development

AXIS SOAPFaultBuilder throws DOMException WRONG_DOCUMENT_ERR

Did you try to use Axis to connect to a remote web service? Do you get “SOAPFaultBuilder throws DOMException WRONG_DOCUMENT_ERR” error?

Well, it’s a well known bug that’s been fixed. However, the fix has not been included in any released version (that’s since 2006). You have to download the sources, add one line, change the next one and then build it on your own (the error is received when xml node was added to document node before it’s been imported into the DOM). So far so good.

The issue is that Axis is written in Java 1.4. Java 1.6 (current JDK 1.6) insists on using 1.6 version of abstract classes (e.g. javax.xml.soap.SOAPMessage) even if you specify -source 1.4 switch (if you wonder if the switch is not just ignored then you’re wrong – it isn’t, because you won’t get as many warning as for 1.6 value).

So, you have to use JDK 1.4, but where to get it? You can download it from Sun’s site, but wait – oops, you can’t anymore, because it’s reached the end of service life (ESL).

I found the old JDK 1.4 somewhere on my harddrive and compiled the fixed version for you. If you want it, you can grab it here. Source can be found here. To see the changes check SOAPFaultBuilder.java on lines 304-306.