yoavs       2004/09/02 07:24:55

  Modified:    catalina/src/share/org/apache/catalina/startup Tag:
                        TOMCAT_5_0 DigesterFactory.java
               webapps/docs Tag: TOMCAT_5_0 changelog.xml
  Log:
  Added Log and NPE checking to DigesterFactory, addressing Bugzilla 30636.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.6.2.1   +20 -6     
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/DigesterFactory.java
  
  Index: DigesterFactory.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/DigesterFactory.java,v
  retrieving revision 1.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- DigesterFactory.java      27 May 2004 14:51:00 -0000      1.6
  +++ DigesterFactory.java      2 Sep 2004 14:24:54 -0000       1.6.2.1
  @@ -32,6 +32,11 @@
    * @author Jean-Francois Arcand
    */
   public class DigesterFactory {
  +    /**
  +     * Log for logging ;)
  +     */
  +    private static org.apache.commons.logging.Log = 
  +        org.apache.commons.logging.LogFactory.getLog(DigesterFactory.class);
   
       /**
        * The XML entiry resolver used by the Digester.
  @@ -50,7 +55,7 @@
       
       /**
        * Create a <code>Digester</code> parser with XML validation turned off.
  -    * @param rule an instance of <code>Rule</code↔ used for parsing the xml.
  +     * @param rule an instance of <code>RuleSet</code> used for parsing the xml.
        */
       public static Digester newDigester(RuleSet rule){
           return newDigester(false,false,rule);
  @@ -61,7 +66,7 @@
        * Create a <code>Digester</code> parser.
        * @param xmlValidation turn on/off xml validation
        * @param xmlNamespaceAware turn on/off namespace validation
  -     * @param rule an instance of <code>Rule</code↔ used for parsing the xml.
  +     * @param rule an instance of <code>RuleSet</code> used for parsing the xml.
        */
       public static Digester newDigester(boolean xmlValidation,
                                          boolean xmlNamespaceAware,
  @@ -92,8 +97,9 @@
           registerLocalSchema();
           
           digester.setEntityResolver(schemaResolver);
  -        if ( rule != null )
  +        if ( rule != null ) {
               digester.addRuleSet(rule);
  +        }
   
           return (digester);
       }
  @@ -169,10 +175,13 @@
        * Load the resource and add it to the 
        */
       protected static void register(String resourceURL, String resourcePublicId){
  -
           URL url = DigesterFactory.class.getResource(resourceURL);
  -        schemaResolver.register(resourcePublicId , url.toString() );
   
  +        if(url == null) {
  +            log.warn("Could not get url for " + resourceURL);
  +        } else {
  +            schemaResolver.register(resourcePublicId , url.toString() );
  +        }
       }
   
   
  @@ -182,7 +191,12 @@
       protected static void turnOnValidation(Digester digester){
           URL url = DigesterFactory.class
                           .getResource(Constants.WebSchemaResourcePath_24);
  -        digester.setSchema(url.toString());     
  +
  +        if(url == null) {
  +            log.error("Could not get url for " + 
Constants.WebSchemaResourcePath_24);
  +        } else {
  +            digester.setSchema(url.toString());     
  +        }
       }
   
   
  
  
  
  No                   revision
  No                   revision
  1.70.2.25 +3 -0      jakarta-tomcat-catalina/webapps/docs/changelog.xml
  
  Index: changelog.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/docs/changelog.xml,v
  retrieving revision 1.70.2.24
  retrieving revision 1.70.2.25
  diff -u -r1.70.2.24 -r1.70.2.25
  --- changelog.xml     2 Sep 2004 01:10:56 -0000       1.70.2.24
  +++ changelog.xml     2 Sep 2004 14:24:54 -0000       1.70.2.25
  @@ -54,6 +54,9 @@
         <fix>
           <bug>31001</bug>: Missing domain attribute in MBean description for 
createStandardService. (yoavs)
         </fix>
  +      <fix>
  +        <bug>30636</bug>: NPE in DigesterFactory when resources cannot be located. 
(yoavs)
  +      </fix>
       </changelog>
     </subsection>
     <subsection name="Webapps">
  
  
  

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

Reply via email to