United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7158073 Regression : Incorrect handling of parameters to jnlp_href applets
JDK-7158073 : Regression : Incorrect handling of parameters to jnlp_href applets

Details
Type:
Bug
Submit Date:
2012-03-30
Status:
Resolved
Updated Date:
2012-04-21
Project Name:
JDK
Resolved Date:
2012-04-21
Component:
deploy
OS:
generic
Sub-Component:
plugin
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:

Related Reports
Backport:
Relates:

Sub Tasks

Description
SYNOPSIS
--------
Incorrect handling of parameters to jnlp_href applets

OPERATING SYSTEMS
-----------------
Possible applicable to all platforms.
Have only Tested on Windows. 
See description for XP, Vista, 7 specifics.

FULL JDK VERSION
----------------
Java 7 (1.7.0_02 onwards for one of the issues)

DESCRIPTION from LICENSEE
-------------------------
We have noticed some deviations from documented behaviour with regard to the parameters that are passed to the VM when "java_arguments" is defined in html and "java-vm-args" is defined in the jnlp (specified in the jnlp_href property in the .html).

One of the problems seem to have been introduced in 1.7.0_02, possibly by the fix for a previous (similar, but different) issue, reported under CR 7051942. Note that 7051942 only applied to Windows Vista and later, whereas this new report applies to all versions of Windows, including XP.

The documented behaviour is as follows:

  "Any applet parameters specified using the <param> tag are merged
   with those specified in the JNLP file. If the same parameter is
   specified through both the <applet> tag and the JNLP file, the
   <applet> tag's version overrides the JNLP file's version, except
   for the java_arguments and java_version parameters.

   The new java_arguments and java_version parameters are unnecessary
   in JNLP applets. The mechanisms in the JNLP file for requesting a
   JRE version, or passing command-line arguments to the JVM, are used
   instead. Command-line arguments and JRE version requests from the
   JNLP file override those specified in the HTML for the applet."

   http://java.sun.com/developer/technicalArticles/javase/newapplets/

REPRODUCTION INSTRUCTIONS
-------------------------
The testcases are attached.
We tested 4 argument-passing scenarios for "jnlp_href" applets. In some cases the results seem to differ from the documented behaviour, while others are inconsistent with one another.

Scenario 1:
Both these parameters are defined and they are different from each other.
  java_arguments = -Djnlp.altCrossDomainXMLFiles=http://linsvt23.in.xxx.com:8080/crossdomain.xml -Djnlp.altCrossDomainXMLFiles1=http://abc.in.xxx.com:8080/crossdomain.xml
  java-vm-args   = -verbose

Scenario 2:
Both these parameters are defined, the arguments defined in "java-vm-args" are a subset of those defined in "java_arguments".
  java_arguments = -Djnlp.altCrossDomainXMLFiles=http://linsvt23.in.xxx.com:8080/crossdomain.xml -Djnlp.altCrossDomainXMLFiles1=http://abc.in.xxx.com:8080/crossdomain.xml
  java-vm-args   = -Djnlp.altCrossDomainXMLFiles=http://linsvt23.in.xxx.com:8080/crossdomain.xml

Scenario 3:
"java_arguments" defined in html, "java-vm-args" NOT defined in the jnlp.          
  java_arguments = -Djnlp.altCrossDomainXMLFiles=http://linsvt23.in.xxx.com:8080/crossdomain.xml -Djnlp.altCrossDomainXMLFiles1=http://abc.in.xxx.com:8080/crossdomain.xml
  java-vm-args   = [not defined]

Scenario 4:
"java_arguments" NOT defined in html, "java-vm-args" defined in the jnlp.
  java_arguments = [not defined]
  java-vm-args   = -Djnlp.altCrossDomainXMLFiles=http://linsvt23.in.xxx.com:8080/crossdomain.xml

RESULTS
-------          
Results with 7u1-b08
====================
Scenario 1:
On both Vista and XP, the VM receives only the "-verbose" argument.

Scenario 2:
On both Vista and XP, the VM receives the arguments "-Djnlp.altCrossDomainXMLFiles=http://linsvt23.in.xxx.com:8080/crossdomain.xml -Djnlp.altCrossDomainXMLFiles1=http://abc.in.xxx.com:8080/crossdomain.xml"

Scenario 3:
On Vista, no arguments are passed to the VM.
On XP, the java_arguments are passed to the VM: "-Djnlp.altCrossDomainXMLFiles=http://linsvt23.in.xxx.com:8080/crossdomain.xml -Djnlp.altCrossDomainXMLFiles1=http://abc.in.xxx.com:8080/crossdomain.xml"

Scenario 4:
On both Vista and XP, the VM receives the argument "-Djnlp.altCrossDomainXMLFiles=http://linsvt23.in.xxx.com:8080/crossdomain.xml"

Results with 7u3-b05
====================
Scenario 1:
On both Vista and XP, the VM receives only the "-verbose" argument.
 
Scenario 2:
On both Vista and XP, the VM receives the arguments "-Djnlp.altCrossDomainXMLFiles=http://linsvt23.in.xxx.com:8080/crossdomain.xml -Djnlp.altCrossDomainXMLFiles1=http://abc.in.xxx.com:8080/crossdomain.xml"

Scenario 3:
On both Vista and XP, the VM receives no arguments.

Scenario 4:
On both Vista and XP, the VM receives the argument "-Djnlp.altCrossDomainXMLFiles=http://linsvt23.in.ibm.com:8080/crossdomain.xml"

Expected behaviour
------------------
1. Since the fix for 7051942 in 1.7.0_02, Scenario 3 is now behaving the same way (i.e. incorrectly) on XP as it did on Vista before the fix.

2. The documentation suggests that the behaviour in Scenario 3 needs to be fixed. When "java-vm-args" is not defined, the parameters defined in "java_arguments" should be passed to the VM. At present, nothing is being passed to the VM in this scenario.

3. The documentation is not completely clear as to the expected behaviour in Scenarios 1 and 2. Specifically:

   "Command-line arguments and JRE version requests from the JNLP file
    override those specified in the HTML for the applet"

It is not clear whether the intended behaviour is that the values of individual arguments defined in the JNLP should override those in the HTML (as in Scenario 2), or whether the entire list of arguments provided by "java-vm-args" should override the list provided by "java_arguments" (as in Scenario 1). What is clear is that the current behaviour is inconsistent, depending on the content of these parameters. At present, the arguments from the two locations are merged if, and only if, the arguments defined in "java-vm-args" are a subset of those defined in "java_arguments".

                                    

Comments
EVALUATION

We are fixing it so that the jnlp java-vm-args will override java_arguments html param. So the expected results are as follows:

Expected behavior on all platforms:
-----------------------------------
Scenario 1:  -verbose
first launch with java_arguments, client jvm find out mis-match, re-launch with -verbose only.  output alert message in java console  about param mismatch to warn developer.

Scenario 2:  -Djnlp.altCrossDomainXMLFiles=http://linsvt23.in.xxx.com:8080/crossdomain.xml
first launch with java_arguments, client jvm find out mis-match, re-launch with -Djnlp.altCrossDomainXMLFiles=http://linsvt23.in.xxx.com:8080/crossdomain.xml only.  output alert message in java console  about param mismatch to warn developer.

Scenario 3:  [no jvm params]
first launch with java_arguments, client jvm find out mis-match, re-launch jvm with no params.  output alert message in java console  about param mismatch to warn developer.

Scenario 4:  -Djnlp.altCrossDomainXMLFiles=http://linsvt23.in.xxx.com:8080/crossdomain.xml
first launch with java_arguments [no jvm args], client jvm find out mis-match, re-launch jvm with jvm params.

A doc. bug 7160154 has also been filed to clarify the document.
                                     
2012-04-10
SUGGESTED FIX

webrev: http://sa.us.oracle.com/projects/deployment_data/8/7158073

Changes:

- added a boolean flag in JVMParameters to indicate the jvm args are from the html java_arguments param;

- in JVMParameters, added a condition to check for the sizes of the current args and the "other" are the same if the current args are from html java_arguments;

- in JVMManager, prior to creating a JVMInstance, make sure to set the isHtmlJavaArguments flag of JVMParameters;

- JVMInstance needs to be aware of the isHtmlJavaArguments setting of JVMParameters so that it can pass to the client VM via the SetJVMIDMessage;

- in PluginMain, during the handling of SetJVMIDMessage, it will obtain the isHtmlArguments flag from the message and setup the running JVM parameters with it.
                                     
2012-04-11



Hardware and Software, Engineered to Work Together