United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6722585 : New plugin has very misleading error messages for invalid JNLP files

Details
Type:
Bug
Submit Date:
2008-07-04
Status:
Resolved
Updated Date:
2010-09-08
Project Name:
JDK
Resolved Date:
2008-07-19
Component:
deploy
OS:
windows_xp,windows
Sub-Component:
plugin
CPU:
x86
Priority:
P2
Resolution:
Fixed
Affected Versions:
6u10
Fixed Versions:
6u10 (b28)

Related Reports
Duplicate:
Relates:

Sub Tasks

Description
If the JNLP used for an applet is invalid then the applet will fail to load. This is correct. However, the error message in the Java console is extremely misleading, causing the developer to search in vain trying to fix the wrong thing.  The plugin will report that the JNLP file could not be found, when in fact it *was* found but it did not parse correctly. This problem has already been seen in the wild by external developers testing JavaSE 6 update 10 betas. 

Below is the stack trace produce if you leave the name, width, or height attributes out of the applet-desc element of your JNLP file:

exception: null.
java.io.FileNotFoundException: JNLP not available: foo.jnlp
   at sun.plugin2.applet.JNLP2Manager.loadJarFiles(Unknown Source)
   at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Exception: java.io.FileNotFoundException: JNLP not available: foo.jnlp

There are two things wrong here. First, there is an exception being thrown "exception: null" without printing the full stack trace or a description of the real problem. Second, the secondary exception: FileNotFoundException, is incorrect. The jnlp *was* in fact found, but the parsing failed because a required attribute was missing.  The actual failing code should instead be throwing a valid exception, and whatever code is throwing the FNF should check to ensure that the file was in fact not found.

To reproduce this error, take any working JNLP applet and remove the width attribute of the applet-desc tag in the JNLP file.

This error has been found in the community as evidenced by these forum posts:

http://forums.java.net/jive/thread.jspa?threadID=41534&tstart=0

http://forums.java.net/jive/thread.jspa?messageID=284047&tstart=0#284047

In the second case, it appears that the XML file was malformed, but again the exception was FileNotFound rather than an XML parsing exception.

                                    

Comments
EVALUATION

New code in Java Web Start in 6u10 for handling relative codebases,
which was introduced with the JNLP support in the new Java Plug-In in
6606784, was squelching exceptions during parsing of invalid JNLP
files, making it appear as though the file were missing as opposed to
malformed.

Added explicit checks for the parse exceptions and propagation of
these exceptions out of the JNLP parser. All of the calling code in
the workspace was already properly handling these potential exceptions
even though they weren't declared in the signatures of the methods in
question.
                                     
2008-07-18



Hardware and Software, Engineered to Work Together