costin      01/03/08 10:42:50

  Modified:    src/share/org/apache/tomcat/core Request.java
               src/share/org/apache/tomcat/modules/config
                        ProfileLoader.java
  Log:
  Few more checks for invalid requests, removing JDK1.2 code that isn't needed.
  
  Revision  Changes    Path
  1.98      +32 -23    jakarta-tomcat/src/share/org/apache/tomcat/core/Request.java
  
  Index: Request.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Request.java,v
  retrieving revision 1.97
  retrieving revision 1.98
  diff -u -r1.97 -r1.98
  --- Request.java      2001/03/08 14:31:34     1.97
  +++ Request.java      2001/03/08 18:42:32     1.98
  @@ -249,10 +249,10 @@
       public void setContextManager( ContextManager cm ) {
        contextM=cm;
        try {
  -         encodingInfo=cm.getNoteId( ContextManager.REQUEST_NOTE,
  -                                    "req.encoding" );
  -         attributeInfo=cm.getNoteId( ContextManager.REQUEST_NOTE,
  -                                     "req.attribute" );
  +         encodingInfo=cm.getNoteId(ContextManager.REQUEST_NOTE,
  +                                   "req.encoding" );
  +         attributeInfo=cm.getNoteId(ContextManager.REQUEST_NOTE,
  +                                    "req.attribute");
        } catch( TomcatException ex ) {
            ex.printStackTrace();
        }
  @@ -394,17 +394,20 @@
   
        Object result=null;
        Context ctx=getContext();
  -     BaseInterceptor reqI[]= ctx.getContainer().
  -         getInterceptors(Container.H_getInfo);
  -     for( int i=0; i< reqI.length; i++ ) {
  -         result=reqI[i].getInfo( ctx, this, encodingInfo, null );
  -         if ( result != null ) {
  -             break;
  +     if( ctx!=null ) {
  +         
  +         BaseInterceptor reqI[]= ctx.getContainer().
  +             getInterceptors(Container.H_getInfo);
  +         for( int i=0; i< reqI.length; i++ ) {
  +             result=reqI[i].getInfo( ctx, this, encodingInfo, null );
  +             if ( result != null ) {
  +                 break;
  +             }
            }
  -     }
  -     if( result != null ) {
  -         charEncoding=(String)result;
  -         return charEncoding;
  +         if( result != null ) {
  +             charEncoding=(String)result;
  +             return charEncoding;
  +         }
        }
        
           charEncoding = ContentType.getCharsetFromContentType(getContentType());
  @@ -669,6 +672,9 @@
   
        Object result=null;
        Context ctx=getContext();
  +     if( ctx== null )
  +         return null;
  +     
        BaseInterceptor reqI[]= ctx.getContainer().
            getInterceptors(Container.H_getInfo);
        for( int i=0; i< reqI.length; i++ ) {
  @@ -680,7 +686,7 @@
        if( result != null ) {
            return result;
        }
  -
  +    
        // allow access to FacadeManager for servlets
        // XXX move to module. Don't add any new special case, the hooks should
        // be used
  @@ -695,16 +701,19 @@
       public void setAttribute(String name, Object value) {
        int status=BaseInterceptor.DECLINED;
        Context ctx=getContext();
  -     BaseInterceptor reqI[]= ctx.getContainer().
  -         getInterceptors(Container.H_setInfo);
  -     for( int i=0; i< reqI.length; i++ ) {
  -         status=reqI[i].setInfo( ctx, this, attributeInfo, name, value );
  +     if( ctx!=null ) {
  +         BaseInterceptor reqI[]= ctx.getContainer().
  +             getInterceptors(Container.H_setInfo);
  +         for( int i=0; i< reqI.length; i++ ) {
  +             status=reqI[i].setInfo( ctx, this, attributeInfo,
  +                                     name, value );
  +             if ( status != BaseInterceptor.DECLINED ) {
  +                 break;
  +             }
  +         }
            if ( status != BaseInterceptor.DECLINED ) {
  -             break;
  +             return; // don't set it, the module will manage it
            }
  -     }
  -     if ( status != BaseInterceptor.DECLINED ) {
  -         return; // don't set it, the module will manage it
        }
   
        if(name!=null && value!=null)
  
  
  
  1.3       +0 -9      
jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ProfileLoader.java
  
  Index: ProfileLoader.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ProfileLoader.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ProfileLoader.java        2001/03/08 00:59:41     1.2
  +++ ProfileLoader.java        2001/03/08 18:42:43     1.3
  @@ -241,20 +241,11 @@
            Profile profile=(Profile)ctx.currentObject();
            Class c=null;
            ClassLoader cl=profile.containerLoader;     
  -         System.out.println( "CCL1 " + cl );    
  -//       try {
  -//           c=Class.forName( className );
  -//       } catch( ClassNotFoundException ex ) {
  -//           if( cl!=null )
            try {
                        c=cl.loadClass( className );
            } catch( ClassNotFoundException ex2 ) {
  -             System.out.println( "CCL2 " + profile.commonLoader );
  -             System.out.println(((java.net.URLClassLoader)cl).getParent());
                c=profile.commonLoader.loadClass(className);
            }
  -//           else throw ex;
  -//       }
   
            Object o=c.newInstance();
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to