You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by js...@apache.org on 2003/06/09 15:25:39 UTC
cvs commit: jakarta-commons/jelly/src/java/org/apache/commons/jelly/parser XMLParser.java
jstrachan 2003/06/09 06:25:39
Modified: jelly/src/java/org/apache/commons/jelly/parser
XMLParser.java
Log:
Patch so that the exception will carry the current URI of the Jelly script being parsed when invoked from inside Maven.
Revision Changes Path
1.46 +16 -7 jakarta-commons/jelly/src/java/org/apache/commons/jelly/parser/XMLParser.java
Index: XMLParser.java
===================================================================
RCS file: /home/cvs/jakarta-commons/jelly/src/java/org/apache/commons/jelly/parser/XMLParser.java,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- XMLParser.java 24 Jan 2003 10:04:33 -0000 1.45
+++ XMLParser.java 9 Jun 2003 13:25:39 -0000 1.46
@@ -316,7 +316,7 @@
*/
public Script parse(InputStream input) throws IOException, SAXException {
ensureConfigured();
- this.fileName = null;
+ this.fileName = getCurrentURI();
getXMLReader().parse(new InputSource(input));
return script;
}
@@ -337,7 +337,7 @@
*/
public Script parse(Reader reader) throws IOException, SAXException {
ensureConfigured();
- this.fileName = null;
+ this.fileName = getCurrentURI();
getXMLReader().parse(new InputSource(reader));
return script;
}
@@ -1202,6 +1202,15 @@
protected ExpressionFactory createExpressionFactory() {
return new JexlExpressionFactory();
+ }
+
+ /**
+ * @return the current context URI as a String or null if there is no
+ * current context defined on the JellyContext
+ */
+ protected String getCurrentURI() {
+ URL url = this.getContext().getCurrentURL();
+ return (url != null) ? url.toString() : null;
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org