hivemind-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From k...@apache.org
Subject cvs commit: jakarta-hivemind/framework/src/test/org/apache/hivemind/parse TestXmlResourceProcessor.java
Date Thu, 28 Apr 2005 07:42:10 GMT
knut        2005/04/28 00:42:10

  Modified:    framework/src/java/org/apache/hivemind/parse
                        XmlResourceProcessor.java
               framework/src/test/org/apache/hivemind/parse
                        TestXmlResourceProcessor.java
  Log:
  report root exception with missing resource exception (fixes HIVEMIND-110)
  
  Revision  Changes    Path
  1.7       +14 -6     jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/XmlResourceProcessor.java
  
  Index: XmlResourceProcessor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/XmlResourceProcessor.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XmlResourceProcessor.java	19 Feb 2005 18:57:34 -0000	1.6
  +++ XmlResourceProcessor.java	28 Apr 2005 07:42:10 -0000	1.7
  @@ -32,9 +32,9 @@
   import org.xml.sax.SAXException;
   
   /**
  - * The XmlResourceProcessor processes XML {@link Resource resources}using the
  - * {@link DescriptorParser}which is used as a SAX ContentHandler. The result of
  - * {@link #processResource(Resource) processing a resource}is a {@link ModuleDescriptor}.
  + * The XmlResourceProcessor processes XML {@link Resource resources} using the
  + * {@link DescriptorParser} which is used as a SAX ContentHandler. The result of
  + * {@link #processResource(Resource) processing a resource} is a {@link ModuleDescriptor}.
    * 
    * @see org.apache.hivemind.parse.DescriptorParser
    * @see org.apache.hivemind.ModuleDescriptorProvider
  @@ -59,6 +59,14 @@
           _errorHandler = errorHandler;
       }
   
  +    /**
  +     * Initializes the {@link DescriptorParser parser},
  +     * {@link #processResource(Resource) processes} the Resource, resets the parser, and
finally
  +     * returns the parsed {@link ModuleDescriptor}.
  +     * 
  +     * @throws ApplicationRuntimeException
  +     *             Thrown if errors are encountered while parsing the resource.
  +     */
       public ModuleDescriptor processResource(Resource resource)
       {
           if (_contentHandler == null)
  @@ -98,8 +106,8 @@
   
       /**
        * Returns the ModuleDescriptor obtained by parsing the specified Resource using the
given
  -     * SAXParser and DescriptorParser. Called by {@link #processResource(Resource)}after
the
  -     * DescriptorParser has been
  +     * {@link SAXParser} and {@link DescriptorParser}. Called by {@link #processResource(Resource)}
  +     * after the DescriptorParser has been
        * {@link DescriptorParser#initialize(Resource, ClassResolver) initialized}. Suitable
for
        * overriding by subclasses.
        */
  @@ -124,7 +132,7 @@
           catch (Exception e)
           {
               throw new ApplicationRuntimeException(ParseMessages.missingResource(resource),
  -                    resource, null, null);
  +                    resource, null, e);
           }
       }
   
  
  
  
  1.6       +5 -0      jakarta-hivemind/framework/src/test/org/apache/hivemind/parse/TestXmlResourceProcessor.java
  
  Index: TestXmlResourceProcessor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/test/org/apache/hivemind/parse/TestXmlResourceProcessor.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestXmlResourceProcessor.java	4 Apr 2005 15:20:38 -0000	1.5
  +++ TestXmlResourceProcessor.java	28 Apr 2005 07:42:10 -0000	1.6
  @@ -17,6 +17,7 @@
   import hivemind.test.FrameworkTestCase;
   
   import java.net.URL;
  +import java.net.UnknownHostException;
   
   import org.apache.hivemind.ApplicationRuntimeException;
   import org.apache.hivemind.Resource;
  @@ -33,6 +34,8 @@
   
           Resource[] missingResources = new Resource[]
           { new FileResource("foo"), new URLResource(new URL("file://MissingFile")) };
  +        Class[] exceptionTypes = new Class[]
  +        { NullPointerException.class, UnknownHostException.class };
   
           for (int i = 0; i < missingResources.length; i++)
           {
  @@ -45,6 +48,8 @@
               catch (ApplicationRuntimeException e)
               {
                   assertEquals(ParseMessages.missingResource(missingResources[i]), e.getMessage());
  +
  +                assertEquals(exceptionTypes[i], e.getCause().getClass());
               }
           }
       }
  
  
  

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


Mime
View raw message