Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6784894
Votes 0
Synopsis Regression: applets loaded from local disk can not access co-located resources
Category java_plugin:other
Reported Against
Release Fixed 6u12(b03), 5.0u18(b01) (Bug ID:2171010) , 1.4.2_20(b01) (Bug ID:2171220) , 1.3.1_25(b01) (Bug ID:2171221)
State 11-Closed, Verified, bug
Priority: 2-High
Related Bugs 6716217 , 6791926
Submit Date 13-DEC-2008
Description
The fix for 6716217 has introduced a regression where a developer's applet can no longer access its resources when loaded from the local disk. This issue is described on the forum thread http://forums.java.net/jive/thread.jspa?threadID=54799&tstart=0 .

A test case is attached. Navigate to the included HTML file. With 6u10 and earlier the applet will load. With 6u11 and later the applet will throw an AccessControlException that can be seen on the Java Console.

The directory setup is as follows:

   testcase/
            index.html
            jars/applet.jar
            images/image.jpg

The index.html references applet.jar in the applet tag. The codebase for the applet is set to be the "testcase" directory. The applet attempts to load the resource "images/image.jpg". With 6u11 and later this is throwing an AccessControlException because the applet is only receiving permissions to read recursively under the directory from which the jar was actually loaded rather than the codebase as in earlier releases.

This compatibility issue may impact an unknown number of developers.

One possible solution would involve granting permissions to read recursively under the document base of the applet.
Posted Date : 2008-12-13 20:36:00.0
Work Around
N/A
Evaluation
We are investigating how to fix the regression w/o undoing fix to 6716217
Posted Date : 2008-12-17 16:35:38.0

Fix:  

1.  Check for "file" protocol URL specifically for document base, and only grant recursive codebase read permission to this.

2.  If the document base file url is a unc url (contains hostname), do not grant recursive codebase read permission

3.  If document base is null, do not grant recursive codebase read permission

4.  to grant recursive codebase file read permission, the codesource url must either be a directory (class file case), or the codesource url must ends with .jar or .zip.

5.  Include same changes for old plugin
Posted Date : 2008-12-18 01:13:09.0
Comments
  
  Include a link with my name & email   

Submitted On 15-DEC-2008
This is critical for us too. We tested the preview of update 12 (build 02): still not fixed.


Submitted On 16-DEC-2008
AdrianVasiliu
For us, a slightly different directory setup is failing with 6u11 (while it used to work since ever):

testcase/
   index.html
   applet.jar
   images/image.jpg

The codebase points to a parent dir ("../../../.."). The jar is in the same dir as the html.


Submitted On 07-JAN-2009
Does the following testcase really work again?

#! /bin/sh

mkdir applet
mkdir applet/x

cat > applet/x/A.java << eof

package x;

public class A extends java.applet.Applet
{
  public void start ()
  {
    System.err.println (getClass ().getResource ("/a"));
  }
}

eof

javac -d applet applet/x/A.java

(cd applet && jar cf applet.jar x/A.class)

mkdir data

cd data

echo test > a

jar cf data.jar a

cat > x.html << eof

<html>
  <head>
    <title>Test</title>
  </head>
  <body>
    <applet codebase="../" 
            code="x.A" 
            archive="data/data.jar,applet/applet.jar" 
            width="200"
            height="100">
    </applet>
  </body>
</html>

eof

appletviewer x.html

# eof


Submitted On 07-JAN-2009
Previous testcase works with 6u12(b03).



PLEASE NOTE: JDK6 is formerly known as Project Mustang