JDK-8163338 : JnlpDownloadServlet doesn't handle newline character properly
  • Type: Bug
  • Component: deploy
  • Sub-Component: webstart
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-08-08
  • Updated: 2017-02-08
  • Resolved: 2016-08-25
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b135Fixed
Related Reports
Relates :  
Description
Take the jnlp file below for example(there is no space before codebase)
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+"
codebase="http://127.0.0.1:8080/runtimeArgs/html/"
 href="RuntimeArgsUnTrustedPrintHeapAtGC.jnlp">
  <information>
    <title>RuntimeArgs Test Applet Demo</title>
    <vendor>Sun Microsystems, Inc.</vendor>
    <offline-allowed />
   <shortcut online="false">
      <desktop/>
      <menu submenu="Sun Microsystems Applets"/>
    </shortcut>
  </information>
  <resources>
      <j2se version="1.5+" java-vm-args="-XX:+PrintHeapAtGC"/>
        <jar href="../classes/test.jar"/>
        <jar href="../classes/helper.jar"/>
    </resources>
    <applet-desc main-class="TestAppletRuntime" name="Java applet" height="400" width="600">
      <param name="testParams" value="-XX:+PrintHeapAtGC"/>
      <param name="myName" value="SecureArgUntrusted"/>
    </applet-desc>
</jnlp> 

After JnlpDownloadServlet's processing it becomes
<?xml version="1.0" encoding="UTF-8"?><jnlp spec="1.0+"codebase="http://127.0.0.1:8080/runtimeArgs/html/" href="RuntimeArgsUnTrustedPrintHeapAtGC.jnlp"> <information> <title>RuntimeArgs Test Applet Demo</title> <vendor>Sun Microsystems, Inc.</vendor> <offline-allowed /> <shortcut online="false"> <desktop/> <menu submenu="Sun Microsystems Applets"/> </shortcut> </information> <resources> <j2se version="1.5+" java-vm-args="-XX:+PrintHeapAtGC"/> <jar href="../classes/test.jar"/> <jar href="../classes/helper.jar"/> </resources> <applet-desc main-class="TestAppletRuntime" name="Java applet" height="400" width="600"> <param name="testParams" value="-XX:+PrintHeapAtGC"/> <param name="myName" value="SecureArgUntrusted"/> </applet-desc></jnlp> 

there is no space between "spec" and "codebase" attributes, the jnlp xml is not valid.
Comments
took a little setup to test - but fix is simple. new JNLP Parser in 8u20 is more strict than old one. in 8u, we would fallback to old parser, not so in 9, so it fails to parse such jnlp files generated by the servlet.
23-08-2016

As a result following exception is thrown while running the JNLP Apps using JDK9 JNLParseException[ Could not parse launch file. Error at line 1.] at com.sun.javaws.jnl.XMLFormat.parse(jdk.javaws@9-ea/XMLFormat.java:63) at com.sun.javaws.jnl.XMLFormat.parse(jdk.javaws@9-ea/XMLFormat.java:85) at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(jdk.javaws@9-ea/LaunchDescFactory.java:113) at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(jdk.javaws@9-ea/LaunchDescFactory.java:138) at com.sun.javaws.jnl.LaunchDescFactory._buildDescriptor(jdk.javaws@9-ea/LaunchDescFactory.java:282) at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(jdk.javaws@9-ea/LaunchDescFactory.java:225) at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(jdk.javaws@9-ea/LaunchDescFactory.java:481) at sun.plugin2.applet.JNLP2Manager.initialize(jdk.plugin@9-ea/JNLP2Manager.java:332) at sun.plugin2.main.client.PluginMain.initManager(jdk.plugin@9-ea/PluginMain.java:1153) at sun.plugin2.main.client.PluginMain.access$200(jdk.plugin@9-ea/PluginMain.java:87) at sun.plugin2.main.client.PluginMain$2.run(jdk.plugin@9-ea/PluginMain.java:1045) at java.lang.Thread.run(java.base@9-ea/Thread.java:843) Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 56; Element type "jnlp" must be followed by either attribute specifications, ">" or "/>".
08-08-2016