costin      01/03/31 13:51:49

  Modified:    src/share/org/apache/tomcat/modules/generators
                        Jdk12Interceptor.java
  Log:
  Fix for #1112. Thanks Adnan Music for the report.
  
  Revision  Changes    Path
  1.3       +17 -17    
jakarta-tomcat/src/share/org/apache/tomcat/modules/generators/Jdk12Interceptor.java
  
  Index: Jdk12Interceptor.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/generators/Jdk12Interceptor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Jdk12Interceptor.java     2001/01/25 05:07:38     1.2
  +++ Jdk12Interceptor.java     2001/03/31 21:51:48     1.3
  @@ -101,10 +101,27 @@
        */
       public int preService(Request request, Response response) {
        if( request.getContext() == null ) return 0;
  +     // fix for 1112
  +     Request child=request.getChild();
  +     if( child!=null ) {
  +         request=child;
  +     }
        fixJDKContextClassLoader(request.getContext());
        return 0;
       }
   
  +    public int postService(Request request, Response response) {
  +     Request child=request.getChild();
  +     if( child==null ) return;
  +
  +     // after include, reset the class loader
  +     // fix for 1112
  +     Request child=request.getChild();
  +     request=child.getParent();
  +     if( request != null )
  +         fixJDKContextClassLoader(request.getContext());
  +    }
  +
       static Jdk11Compat jdk11Compat=Jdk11Compat.getJdkCompat();
       
       
  @@ -126,23 +143,6 @@
            return; // nothing to do - or in include if same context
        
        jdk11Compat.setContextClassLoader(cl);
  -     // XXX if sandboxing is enabled and include() is not doing
  -     // doPriviledged, then the code that checks for cross-context
  -     // calls must also set the class loader or doPriviledged.
  -     
  -     // include() has it's own doPrivileged, no need for a second.
  -     
  -//   // this may be called from include(), in which case we
  -//   // have the codebase==jsp or servlet
  -//   java.security.AccessController.doPrivileged(new
  -//       java.security.PrivilegedAction()
  -//       {
  -//           public Object run()  {
  -//               Thread.currentThread().setContextClassLoader(cl);
  -//               return null;
  -//           }
  -//       });
  -     
       }
       
   }
  
  
  

Reply via email to