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/java/org/apache/hivemind/parse XmlResourceProcessor.java
Date Sat, 19 Feb 2005 18:57:34 GMT
knut        2005/02/19 10:57:34

  Modified:    framework/src/java/org/apache/hivemind/parse
                        XmlResourceProcessor.java
  Log:
  fix for HIVEMIND-81 (Null pointer exception when module resource does not exist)
  
  Revision  Changes    Path
  1.6       +16 -7     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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XmlResourceProcessor.java	5 Jan 2005 18:05:37 -0000	1.5
  +++ XmlResourceProcessor.java	19 Feb 2005 18:57:34 -0000	1.6
  @@ -106,19 +106,28 @@
       protected ModuleDescriptor parseResource(Resource resource, SAXParser parser,
               DescriptorParser contentHandler) throws SAXException, IOException
       {
  -        URL url = resource.getResourceURL();
  -
  -        if (url == null)
  -            throw new ApplicationRuntimeException(ParseMessages.missingResource(resource),
  -                    resource, null, null);
  -
  -        InputSource source = new InputSource(url.openStream());
  +        InputSource source = getInputSource(resource);
   
           parser.parse(source, contentHandler);
   
           return contentHandler.getModuleDescriptor();
       }
   
  +    private InputSource getInputSource(Resource resource)
  +    {
  +        try
  +        {
  +            URL url = resource.getResourceURL();
  +
  +            return new InputSource(url.openStream());
  +        }
  +        catch (Exception e)
  +        {
  +            throw new ApplicationRuntimeException(ParseMessages.missingResource(resource),
  +                    resource, null, null);
  +        }
  +    }
  +
       private SAXParser getSAXParser() throws ParserConfigurationException, SAXException,
               FactoryConfigurationError
       {
  
  
  

---------------------------------------------------------------------
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