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 [EMAIL PROTECTED] Resource
resources}using the
- * [EMAIL PROTECTED] DescriptorParser}which is used as a SAX ContentHandler.
The result of
- * [EMAIL PROTECTED] #processResource(Resource) processing a resource}is a
[EMAIL PROTECTED] ModuleDescriptor}.
+ * The XmlResourceProcessor processes XML [EMAIL PROTECTED] Resource
resources} using the
+ * [EMAIL PROTECTED] DescriptorParser} which is used as a SAX
ContentHandler. The result of
+ * [EMAIL PROTECTED] #processResource(Resource) processing a resource} is a
[EMAIL PROTECTED] ModuleDescriptor}.
*
* @see org.apache.hivemind.parse.DescriptorParser
* @see org.apache.hivemind.ModuleDescriptorProvider
@@ -59,6 +59,14 @@
_errorHandler = errorHandler;
}
+ /**
+ * Initializes the [EMAIL PROTECTED] DescriptorParser parser},
+ * [EMAIL PROTECTED] #processResource(Resource) processes} the Resource,
resets the parser, and finally
+ * returns the parsed [EMAIL PROTECTED] 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 [EMAIL PROTECTED]
#processResource(Resource)}after the
- * DescriptorParser has been
+ * [EMAIL PROTECTED] SAXParser} and [EMAIL PROTECTED] DescriptorParser}.
Called by [EMAIL PROTECTED] #processResource(Resource)}
+ * after the DescriptorParser has been
* [EMAIL PROTECTED] 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]