Busted Java 1.6 Webstart?
We seem to be having a 'weird' issue with the latest Java 1.6 build and our companies webstart application. We realise that 1.6 is still in beta stages but its good to stay ontop of these things.
Basically the applications works fine in 1.4 and 1.5 however if you try running the application in any version of 1.6 it falls over without much explanation.
We've come across 2 major issues so far with 1.6 and our webstart app, one we have been able to work around and the other is currently proving hard to debug.
The first bug we have noticed is that Java 1.6 doesn't like signed JAR files which don't include files outside of the META-INF directory. This problem was easily solved but creating a dummy file in the root of the JAR file and signing it accordingly. Bit of a crazy new feature.
The next issue we have encountered (and this is our problem) relates to opening URL connections from our app. It seems that in 1.6 a simple application can be written to access URLs over the web and can be executed via webstart with no problems however when this exact same code is inserted into our application (into a code location which has no problems in accessing the web in 1.4 or 1.5) java seems to fall over and throw some wobbly exceptions. Im not too sure if anyones experienced anything similar but if anyone has any suggestions on a code fix from our end or suggesting a requirement for 1.6 it would be greatly appreciated. I suspect theres an issue with Java 1.6 somewhere but wouldn't have at a guess as to where.
The suspect code we are having problems with looks like this...
URL url = new URL("jar:http://localhost:8080/webapp.jar!/webapp.war");
URLConnection connection = url.openConnection();
BufferedInputStream bufferedInputStream = new BufferedInputStream((InputStream) connection.getContent());
as I mentioned when this same code is run stand-alone in 1.6 webstart it works without problems. This problem only occurs when the code is inserted into the app in 1.6 and it works fine in 1.4 and 1.5.
And for those still reading the exception looks something like
java.io.IOException: Stream closed
at java.io.BufferedInputStream.getInIfOpen(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.javaws.Launcher.executeApplication(Unknown Source)
at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
with line 244 being the bufferedInputStream.read(); line.
Any questions, suggestions etc. all welcome.