JDK-8159136 : NullPointerException when starting from signed JNLP file with non-standard VM args
  • Type: Bug
  • Component: deploy
  • Sub-Component: webstart
  • Affected Version: 8-pool
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_7
  • CPU: x86
  • Submitted: 2016-06-06
  • Updated: 2017-06-14
  • Resolved: 2017-06-14
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 8
8-poolResolved
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_92"
Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
Java HotSpot(TM) Client VM (build 25.92-b14, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]

A DESCRIPTION OF THE PROBLEM :
Starting a webstart application gives a NullPointerException on the client if the file contains Java 9-style VM arguments (-addmods thing for example, instead of -Xarg=value)

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Produce a small webstart application
2. Make sure the JNLP file has <j2se version="1.6+" max-heap-size="512m" java-vm-args="-ea -addmods java.se.ee"/> in it
3. Sign the JNLP file and the JAR file
4. Launch the application

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The application should launch

ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.NullPointerException
	at com.sun.javaws.JnlpxArgs.execProgram(Unknown Source)
	at com.sun.javaws.Launcher.relaunch(Unknown Source)
	at com.sun.javaws.Launcher.prepareResources(Unknown Source)
	at com.sun.javaws.Launcher.prepareAllResources(Unknown Source)
	at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
	at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
	at com.sun.javaws.Launcher.launch(Unknown Source)
	at com.sun.javaws.Main.launchApp(Unknown Source)
	at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
	at com.sun.javaws.Main.access$000(Unknown Source)
	at com.sun.javaws.Main$1.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
test.jnlp
======

<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="6.0+" codebase="http://jfkweb.cib.net/webstart" href="test.jnlp">
  <information>
    <title>Test app</title>
    <vendor>Anon</vendor>
    <offline-allowed/>
  </information>
  <security>
      <all-permissions/>
  </security>
  <update check="always" policy="always" />
  <resources>
    <j2se version="1.6+" max-heap-size="512m" java-vm-args="-ea -addmods java.se.ee"/>
    <jar href="test.jar" main="true"/>
  </resources>

  <application-desc main-class="Toto"/>
</jnlp>

Toto.java
=========

public class Toto {
  public static void main(String... argv) throws Exception {
    System.out.println("Success.");
  }
}


---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Add an extra line to the JNLP file so that the Java 9-style arguments are only taken into account for jdk > 8


Comments
Updated the test case with signed jnlp again and could reconfirm the issue as stated. Checked this for 8u71 b52: FAIL 8u91 b15: FAIL 8u92 b14: FAIL 8u102 b12: FAIl In the console log following text observed before the generation of exception: ---------------------------------------------------- Cannot use secure launcher with main class: java.se.ee #### Java Web Start Error: ----------------------------------------------------- java.lang.NullPointerException at com.sun.javaws.JnlpxArgs.execProgram(Unknown Source) at com.sun.javaws.Launcher.relaunch(Unknown Source) at com.sun.javaws.Launcher.prepareResources(Unknown Source) at com.sun.javaws.Launcher.prepareAllResources(Unknown Source) at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source) at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source) at com.sun.javaws.Launcher.launch(Unknown Source) at com.sun.javaws.Main.launchApp(Unknown Source) at com.sun.javaws.Main.continueInSecureThread(Unknown Source) at com.sun.javaws.Main.access$000(Unknown Source) at com.sun.javaws.Main$1.run(Unknown Source) at java.lang.Thread.run(Unknown Source) ----------------------------------------------------------------------------------------- Based upon additional information from the submitter the bug has its roots in the method com.sun.deploy.util.ArgumentParsingUtil#getSecureLaunchArgs. When iterating through the argument list it stops at the first argument that doesn���t start with ���-��� and which doesn���t come after -cp, -classpath or -jar. This means that "java-vm-args="-ea -addmods java.se.ee" gets interpreted as arguments = [-ea, -addmods], main class = java.se.ee which is obviously erroneous. Moving this up for dev. review.
15-06-2016