xalan-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From santiag...@apache.org
Subject cvs commit: xml-xalan/java/src/org/apache/xml/serializer Encodings.java
Date Thu, 04 Dec 2003 18:52:38 GMT
santiagopg    2003/12/04 10:52:38

  Modified:    java/src/org/apache/xml/serializer Encodings.java
  Log:
  Reflection code to load sun.io.CharToByteConverter is now wrapped in a privileged action.
This is needed when user code is run without the required permssions.
  
  Revision  Changes    Path
  1.5       +15 -5     xml-xalan/java/src/org/apache/xml/serializer/Encodings.java
  
  Index: Encodings.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/serializer/Encodings.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Encodings.java	9 Oct 2003 00:41:54 -0000	1.4
  +++ Encodings.java	4 Dec 2003 18:52:38 -0000	1.5
  @@ -67,6 +67,8 @@
   import java.util.Hashtable;
   import java.util.Properties;
   import java.util.StringTokenizer;
  +import java.security.PrivilegedAction;
  +import java.security.AccessController;
   
   import org.apache.xml.utils.ObjectFactory;
   
  @@ -105,10 +107,18 @@
       private static Method findCharToByteConverterMethod() {
           try
           {
  -            Class charToByteConverterClass =
  -                Class.forName("sun.io.CharToByteConverter");
  -            Class argTypes[] = {String.class};
  -            return charToByteConverterClass.getMethod("getConverter", argTypes);
  +            AccessController.doPrivileged(new PrivilegedAction() {
  +                public Object run() {
  +                    try {
  +                        Class charToByteConverterClass = (Class) 
  +                            Class.forName("sun.io.CharToByteConverter");
  +                        Class argTypes[] = {String.class};
  +                        return charToByteConverterClass.getMethod("getConverter", argTypes);
  +                    }
  +                    catch (Exception e) {
  +                        throw new RuntimeException(e);
  +                    }
  +                }});
           }
           catch (Exception e)
           {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org


Mime
View raw message