-
Bug
-
Resolution: Fixed
-
P2
-
1.1, 1.1.1, 1.1.4
-
1.1.6
-
generic, x86
-
solaris_2.6, windows_95, windows_nt
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2015425 | 1.2.0 | Mark Reinhold | P2 | Resolved | Fixed | 1.2beta3 |
KGH 5/26/97
This only happens on win32. It was originally reported as part of 4050562
where it shows up as a problem with applet resource loading.
If within an applet you try to do a "File.isDirectory" on a name that
references a non-existent parent directory then you get applet security
error messages printed on your console.
See the example applet, html file, and error output below. The applet
first tries isDirectory on a non-existent name "xyz". This fails silently
(like it's supposed to!) and returns false. Then the applet tries to
do isDiretcory on a non-existemnt compound name "foo/bah/lah". This
throws an AppletSecurityException and prints various alarming messages.
The underlying problem seems to be that on win32 File.getCanonicalPath
throws an IOException on an unknown path, whereas on Solaris it happily
returns a bogus path.
Note that because this results in streams of security messages when
accessing non-existent pathname resources, the bug is actually a lot
more serious than it looks on first glance.
------------------
Fred.java
------------------
public class Fred extends java.applet.Applet {
public void init() {
try {
java.io.File f = new java.io.File("xyz");
boolean b = f.isDirectory();
System.err.println("first => " + b);
f = new java.io.File("a/b/xyz");
b = f.isDirectory();
System.err.println("second => " + b);
} catch (Exception ex) {
System.err.println("caught: " + ex);
}
}
}
-----------------
fred.html
-----------------
<applet code=Fred.class width=100 height=100></applet>
----------------
output
----------------
Z:\tmp\test2>appletviewer fred.html
first => false
sun.applet.AppletSecurityException: checkread.exception1
at sun.applet.AppletSecurity.checkRead(AppletSecurity.java:362)
at sun.applet.AppletSecurity.checkRead(AppletSecurity.java:346)
at java.io.File.isDirectory(File.java:380)
at Fred.init(Fred.java:12)
at sun.applet.AppletPanel.run(AppletPanel.java:287)
at java.lang.Thread.run(Thread.java:474)
sun.applet.AppletSecurityException: checkread.exception1
at sun.applet.AppletSecurity.checkRead(AppletSecurity.java:362)
at sun.applet.AppletSecurity.checkRead(AppletSecurity.java:346)
at java.io.File.isDirectory(File.java:380)
at Fred.init(Fred.java:12)
at sun.applet.AppletPanel.run(AppletPanel.java:287)
at java.lang.Thread.run(Thread.java:474)
caught: sun.applet.AppletSecurityException: checkread.exception1
- backported by
-
JDK-2015425 java.io.File.isDirectory: AppletSecurityExceptions on non-existent dirs (win32)
-
- Resolved
-
- duplicates
-
JDK-4086902 java.io.File: No way to determine the canonical path of a non-existent file
-
- Closed
-