jaxp/src/java.xml/share/classes/javax/xml/xpath/SecuritySupport.java
changeset 31284 e9b8469adb9a
parent 25868 686eef1e7a79
child 31287 d6581a7c221f
equal deleted inserted replaced
31216:43d0179ee9de 31284:e9b8469adb9a
    25 
    25 
    26 package javax.xml.xpath;
    26 package javax.xml.xpath;
    27 
    27 
    28 import java.net.URL;
    28 import java.net.URL;
    29 import java.security.*;
    29 import java.security.*;
    30 import java.net.*;
       
    31 import java.io.*;
    30 import java.io.*;
    32 import java.util.*;
    31 import java.util.*;
    33 
    32 
    34 /**
    33 /**
    35  * This class is duplicated for each JAXP subpackage so keep it in sync.
    34  * This class is duplicated for each JAXP subpackage so keep it in sync.
   129         }catch(PrivilegedActionException e){
   128         }catch(PrivilegedActionException e){
   130             throw (IOException)e.getException();
   129             throw (IOException)e.getException();
   131         }
   130         }
   132     }
   131     }
   133 
   132 
   134     InputStream getResourceAsStream(final ClassLoader cl,
       
   135                                            final String name)
       
   136     {
       
   137         return (InputStream)
       
   138             AccessController.doPrivileged(new PrivilegedAction() {
       
   139                 public Object run() {
       
   140                     InputStream ris;
       
   141                     if (cl == null) {
       
   142                         ris = Object.class.getResourceAsStream(name);
       
   143                     } else {
       
   144                         ris = cl.getResourceAsStream(name);
       
   145                     }
       
   146                     return ris;
       
   147                 }
       
   148             });
       
   149     }
       
   150 
       
   151     boolean doesFileExist(final File f) {
   133     boolean doesFileExist(final File f) {
   152     return ((Boolean)
   134     return ((Boolean)
   153             AccessController.doPrivileged(new PrivilegedAction() {
   135             AccessController.doPrivileged(new PrivilegedAction() {
   154                 public Object run() {
   136                 public Object run() {
   155                     return new Boolean(f.exists());
   137                     return new Boolean(f.exists());