bruno 2003/11/26 11:08:30
Modified: src/java/org/apache/cocoon/components/xpointer
PointerPart.java ShorthandPart.java
XPointerContext.java XPointerPart.java
Log:
proper handling of ResourceNotFoundException
Revision Changes Path
1.2 +2 -1
cocoon-2.1/src/java/org/apache/cocoon/components/xpointer/PointerPart.java
Index: PointerPart.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/xpointer/PointerPart.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PointerPart.java 20 May 2003 11:57:13 -0000 1.1
+++ PointerPart.java 26 Nov 2003 19:08:30 -0000 1.2
@@ -51,6 +51,7 @@
package org.apache.cocoon.components.xpointer;
import org.xml.sax.SAXException;
+import org.apache.cocoon.ResourceNotFoundException;
/**
* Interface to be implemented by pointer parts (xpointer schemes).
@@ -61,5 +62,5 @@
* stream them to the XMLConsumer available from the XPointerContext and
return true.
* Otherwise this method should return false.
*/
- public boolean process(XPointerContext xpointerContext) throws
SAXException;
+ public boolean process(XPointerContext xpointerContext) throws
SAXException, ResourceNotFoundException;
}
1.2 +2 -1
cocoon-2.1/src/java/org/apache/cocoon/components/xpointer/ShorthandPart.java
Index: ShorthandPart.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/xpointer/ShorthandPart.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ShorthandPart.java 20 May 2003 11:57:13 -0000 1.1
+++ ShorthandPart.java 26 Nov 2003 19:08:30 -0000 1.2
@@ -51,6 +51,7 @@
package org.apache.cocoon.components.xpointer;
import org.apache.cocoon.xml.dom.DOMStreamer;
+import org.apache.cocoon.ResourceNotFoundException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
@@ -69,7 +70,7 @@
this.shorthand = shorthand;
}
- public boolean process(XPointerContext xpointerContext) throws
SAXException {
+ public boolean process(XPointerContext xpointerContext) throws
SAXException, ResourceNotFoundException {
Document document = xpointerContext.getDocument();
Element element = document.getElementById(shorthand);
if (element != null) {
1.2 +4 -1
cocoon-2.1/src/java/org/apache/cocoon/components/xpointer/XPointerContext.java
Index: XPointerContext.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/xpointer/XPointerContext.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XPointerContext.java 20 May 2003 11:57:13 -0000 1.1
+++ XPointerContext.java 26 Nov 2003 19:08:30 -0000 1.2
@@ -57,6 +57,7 @@
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.cocoon.components.source.SourceUtil;
import org.apache.cocoon.xml.XMLConsumer;
+import org.apache.cocoon.ResourceNotFoundException;
import org.xml.sax.SAXException;
import java.util.HashMap;
@@ -90,10 +91,12 @@
prefixes.put("xml", "http://www.w3.org/XML/1998/namespace");
}
- public Document getDocument() throws SAXException {
+ public Document getDocument() throws SAXException,
ResourceNotFoundException {
if (document == null) {
try {
document = SourceUtil.toDOM(source);
+ } catch (ResourceNotFoundException e) {
+ throw e;
} catch (Exception e) {
throw new SAXException("Error during XPointer evaluation
while trying to load " + source.getURI(), e);
}
1.3 +2 -1
cocoon-2.1/src/java/org/apache/cocoon/components/xpointer/XPointerPart.java
Index: XPointerPart.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/xpointer/XPointerPart.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XPointerPart.java 23 May 2003 07:29:58 -0000 1.2
+++ XPointerPart.java 26 Nov 2003 19:08:30 -0000 1.3
@@ -54,6 +54,7 @@
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.cocoon.xml.XMLConsumer;
import org.apache.cocoon.xml.dom.DOMStreamer;
+import org.apache.cocoon.ResourceNotFoundException;
import org.apache.excalibur.xml.xpath.XPathProcessor;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
@@ -70,7 +71,7 @@
this.expression = expression;
}
- public boolean process(XPointerContext xpointerContext) throws
SAXException {
+ public boolean process(XPointerContext xpointerContext) throws
SAXException, ResourceNotFoundException {
Document document = xpointerContext.getDocument();
ComponentManager manager = xpointerContext.getComponentManager();
XPathProcessor xpathProcessor = null;