-
Bug
-
Resolution: Fixed
-
P3
-
1.4.0
-
beta2
-
generic
-
generic
Name: mlR10151 Date: 04/12/2001
The spec for the "public FileImageInputStream(RandomAccessFile raf)" reads:
Throws:
. . .
SecurityException - if a security manager exists and does not allow read access to the file.
But it does not throw SecurityException:
========================== a.java =============================
import java.io.*;
import java.security.*;
import javax.imageio.stream.*;
public class a {
public static void main (String argv[]) throws Exception {
System.setSecurityManager(null);
RandomAccessFile raf = new RandomAccessFile("a.java", "r");
System.setSecurityManager(new mySecMgr());
try {
new FileImageInputStream(raf);
System.out.println("Failed");
} catch (SecurityException e) {
System.out.println("Passed");
}
}
}
class mySecMgr extends SecurityManager {
public mySecMgr() {}
public void checkRead(String file) { throw new SecurityException(); }
public void checkRead(FileDescriptor fdObj) { throw new SecurityException(); }
public void checkRead(String file, Object context) { throw new SecurityException(); }
public void checkPermission(Permission perm) { throw new SecurityException(); }
public void checkPermission(Permission perm, Object context) { throw new SecurityException(); }
}
===========================log========================
% java -version
java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b59)
Java HotSpot(TM) Client VM (build 1.4.0-beta-b59, mixed mode)
% java a
Failed
This bug causes failure of the new JCK test
api/javax_imageio/stream/FileImageInputStream/index.html#Ctor
======================================================================