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 06:26:14 UTC
cvs commit: jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/core TestArgTag.java
morgand 2003/01/23 21:26:14
Modified: jelly/jelly-tags/ant/src/java/org/apache/commons/jelly/tags/ant
AntTagLibrary.java
jelly/jelly-tags/bean/src/java/org/apache/commons/jelly/tags/bean
BeanTagLibrary.java
jelly/jelly-tags/bean/src/test/org/apache/commons/jelly/tags/bean
MyTagLibrary.java
jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing
ConstraintTag.java SwingTagLibrary.java
jelly/jelly-tags/swt/src/java/org/apache/commons/jelly/tags/swt
SwtTagLibrary.java
jelly/src/java/org/apache/commons/jelly Script.java
TagLibrary.java
jelly/src/java/org/apache/commons/jelly/impl
DefaultTagFactory.java DynamicTagLibrary.java
ExpressionScript.java ScriptBlock.java
StaticTagScript.java TagFactory.java TagScript.java
TextScript.java
jelly/src/test/org/apache/commons/jelly/core TestArgTag.java
Log:
converting Exceptions to JellyExceptions
Revision Changes Path
1.26 +5 -4 jakarta-commons-sandbox/jelly/jelly-tags/ant/src/java/org/apache/commons/jelly/tags/ant/AntTagLibrary.java
Index: AntTagLibrary.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/ant/src/java/org/apache/commons/jelly/tags/ant/AntTagLibrary.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- AntTagLibrary.java 30 Oct 2002 19:16:31 -0000 1.25
+++ AntTagLibrary.java 24 Jan 2003 05:26:12 -0000 1.26
@@ -65,6 +65,7 @@
import org.apache.commons.beanutils.Converter;
import org.apache.commons.grant.GrantProject;
import org.apache.commons.jelly.JellyContext;
+import org.apache.commons.jelly.JellyException;
import org.apache.commons.jelly.Tag;
import org.apache.commons.jelly.TagLibrary;
import org.apache.commons.jelly.impl.TagFactory;
@@ -190,7 +191,7 @@
if ( answer == null ) {
answer = new TagScript(
new TagFactory() {
- public Tag createTag(String name, Attributes attributes) throws Exception {
+ public Tag createTag(String name, Attributes attributes) throws JellyException {
return AntTagLibrary.this.createTag(name, attributes);
}
}
@@ -207,7 +208,7 @@
if ( name.equals("fileScanner") ) {
return new TagScript(
new TagFactory() {
- public Tag createTag(String name, Attributes attributes) throws Exception {
+ public Tag createTag(String name, Attributes attributes) throws JellyException {
return new FileScannerTag(new FileScanner());
}
}
@@ -216,7 +217,7 @@
if ( name.equals("setProperty") ) {
return new TagScript(
new TagFactory() {
- public Tag createTag(String name, Attributes attributes) throws Exception {
+ public Tag createTag(String name, Attributes attributes) throws JellyException {
return new SetPropertyTag();
}
}
@@ -228,7 +229,7 @@
/**
* A helper method which creates an AntTag instance for the given element name
*/
- public Tag createTag(String name, Attributes attributes) throws Exception {
+ public Tag createTag(String name, Attributes attributes) throws JellyException {
AntTag tag = new AntTag( name );
if ( name.equals( "echo" ) ) {
tag.setTrim(false);
1.2 +9 -8 jakarta-commons-sandbox/jelly/jelly-tags/bean/src/java/org/apache/commons/jelly/tags/bean/BeanTagLibrary.java
Index: BeanTagLibrary.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/bean/src/java/org/apache/commons/jelly/tags/bean/BeanTagLibrary.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BeanTagLibrary.java 14 Jan 2003 04:01:00 -0000 1.1
+++ BeanTagLibrary.java 24 Jan 2003 05:26:13 -0000 1.2
@@ -64,6 +64,7 @@
import java.util.Hashtable;
import java.util.Map;
+import org.apache.commons.jelly.JellyException;
import org.apache.commons.jelly.Tag;
import org.apache.commons.jelly.TagLibrary;
import org.apache.commons.jelly.impl.TagFactory;
@@ -85,7 +86,7 @@
registerTagFactory(
"beandef",
new TagFactory() {
- public Tag createTag(String name, Attributes attributes) throws Exception {
+ public Tag createTag(String name, Attributes attributes) throws JellyException {
return new BeandefTag(BeanTagLibrary.this);
}
}
@@ -124,13 +125,13 @@
protected TagFactory createTagFactory(String name, Attributes attributes) throws Exception {
return new TagFactory() {
- public Tag createTag(String name, Attributes attributes) throws Exception {
+ public Tag createTag(String name, Attributes attributes) throws JellyException {
return createBeanTag(name, attributes);
}
};
}
- protected Tag createBeanTag(String name, Attributes attributes) throws Exception {
+ protected Tag createBeanTag(String name, Attributes attributes) throws JellyException {
// is the name bound to a specific class
Class beanType = getBeanType(name, attributes);
if (beanType != null) {
1.3 +8 -7 jakarta-commons-sandbox/jelly/jelly-tags/bean/src/test/org/apache/commons/jelly/tags/bean/MyTagLibrary.java
Index: MyTagLibrary.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/bean/src/test/org/apache/commons/jelly/tags/bean/MyTagLibrary.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MyTagLibrary.java 21 Jan 2003 15:16:32 -0000 1.2
+++ MyTagLibrary.java 24 Jan 2003 05:26:13 -0000 1.3
@@ -61,6 +61,7 @@
*/
package org.apache.commons.jelly.tags.bean;
+import org.apache.commons.jelly.JellyException;
import org.apache.commons.jelly.Tag;
import org.apache.commons.jelly.TagLibrary;
import org.apache.commons.jelly.impl.TagFactory;
@@ -87,7 +88,7 @@
public TagScript createTagScript(String name, Attributes attributes) throws Exception {
TagFactory factory = new TagFactory() {
- public Tag createTag(String name, Attributes attributes) throws Exception {
+ public Tag createTag(String name, Attributes attributes) throws JellyException {
return createBeanTag(name, attributes);
}
};
@@ -102,7 +103,7 @@
* tag matches a root bean, then a BeanTag will be created, otherwise a
* BeanPropertyTag is created to make a nested property.
*/
- protected Tag createBeanTag(String name, Attributes attributes) throws Exception {
+ protected Tag createBeanTag(String name, Attributes attributes) throws JellyException {
// is the name bound to a specific class
Class beanType = getBeanType(name, attributes);
if (beanType != null) {
1.7 +1 -1 jakarta-commons-sandbox/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/ConstraintTag.java
Index: ConstraintTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/ConstraintTag.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ConstraintTag.java 24 Jan 2003 04:17:46 -0000 1.6
+++ ConstraintTag.java 24 Jan 2003 05:26:13 -0000 1.7
@@ -46,7 +46,7 @@
public ConstantFactory(Object c) { this.constant = c;}
private Object constant;
public Object newInstance() { return constant; }
- public Tag createTag(String name, Attributes attributes) throws Exception {
+ public Tag createTag(String name, Attributes attributes) throws JellyException {
return new ConstraintTag ( this );
}
} // class ConstatnStringFactory
1.18 +2 -1 jakarta-commons-sandbox/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/SwingTagLibrary.java
Index: SwingTagLibrary.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/SwingTagLibrary.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- SwingTagLibrary.java 3 Jan 2003 21:22:36 -0000 1.17
+++ SwingTagLibrary.java 24 Jan 2003 05:26:13 -0000 1.18
@@ -70,6 +70,7 @@
import org.apache.commons.beanutils.ConvertUtils;
+import org.apache.commons.jelly.JellyException;
import org.apache.commons.jelly.Tag;
import org.apache.commons.jelly.TagLibrary;
import org.apache.commons.jelly.impl.TagScript;
@@ -150,7 +151,7 @@
if ( factory != null ) {
return new TagScript(
new TagFactory() {
- public Tag createTag(String name, Attributes attributes) throws Exception {
+ public Tag createTag(String name, Attributes attributes) throws JellyException {
if ( factory instanceof TagFactory ) {
return ((TagFactory) factory).createTag(name, attributes);
}
1.2 +4 -3 jakarta-commons-sandbox/jelly/jelly-tags/swt/src/java/org/apache/commons/jelly/tags/swt/SwtTagLibrary.java
Index: SwtTagLibrary.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/swt/src/java/org/apache/commons/jelly/tags/swt/SwtTagLibrary.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SwtTagLibrary.java 6 Jan 2003 16:40:34 -0000 1.1
+++ SwtTagLibrary.java 24 Jan 2003 05:26:13 -0000 1.2
@@ -69,6 +69,7 @@
import org.eclipse.swt.custom.*;
import org.eclipse.swt.widgets.*;
+import org.apache.commons.jelly.JellyException;
import org.apache.commons.jelly.Tag;
import org.apache.commons.jelly.TagLibrary;
import org.apache.commons.jelly.impl.TagFactory;
@@ -160,7 +161,7 @@
* @see org.apache.commons.jelly.impl.TagFactory#createTag(java.lang.String, org.xml.sax.Attributes)
*/
public Tag createTag(String name, Attributes attributes)
- throws Exception {
+ throws JellyException {
return new LayoutTag(layoutClass);
}
}
@@ -178,7 +179,7 @@
* @see org.apache.commons.jelly.impl.TagFactory#createTag(java.lang.String, org.xml.sax.Attributes)
*/
public Tag createTag(String name, Attributes attributes)
- throws Exception {
+ throws JellyException {
return new LayoutDataTag(layoutDataClass);
}
}
@@ -196,7 +197,7 @@
* @see org.apache.commons.jelly.impl.TagFactory#createTag(java.lang.String, org.xml.sax.Attributes)
*/
public Tag createTag(String name, Attributes attributes)
- throws Exception {
+ throws JellyException {
return new WidgetTag(widgetClass);
}
}
1.8 +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.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Script.java 24 Jan 2003 02:22:59 -0000 1.7
+++ Script.java 24 Jan 2003 05:26:13 -0000 1.8
@@ -80,6 +80,6 @@
public Script compile() throws JellyException;
/** Evaluates the body of a tag */
- public void run(JellyContext context, XMLOutput output) throws Exception;
+ public void run(JellyContext context, XMLOutput output) throws JellyException;
}
1.20 +13 -7 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/TagLibrary.java
Index: TagLibrary.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/TagLibrary.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- TagLibrary.java 18 Jan 2003 05:21:08 -0000 1.19
+++ TagLibrary.java 24 Jan 2003 05:26:13 -0000 1.20
@@ -130,12 +130,18 @@
/** Creates a new Tag for the given tag name and attributes */
public Tag createTag(String name, Attributes attributes)
- throws Exception {
+ throws JellyException {
Object value = tags.get(name);
if (value instanceof Class) {
Class type = (Class) value;
- return (Tag) type.newInstance();
+ try {
+ return (Tag) type.newInstance();
+ } catch (InstantiationException e) {
+ throw new JellyException(e.toString());
+ } catch (IllegalAccessException e) {
+ throw new JellyException(e.toString());
+ }
}
else if (value instanceof TagFactory) {
TagFactory factory = (TagFactory) value;
1.4 +9 -2 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/DefaultTagFactory.java
Index: DefaultTagFactory.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/DefaultTagFactory.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DefaultTagFactory.java 30 Oct 2002 19:16:24 -0000 1.3
+++ DefaultTagFactory.java 24 Jan 2003 05:26:13 -0000 1.4
@@ -61,6 +61,7 @@
*/
package org.apache.commons.jelly.impl;
+import org.apache.commons.jelly.JellyException;
import org.apache.commons.jelly.Tag;
import org.xml.sax.Attributes;
@@ -85,8 +86,14 @@
// TagFactory interface
//-------------------------------------------------------------------------
- public Tag createTag(String name, Attributes attributes) throws Exception {
- return (Tag) tagClass.newInstance();
+ public Tag createTag(String name, Attributes attributes) throws JellyException {
+ try {
+ return (Tag) tagClass.newInstance();
+ } catch (InstantiationException e) {
+ throw new JellyException(e.toString());
+ } catch (IllegalAccessException e) {
+ throw new JellyException(e.toString());
+ }
}
1.10 +3 -2 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/DynamicTagLibrary.java
Index: DynamicTagLibrary.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/DynamicTagLibrary.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- DynamicTagLibrary.java 11 Dec 2002 12:40:55 -0000 1.9
+++ DynamicTagLibrary.java 24 Jan 2003 05:26:13 -0000 1.10
@@ -64,6 +64,7 @@
import java.util.HashMap;
import java.util.Map;
+import org.apache.commons.jelly.JellyException;
import org.apache.commons.jelly.Script;
import org.apache.commons.jelly.Tag;
import org.apache.commons.jelly.TagLibrary;
@@ -95,7 +96,7 @@
return new TagScript(
new TagFactory() {
- public Tag createTag(String name, Attributes attributes) throws Exception {
+ public Tag createTag(String name, Attributes attributes) throws JellyException {
return DynamicTagLibrary.this.createTag(name, attributes);
}
}
@@ -104,7 +105,7 @@
/** Creates a new Tag for the given tag name if it exists */
public Tag createTag(String name, Attributes attributes)
- throws Exception {
+ throws JellyException {
Object value = templates.get(name);
if ( value instanceof Script ) {
1.3 +11 -2 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/ExpressionScript.java
Index: ExpressionScript.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/ExpressionScript.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ExpressionScript.java 30 Oct 2002 19:16:23 -0000 1.2
+++ ExpressionScript.java 24 Jan 2003 05:26:13 -0000 1.3
@@ -62,10 +62,13 @@
package org.apache.commons.jelly.impl;
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.apache.commons.jelly.expression.Expression;
+import org.xml.sax.SAXException;
+
/**
* <p><code>ExpressionScript</code> outputs the value of an expression as text.</p>
*
@@ -105,10 +108,16 @@
}
/** Evaluates the body of a tag */
- public void run(JellyContext context, XMLOutput output) throws Exception {
+ public void run(JellyContext context, XMLOutput output) throws JellyException {
String text = expression.evaluateAsString(context);
if ( text != null ) {
- output.write(text);
+
+ try {
+ output.write(text);
+ } catch (SAXException e) {
+ throw new JellyException("Could not write to XMLOutput",e);
+ }
+
}
}
}
1.11 +6 -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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- ScriptBlock.java 24 Jan 2003 02:22:59 -0000 1.10
+++ ScriptBlock.java 24 Jan 2003 05:26:13 -0000 1.11
@@ -122,7 +122,7 @@
}
/** Evaluates the body of a tag */
- public void run(JellyContext context, XMLOutput output) throws Exception {
+ public void run(JellyContext context, XMLOutput output) throws JellyException {
/*
for (int i = 0, size = scripts.length; i < size; i++) {
Script script = scripts[i];
1.13 +14 -4 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/StaticTagScript.java
Index: StaticTagScript.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/StaticTagScript.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- StaticTagScript.java 11 Dec 2002 12:40:55 -0000 1.12
+++ StaticTagScript.java 24 Jan 2003 05:26:13 -0000 1.13
@@ -74,6 +74,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.xml.sax.SAXException;
+
/**
* <p><code>StaticTagScript</code> is a script that evaluates a StaticTag, a piece of static XML
* though its attributes or element content may contain dynamic expressions.
@@ -98,9 +100,13 @@
// Script interface
//-------------------------------------------------------------------------
- public void run(JellyContext context, XMLOutput output) throws Exception {
+ public void run(JellyContext context, XMLOutput output) throws JellyException {
- startNamespacePrefixes(output);
+ try {
+ startNamespacePrefixes(output);
+ } catch (SAXException e) {
+ throw new JellyException("could not start namespace prefixes",e);
+ }
Tag tag = getTag();
@@ -138,14 +144,18 @@
handleException(e);
}
- endNamespacePrefixes(output);
+ try {
+ endNamespacePrefixes(output);
+ } catch (SAXException e) {
+ throw new JellyException("could not end namespace prefixes",e);
+ }
}
/**
* Attempts to find a dynamically created tag that has been created since this
* script was compiled
*/
- protected Tag findDynamicTag(JellyContext context, StaticTag tag) throws Exception {
+ protected Tag findDynamicTag(JellyContext context, StaticTag tag) throws JellyException {
// lets see if there's a tag library for this URI...
TagLibrary taglib = context.getTagLibrary( tag.getUri() );
if ( taglib instanceof DynamicTagLibrary ) {
1.4 +2 -1 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/TagFactory.java
Index: TagFactory.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/TagFactory.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TagFactory.java 30 Oct 2002 19:16:24 -0000 1.3
+++ TagFactory.java 24 Jan 2003 05:26:13 -0000 1.4
@@ -61,6 +61,7 @@
*/
package org.apache.commons.jelly.impl;
+import org.apache.commons.jelly.JellyException;
import org.apache.commons.jelly.Tag;
import org.xml.sax.Attributes;
@@ -79,5 +80,5 @@
/**
* Creates a Tag for the given local name and the SAX attributes
*/
- public Tag createTag(String name, Attributes attributes) throws Exception;
+ public Tag createTag(String name, Attributes attributes) throws JellyException;
}
1.33 +21 -14 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.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- TagScript.java 24 Jan 2003 02:22:59 -0000 1.32
+++ TagScript.java 24 Jan 2003 05:26:13 -0000 1.33
@@ -219,7 +219,7 @@
//-------------------------------------------------------------------------
/** Evaluates the body of a tag */
- public void run(JellyContext context, XMLOutput output) throws Exception {
+ public void run(JellyContext context, XMLOutput output) throws JellyException {
if ( ! context.isCacheTags() ) {
clearTag();
}
@@ -282,10 +282,15 @@
}
catch (Exception e) {
handleException(e);
- }
- catch (Error e) {
+ } catch (Error e) {
+ /*
+ * Not sure if we should be converting errors to exceptions,
+ * but not trivial to remove because JUnit tags throw
+ * Errors in the normal course of operation. Hmm...
+ */
handleException(e);
}
+
}
@@ -295,7 +300,7 @@
/**
* @return the tag to be evaluated, creating it lazily if required.
*/
- public Tag getTag() throws Exception {
+ public Tag getTag() throws JellyException {
Tag tag = (Tag) tagHolder.get();
if ( tag == null ) {
tag = createTag();
@@ -481,7 +486,7 @@
* Factory method to create a new Tag instance.
* The default implementation is to delegate to the TagFactory
*/
- protected Tag createTag() throws Exception {
+ protected Tag createTag() throws JellyException {
if ( tagFactory != null) {
return tagFactory.createTag(localName, getSaxAttributes());
}
@@ -492,7 +497,7 @@
/**
* Compiles a newly created tag if required, sets its parent and body.
*/
- protected void configureTag(Tag tag) throws Exception {
+ protected void configureTag(Tag tag) throws JellyException {
if (tag instanceof CompilableTag) {
((CompilableTag) tag).compile();
}
@@ -606,7 +611,7 @@
* This method adorns the JellyException with location information
* such as adding line number information etc.
*/
- protected void handleException(JellyException e) throws Exception {
+ protected void handleException(JellyException e) throws JellyException {
if (log.isTraceEnabled()) {
log.trace( "Caught exception: " + e, e );
}
@@ -634,7 +639,7 @@
* This method will rethrow the exception, wrapped in a JellyException
* while adding line number information etc.
*/
- protected void handleException(Exception e) throws Exception {
+ protected void handleException(Exception e) throws JellyException {
if (log.isTraceEnabled()) {
log.trace( "Caught exception: " + e, e );
}
@@ -645,7 +650,7 @@
if ( e instanceof JellyException ) {
e.fillInStackTrace();
- throw e;
+ throw (JellyException) e;
}
if ( e instanceof InvocationTargetException) {
@@ -663,6 +668,8 @@
* A helper method to handle this non-Jelly exception.
* This method will rethrow the exception, wrapped in a JellyException
* while adding line number information etc.
+ *
+ * Is this method wise?
*/
protected void handleException(Error e) throws Error, JellyException {
if (log.isTraceEnabled()) {
1.12 +14 -7 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/TextScript.java
Index: TextScript.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/TextScript.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- TextScript.java 11 Dec 2002 12:40:55 -0000 1.11
+++ TextScript.java 24 Jan 2003 05:26:13 -0000 1.12
@@ -62,9 +62,12 @@
package org.apache.commons.jelly.impl;
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.SAXException;
+
/** <p><code>TextScript</code> outputs some static text.</p>
*
* @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
@@ -143,9 +146,13 @@
}
/** Evaluates the body of a tag */
- public void run(JellyContext context, XMLOutput output) throws Exception {
+ public void run(JellyContext context, XMLOutput output) throws JellyException {
if ( text != null ) {
- output.write(text);
+ try {
+ output.write(text);
+ } catch (SAXException e) {
+ throw new JellyException("could not write to XMLOutput",e);
+ }
}
}
}
1.3 +6 -6 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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TestArgTag.java 24 Jan 2003 02:22:59 -0000 1.2
+++ TestArgTag.java 24 Jan 2003 05:26:14 -0000 1.3
@@ -269,7 +269,7 @@
return this;
}
- public void run(JellyContext context, XMLOutput output) throws Exception {
+ public void run(JellyContext context, XMLOutput output) throws JellyException {
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>