commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject cvs commit: jakarta-commons/jelly/src/java/org/apache/commons/jelly/parser XMLParser.java
Date Mon, 09 Jun 2003 13:25:39 GMT
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


Mime
View raw message