Ramesh,

Can you modify the patch to take care of the JDK 1.1.8 compatibility issue?
If there is no replacement mechanism for JDK 1.1.8, we can just fall back
to the old behavior. Thanks for taking the effort.

Morris Kwan
XSLT Development
IBM Toronto Lab
Tel: (905)413-3729
Email: [EMAIL PROTECTED]



                                                                                       
                                            
                      Ramesh Mandava                                                   
                                            
                      <ramesh.mandava@s        To:       [EMAIL PROTECTED]      
                                            
                      un.com>                  cc:                                     
                                            
                                               Subject:  Re: [PATCH] For allowing 
xalan to read property files without opening     
                      11/15/2002 08:30          upcontainer permissions                
                                            
                      PM                                                               
                                            
                      Please respond to                                                
                                            
                      xalan-dev                                                        
                                            
                                                                                       
                                            
                                                                                       
                                            



Thank you Morris and Tom. I have tested it aginst J2EE RI and Petstore app.


Morris: I just read your concern about running against JDK 1.1.8. If that
is the requirement then I can modify the Patch to take care of this
situation. Thanks again for considering the patch.


Regards
-Ramesh

PS: Sorry for the delayed response.

Tom Amiro wrote:
      Morris,

      Thanks so much. I know Ramesh pretty well and can atest that
      he would have verified it in the J2EE environment. We can
      follow up nonetheless.

      Tom


      [EMAIL PROTECTED] wrote:

            The patch looks reasonable. I will commit it. I don't have a
            J2EE
            enviroment to test it with though. I assume that Ramesh already
            tested the
            code with that environment.

            Morris Kwan
            XSLT Development
            IBM Toronto Lab
            Tel: (905)413-3729
            Email: [EMAIL PROTECTED]


                                  Tom Amiro
                                  <[EMAIL PROTECTED]        To:
            [EMAIL PROTECTED]
                                  M>                       cc:
            [EMAIL PROTECTED]
                                  Sent by:                 Subject:  Re:
            [PATCH] For allowing xalan to read property files without
            opening up
                                  [EMAIL PROTECTED]         container
            permissions


                                  11/15/2002 11:37
                                  AM
                                  Please respond to
                                  xalan-dev



            Hi,

            I remember running into this problem with the Petstore
            application
            and getting around it by opening up the permissions. But we,
            Santiago and I, discussed changing Xalan so it would use
            reasonable defaults if it couldn't read the output properties
            file. For some reason, we never got around to doing anything
            about
            itt. Ramesh, I'm glad you resurrected this probem and even
            present a
            solution.

            Anyone on the Toronto team want to check the patch out and
            commit it if it looks good?

            Tom

            Ramesh Mandava wrote:

                  Hi:
                    Xalan as it stands right now, throws the following
                  exception when tried

            to use

                  as part of secure container, such as J2EE RI.

                    ==


                  org.apache.xml.utils.WrappedRuntimeException: Could not
                  load
                               output_text.properties (check CLASSPATH),
                  now using just the
                  defaults
                                   at
                  
org.apache.xalan.templates.OutputProperties.loadPropertiesFile(OutputProp

                               erties.java:219)
                                   at
                  
org.apache.xalan.templates.OutputProperties.getDefaultMethodProperties(Ou

                               tputProperties.java:333)
                                   at
                  
org.apache.xalan.templates.OutputProperties.setMethodDefaults(OutputPrope

                               rties.java:635)
                                   at
                  
org.apache.xalan.templates.OutputProperties.setProperty(OutputProperties.

                               java:419)
                                   at
                  
org.apache.xalan.templates.OutputProperties.setQNameProperty(OutputProper

                               ties.java:652)
                                   at
                  
org.apache.xalan.processor.ProcessorOutputElem.setMethod(ProcessorOutputE

                               lem.java:155

                               ==

                      For avoiding this we need to give File read
                  permission for the jar

            file.

                     This is happening because we don't have doPrivileged
                  block in

                      "org.apache.xalan.templates.OutputProperties.java"

                     while trying to read property files. And as xalan is
                  trying to read

            internal

                  property file, forcing users to opening the permission is
                  not a good

            idea.

                     I am providing the patched file as an attachment to
                  this email. I am

            also

                  attaching "cvs diff" as "diffs".

                   Can somebody review the code and check-in the code.

                   Thanks
                   -Ramesh




            
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------



                                                 Name:
                  OutputProperties.java
                     OutputProperties.java       Type: unspecified type

            (APPLICATION/octet-stream)

                                             Encoding: BASE64
                                          Description:
                  OutputProperties.java



            
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------



                  Index: OutputProperties.java
                  ===================================================================

                  RCS file:

            
/home/cvspublic/xml-xalan/java/src/org/apache/xalan/templates/OutputProperties.java,v



                  retrieving revision 1.22
                  diff -r1.22 OutputProperties.java
                  68a69,70

                        import java.security.AccessController;
                        import java.security.PrivilegedAction;

                  192c194
                  <   static private Properties loadPropertiesFile(String
                  resourceName,

            Properties defaults)

                  ---

                          static private Properties
                        loadPropertiesFile(final String

            resourceName, Properties defaults)

                  207,211c209,228
                  <         java.lang.reflect.Method getCCL =
                  Thread.class.getMethod

            ("getContextClassLoader", NO_CLASSES);

                  <         if (getCCL != null) {
                  <           ClassLoader contextClassLoader
                  = (ClassLoader)

            getCCL.invoke(Thread.currentThread(), NO_OBJS);

                  <           is = contextClassLoader.getResourceAsStream

            ("org/apache/xalan/templates/" + resourceName);

                  <         }
                  ---

                              // Using doPrivileged to be able to read
                        property file without

            opening

                                // up secured container permissions like
                        J2EE container
                                is
                        =(InputStream)AccessController.doPrivileged( new

            PrivilegedAction() {

                                  public Object run() {
                                    try {
                                      java.lang.reflect.Method getCCL =
                        Thread.class.getMethod(
                                          "getContextClassLoader",
                        NO_CLASSES);
                                      if (getCCL != null) {
                                        ClassLoader contextClassLoader
                        = (ClassLoader)

                        getCCL.invoke(Thread.currentThread(), NO_OBJS);
                                        return (
                        contextClassLoader.getResourceAsStream (
                                            "org/apache/xalan/templates/" +
                        resourceName) );
                                      }
                                    }
                                    catch ( Exception e ) { }

                                    return null;

                                  }
                                });

                  216c233,238
                  <         is =
                  OutputProperties.class.getResourceAsStream(resourceName);
                  ---

                                is
                        = (InputStream)AccessController.doPrivileged( new

            PrivilegedAction(){

                                public Object run() {
                                    return

            OutputProperties.class.getResourceAsStream(resourceName);

                                  }
                                });


            --
             Tom Amiro -- SQE Engineer
             WTS - Interoperability and Quality
             voice: 781-442-0589 Fax: 781-442-1437
             eMail: [email protected]






Reply via email to