|
Quick Lists
|
|
Bug ID:
|
4687999
|
|
Votes
|
1
|
|
Synopsis
|
URL.openStream() throws AccessControlException when opening path with space char
|
|
Category
|
java_plugin:iexplorer
|
|
Reported Against
|
1.4
|
|
Release Fixed
|
|
|
State
|
11-Closed, duplicate of 4697178,
bug
|
|
Priority:
|
3-Medium
|
|
Related Bugs
|
4697178
|
|
Submit Date
|
20-MAY-2002
|
|
Description
|
customer is running an applet via a file url from a jar
file with a pathname that includes a space character.
when they open an input stream from a url made up of
the codebase (getDocumentBase()) & a filename, the URL's
openStream() method throws an AccessControlException.
this only happens with the 1.4.0 plugin - 1.3.1 was ok.
to test this, try running the applet at:
file:/net/kelvin.uk/export/dts/calls/417972/space dir/jdk14bug.htm
|
|
Work Around
|
N/A
|
|
Evaluation
|
Too late for Hopper. Committing to Mantis.
xxxxx@xxxxx 2002-05-23
I was not able to reproduce this problem using my own (local) example. Spaces in the directory names seem to work fine with jre 1.4.0 and 1.4.1
When I used example specified by the submitter, I got the exception. I looked at the directory, and found that the directory is linked to itself (so "space dir" has a softlink called "space dir" that is linked to itself. Why is it there? Could you please remove it and try running applet. I believe that it will work just fine. Please update the bug with your findings.
xxxxx@xxxxx 2002-05-31
Submitter removed the softlink from the example. I run test case again and verified that there are no exceptions now in the Java Console. Submitter is currently on vacation. I will wait untill he can verify that removal of softlink fixes the problem before closing the bug as "user error".
xxxxx@xxxxx 2002-06-07
The exception is still thrown in Java Console. I tried running the applet through appletviewer. The same exceptions that are trown in Java Console are thrown in korn shell window if I am running the jdk14bug.htm with appletviewer 1.4.1 These exceptions do not occur in appletviewer from jdk1.3.1. I have two more examples of applets that have spaces in their paths, but there are no exceptions while running those applets with either jdk1.4.1 or 1.3.1 - one of the differences that I see between my examples and submitter's is that submitter's example is reading a string from a text file to be displayed inside applet's box.
This does not look like plug-in bug, since it is reproducible with appletviewer.
xxxxx@xxxxx 2002-06-10
Looks like this bug is a duplicate of 4697178. Fix for bug 4697178 is planned for hopper.
xxxxx@xxxxx 2002-06-11
close as aforementioned duplicat (4697178) and will be committed to 1.4.0_03
xxxxx@xxxxx 2002-06-11
|
|
Comments
|
Submitted On 19-OCT-2005
harmmeijer
1.4.2_3 on windows shows the same exception when a method using the URL is called from javascript.
here is the java file:
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.applet.*;
public class test extends Applet{
public void init(){
try{
System.out.println("From init");
System.out.println(
new String(this.openURL(null,new URL(this.getCodeBase(),
"test.txt")),"UTF-8"));
}catch(Exception e){
e.printStackTrace();
}
}
public void methodFromScript(){
try{
System.out.println("From JScript");
System.out.println(
new String(this.openURL(null,new URL(this.getCodeBase(),
"test.txt")),"UTF-8"));
}catch(Exception e){
e.printStackTrace();
}
}
public byte[] openURL(String urlpath,URL u) {
InputStream is;
byte[] buf = new byte[1024];
try {
URL a = null;
if(u!=null){
a = u;
}else{
a = new URL(urlpath);
}
is = a.openStream();
System.out.println("stream is opened");
int len = 0;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
while ((len = is.read(buf)) > 0) {
bos.write(buf, 0, len);
}
System.out.println("file is red, length is:");
System.out.println(bos.toByteArray().length);
// close the inputstream
is.close();
return bos.toByteArray();
} catch (IOException e) {
e.printStackTrace();
}
return new byte[0];
}
}
The html file:
<object
classid = "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
id="myApplet">
<PARAM NAME = CODE VALUE = "test" >
<PARAM NAME = MAYSCRIPT VALUE = TRUE >
<param name = "type" value = "application/x-java-applet">
<param name = "scriptable" value = "false">
<comment>
<embed
type = "application/x-java-applet" \
CODE = "test" \
MAYSCRIPT = TRUE
scriptable = false
pluginspage = "http://java.sun.com/products/plugin/index.html#download">
<noembed>
</noembed>
</embed>
</comment>
</object>
<input type=button onclick="alert(document.getElementById('myApplet').methodFromScript());" />
Thows:
at java.io.File.isDirectory(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |