< prev index next >

src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/SecuritySupport.java

Print this page




  99 
 100     FileInputStream getFileInputStream(final File file)
 101     throws FileNotFoundException
 102     {
 103         try {
 104             return (FileInputStream)
 105             AccessController.doPrivileged(new PrivilegedExceptionAction() {
 106                 public Object run() throws FileNotFoundException {
 107                     return new FileInputStream(file);
 108                 }
 109             });
 110         } catch (PrivilegedActionException e) {
 111             throw (FileNotFoundException)e.getException();
 112         }
 113     }
 114 
 115     boolean getFileExists(final File f) {
 116         return ((Boolean)
 117                 AccessController.doPrivileged(new PrivilegedAction() {
 118                     public Object run() {
 119                         return new Boolean(f.exists());
 120                     }
 121                 })).booleanValue();
 122     }
 123 
 124     long getLastModified(final File f) {
 125         return ((Long)
 126                 AccessController.doPrivileged(new PrivilegedAction() {
 127                     public Object run() {
 128                         return new Long(f.lastModified());
 129                     }
 130                 })).longValue();
 131     }
 132 
 133     private SecuritySupport () {}
 134 }


  99 
 100     FileInputStream getFileInputStream(final File file)
 101     throws FileNotFoundException
 102     {
 103         try {
 104             return (FileInputStream)
 105             AccessController.doPrivileged(new PrivilegedExceptionAction() {
 106                 public Object run() throws FileNotFoundException {
 107                     return new FileInputStream(file);
 108                 }
 109             });
 110         } catch (PrivilegedActionException e) {
 111             throw (FileNotFoundException)e.getException();
 112         }
 113     }
 114 
 115     boolean getFileExists(final File f) {
 116         return ((Boolean)
 117                 AccessController.doPrivileged(new PrivilegedAction() {
 118                     public Object run() {
 119                         return f.exists();
 120                     }
 121                 })).booleanValue();
 122     }
 123 
 124     long getLastModified(final File f) {
 125         return ((Long)
 126                 AccessController.doPrivileged(new PrivilegedAction() {
 127                     public Object run() {
 128                         return new Long(f.lastModified());
 129                     }
 130                 })).longValue();
 131     }
 132 
 133     private SecuritySupport () {}
 134 }
< prev index next >