United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-7063209 : JWS (started from desktop shorcut) doesn't update updated JNLP file from server

Details
Type:
Bug
Submit Date:
2011-07-06
Status:
Resolved
Updated Date:
2013-01-08
Project Name:
JDK
Resolved Date:
2011-08-17
Component:
deploy
OS:
windows_xp,windows_7
Sub-Component:
webstart
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
6u22,7
Fixed Versions:
7u2 (b03)

Related Reports
Backport:
Backport:
Backport:
Backport:
Duplicate:
Duplicate:

Sub Tasks

Description
FULL PRODUCT VERSION :
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) Client VM (build 20.1-b02, mixed mode, sharing)


ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [versio 5.1.2600]


A DESCRIPTION OF THE PROBLEM :
If there is a desktop shortcut to a JNLP application, the old JNLP file is used when run from the desktop shortcut even after the JNLP file is updated at the server. (This happens probably only if JWS cache path contains whitespace)

According to http://www.coderanch.com/t/528570/JNLP-Web-Start/java/Do-jnlp-file-updates-itself#2455103 this problem seems to happen only when the JWS cache path contains whitespace.

According to that discussion thread, the last Java version before this problem occurred was 1.6.21.

REGRESSION.  Last worked in version 6

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Note that in my example I have a local distribution and the change done to the JNLP file is changing the codebase. Anyway, with us, the problem occurs also with
i) other kind of changes (like adding a new jar needed by the application etc)
ii) when the application is distributed from a HTTP server (the actual usage where our problem is)


Actual step-by-step example:
1. Have a JNLP file with jar used (in my example at "D:\jnlp-test")
2. Start the application from the JNLP file (allow creating desktop shortcut)
3. Modify the JNLP file.
 - In my example, update the codebase to "D:\jnlp-test2". Also copy the JNLP and the jar to that directory.
4. Run the application from the desktop shortcut
  4.1 - t??ss?? vaiheessa pit??isi cachen JNLP olla p??ivittynyt
5. Poistaan D:\jnlp-test -hakemisto

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
a) After step 4 I expect that the cached JNLP application (viewer from Control Panel -> Java -> ...) should be updated to contain the new content (new codebase)

b) At step 5 my application should work fine from the new distribution location
ACTUAL -
a) My cached JNLP file still contains the old content (at my example codebase="file:/D:/jnlp-test/")

b) The problem crashes while trying to access the old location

ERROR MESSAGES/STACK TRACES THAT OCCUR :
Unable to launch the application

Error: D:\jnlp-test\DynamicTreeDemo.jar (M????ritetty?? polkua ei l??ydy)
--------------------------
(Note that The error message is "The path can't be found" in Finnish)

And:
--------------------------
java.io.FileNotFoundException: D:\jnlp-test\DynamicTreeDemo.jar (M????ritetty?? polkua ei l??ydy)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(Unknown Source)
	at java.io.FileInputStream.<init>(Unknown Source)
	at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
	at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source)
	at com.sun.deploy.net.BasicHttpRequest.doGetRequestEX(Unknown Source)
	at com.sun.deploy.net.DownloadEngine.isUpdateAvailable(Unknown Source)
	at com.sun.deploy.net.DownloadEngine.isUpdateAvailable(Unknown Source)
	at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
	at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
	at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
	at com.sun.javaws.LaunchDownload$DownloadTask.call(Unknown Source)
	at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)



REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
I am using the Dynamic Tree demo jar from
http://download.oracle.com/javase/tutorial/deployment/webstart/deploying.html ->
http://download.oracle.com/javase/tutorialJWS/deployment/webstart/ex6/webstart_ComponentArch_DynamicTreeDemo/DynamicTreeDemo.jar


My original JNLP file (step 1 & 2):

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.6+"
        codebase="file:/D:/jnlp-test/"
        href="dynamictree-webstart.jnlp">
    <information>
        <title>Dynamic Tree Demo</title>
        <vendor>Dynamic Team</vendor>
	<shortcut online="true">
		<desktop/>
	</shortcut>
    </information>
    <resources>
        <!-- Application Resources -->
        <j2se version="1.6+"
              href="http://java.sun.com/products/autodl/j2se"/>
        <jar href="DynamicTreeDemo.jar" main="true" />
    </resources>
    <application-desc
         main-class="webstartComponentArch.DynamicTreeApplication">
     </application-desc>
</jnlp>


My modified JNLP file (step 3, codebase changed):

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.6+"
        codebase="file:/D:/jnlp-test2/"
        href="dynamictree-webstart.jnlp">
    <information>
        <title>Dynamic Tree Demo</title>
        <vendor>Dynamic Team</vendor>
	<shortcut online="true">
		<desktop/>
	</shortcut>
    </information>
    <resources>
        <!-- Application Resources -->
        <j2se version="1.6+"
              href="http://java.sun.com/products/autodl/j2se"/>
        <jar href="DynamicTreeDemo.jar" main="true" />
    </resources>
    <application-desc
         main-class="webstartComponentArch.DynamicTreeApplication">
     </application-desc>
</jnlp>


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

CUSTOMER SUBMITTED WORKAROUND :
According to http://www.coderanch.com/t/528570/JNLP-Web-Start/java/Do-jnlp-file-updates-itself#2455103 this problem seems to happen only when the JWS cache path contains whitespace so changing the cache path should work.

(Unfortunately this makes the "easy installation" with JWS just a dream)

Release Regression From : 6u21
The above release value was the last known release where this 
bug was not reproducible. Since then there has been a regression.

                                    

Comments
EVALUATION

The problem, at least in 7 tree is that code in UpdateFinalLaunchDesc() checks if the file is in the cache by doing:
_args[0].startsWith(userCache)
however, here args[0] is something like: C:\\Documents and Settings\\Administrator\\Local Settings\\Application Data\\Sun\\Java\\Deployment\\cache\\6.0
and userCache is like:
C:\Documents and Settings\Administrator\Local Settings\Application Data\Sun\Java\Deployment\cache
so startsWith() returns false.

we need to canonicalize the paths.
                                     
2011-07-08



Hardware and Software, Engineered to Work Together