You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by mo...@apache.org on 2003/01/24 03:22:59 UTC
cvs commit: jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/test/xml TestNonexistentTags.java TestXMLParserCache.java TestXMLValidation.java
morgand 2003/01/23 18:22:59
Modified: jelly/src/java/org/apache/commons/jelly Jelly.java
Script.java
jelly/src/java/org/apache/commons/jelly/impl
ScriptBlock.java TagScript.java
jelly/src/test/org/apache/commons/jelly/core TestArgTag.java
jelly/src/test/org/apache/commons/jelly/test/xml
TestNonexistentTags.java TestXMLParserCache.java
TestXMLValidation.java
Log:
changed Exception to JellyException
Revision Changes Path
1.26 +28 -13 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/Jelly.java
Index: Jelly.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/Jelly.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- Jelly.java 24 Jan 2003 02:03:40 -0000 1.25
+++ Jelly.java 24 Jan 2003 02:22:59 -0000 1.26
@@ -76,6 +76,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.xml.sax.SAXException;
+
/**
* <p><code>Jelly</code> is a helper class which is capable of
* running a Jelly script. This class can be used from the command line
@@ -149,21 +151,34 @@
/**
* Compiles the script
*/
- public Script compileScript() throws Exception {
+ public Script compileScript() throws JellyException {
if (! loadedProperties) {
loadedProperties = true;
loadJellyProperties();
}
XMLParser parser = new XMLParser();
- parser.setContext(getJellyContext());
- parser.setDefaultNamespaceURI(this.defaultNamespaceURI);
- parser.setValidating(this.validateXML);
- Script script = parser.parse(getUrl());
- script = script.compile();
- if (log.isDebugEnabled()) {
- log.debug("Compiled script: " + getUrl());
+ try {
+ parser.setContext(getJellyContext());
+ } catch (MalformedURLException e) {
+ throw new JellyException(e.toString());
}
+
+ Script script = null;
+ try {
+ parser.setDefaultNamespaceURI(this.defaultNamespaceURI);
+ parser.setValidating(this.validateXML);
+ script = parser.parse(getUrl());
+ script = script.compile();
+ if (log.isDebugEnabled()) {
+ log.debug("Compiled script: " + getUrl());
+ }
+ } catch (IOException e) {
+ throw new JellyException("could not parse Jelly script",e);
+ } catch (SAXException e) {
+ throw new JellyException("could not parse Jelly script",e);
+ }
+
return script;
}
1.7 +6 -6 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/Script.java
Index: Script.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/Script.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Script.java 30 Oct 2002 19:16:26 -0000 1.6
+++ Script.java 24 Jan 2003 02:22:59 -0000 1.7
@@ -77,7 +77,7 @@
/** Called by the parser to allow a more efficient
* representation of the script to be used.
*/
- public Script compile() throws Exception;
+ public Script compile() throws JellyException;
/** Evaluates the body of a tag */
public void run(JellyContext context, XMLOutput output) throws Exception;
1.10 +7 -6 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/ScriptBlock.java
Index: ScriptBlock.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/ScriptBlock.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ScriptBlock.java 11 Dec 2002 12:40:55 -0000 1.9
+++ ScriptBlock.java 24 Jan 2003 02:22:59 -0000 1.10
@@ -66,6 +66,7 @@
import java.util.List;
import org.apache.commons.jelly.JellyContext;
+import org.apache.commons.jelly.JellyException;
import org.apache.commons.jelly.Script;
import org.apache.commons.jelly.XMLOutput;
@@ -106,7 +107,7 @@
// Script interface
//-------------------------------------------------------------------------
- public Script compile() throws Exception {
+ public Script compile() throws JellyException {
int size = list.size();
if (size == 1) {
Script script = (Script) list.get(0);
1.32 +6 -6 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/TagScript.java
Index: TagScript.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/TagScript.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- TagScript.java 19 Dec 2002 10:50:22 -0000 1.31
+++ TagScript.java 24 Jan 2003 02:22:59 -0000 1.32
@@ -176,7 +176,7 @@
/**
* Compiles the tags body
*/
- public Script compile() throws Exception {
+ public Script compile() throws JellyException {
if (tagBody != null) {
tagBody = tagBody.compile();
}
1.2 +5 -5 jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/core/TestArgTag.java
Index: TestArgTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/core/TestArgTag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestArgTag.java 30 Nov 2002 07:41:21 -0000 1.1
+++ TestArgTag.java 24 Jan 2003 02:22:59 -0000 1.2
@@ -265,7 +265,7 @@
}
class MockScript implements Script {
- public Script compile() throws Exception {
+ public Script compile() throws JellyException {
return this;
}
1.2 +8 -7 jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/test/xml/TestNonexistentTags.java
Index: TestNonexistentTags.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/test/xml/TestNonexistentTags.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestNonexistentTags.java 23 Jan 2003 22:25:01 -0000 1.1
+++ TestNonexistentTags.java 24 Jan 2003 02:22:59 -0000 1.2
@@ -70,6 +70,7 @@
import org.apache.commons.jelly.Jelly;
import org.apache.commons.jelly.JellyContext;
+import org.apache.commons.jelly.JellyException;
import org.apache.commons.jelly.Script;
import org.apache.commons.jelly.XMLOutput;
import org.xml.sax.SAXParseException;
@@ -118,8 +119,8 @@
setUp("nonexistentTags1.jelly");
try {
Script script = jelly.compileScript();
- fail("Scripts should throw SAXParseException when it declares a nonexistent tag.");
- } catch (SAXParseException e) {
+ fail("Scripts should throw JellyException when it declares a nonexistent tag.");
+ } catch (JellyException e) {
}
}
1.5 +8 -7 jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/test/xml/TestXMLParserCache.java
Index: TestXMLParserCache.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/test/xml/TestXMLParserCache.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TestXMLParserCache.java 11 Dec 2002 12:40:58 -0000 1.4
+++ TestXMLParserCache.java 24 Jan 2003 02:22:59 -0000 1.5
@@ -69,6 +69,7 @@
import org.apache.commons.jelly.Jelly;
import org.apache.commons.jelly.JellyContext;
+import org.apache.commons.jelly.JellyException;
import org.apache.commons.jelly.Script;
import org.apache.commons.jelly.XMLOutput;
import org.xml.sax.SAXParseException;
@@ -126,8 +127,8 @@
jelly.setValidateXML(true);
try {
script = jelly.compileScript();
- fail("Invalid scripts should throw SAXParseException on parse, despite the cache");
- } catch (SAXParseException e) {
+ fail("Invalid scripts should throw JellyException on parse, despite the cache");
+ } catch (JellyException e) {
}
}
1.5 +8 -7 jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/test/xml/TestXMLValidation.java
Index: TestXMLValidation.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/test/xml/TestXMLValidation.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TestXMLValidation.java 11 Dec 2002 12:40:58 -0000 1.4
+++ TestXMLValidation.java 24 Jan 2003 02:22:59 -0000 1.5
@@ -69,6 +69,7 @@
import org.apache.commons.jelly.Jelly;
import org.apache.commons.jelly.JellyContext;
+import org.apache.commons.jelly.JellyException;
import org.apache.commons.jelly.Script;
import org.apache.commons.jelly.XMLOutput;
import org.xml.sax.SAXParseException;
@@ -134,8 +135,8 @@
jelly.setValidateXML(true);
try {
Script script = jelly.compileScript();
- fail("Invalid scripts should throw SAXParseException on parse");
- } catch (SAXParseException e) {
+ fail("Invalid scripts should throw JellyException on parse");
+ } catch (JellyException e) {
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>