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 23:53:35 UTC
cvs commit: jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core ArgTag.java BreakTag.java CaseTag.java CatchTag.java ChooseTag.java DefaultTag.java ExprTag.java FileTag.java ForEachTag.java IfTag.java ImportTag.java IncludeTag.java InvokeTag.java JellyTag.java NewTag.java OtherwiseTag.java RemoveTag.java ScopeTag.java SetPropertiesTag.java SetTag.java SwitchTag.java ThreadTag.java UseBeanTag.java UseListTag.java WhenTag.java WhileTag.java WhitespaceTag.java
morgand 2003/01/24 14:53:35
Modified: jelly/jelly-tags/bean/src/java/org/apache/commons/jelly/tags/bean
BeanPropertyTag.java BeanTag.java
jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing
ActionTag.java BorderAlignTag.java
ComponentTag.java ContainerTag.java DialogTag.java
GbcTag.java LayoutTagSupport.java
TableModelColumnTag.java TableModelTag.java
TdTag.java TrTag.java
jelly/jelly-tags/swt/src/java/org/apache/commons/jelly/tags/swt
LayoutDataTag.java LayoutTag.java
LayoutTagSupport.java MenuTag.java SwtHelper.java
WidgetTag.java
jelly/src/java/org/apache/commons/jelly/impl BeanSource.java
jelly/src/java/org/apache/commons/jelly/tags/core
ArgTag.java BreakTag.java CaseTag.java
CatchTag.java ChooseTag.java DefaultTag.java
ExprTag.java FileTag.java ForEachTag.java
IfTag.java ImportTag.java IncludeTag.java
InvokeTag.java JellyTag.java NewTag.java
OtherwiseTag.java RemoveTag.java ScopeTag.java
SetPropertiesTag.java SetTag.java SwitchTag.java
ThreadTag.java UseBeanTag.java UseListTag.java
WhenTag.java WhileTag.java WhitespaceTag.java
Log:
converted core tags and decendants to use JellyTagException instead of
Exception
Revision Changes Path
1.4 +10 -9 jakarta-commons-sandbox/jelly/jelly-tags/bean/src/java/org/apache/commons/jelly/tags/bean/BeanPropertyTag.java
Index: BeanPropertyTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/bean/src/java/org/apache/commons/jelly/tags/bean/BeanPropertyTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- BeanPropertyTag.java 24 Jan 2003 10:04:30 -0000 1.3
+++ BeanPropertyTag.java 24 Jan 2003 22:53:32 -0000 1.4
@@ -69,6 +69,7 @@
import org.apache.commons.beanutils.MethodUtils;
import org.apache.commons.jelly.JellyException;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.XMLOutput;
/**
@@ -105,7 +106,7 @@
/**
* Creates a new instance by calling a create method on the parent bean
*/
- protected Object newInstance(Class theClass, Map attributes, XMLOutput output) throws JellyException {
+ protected Object newInstance(Class theClass, Map attributes, XMLOutput output) throws JellyTagException {
Object parentObject = getParentObject();
if (parentObject != null) {
// now lets try call the create method...
@@ -116,7 +117,7 @@
return method.invoke(parentObject, EMPTY_ARGS);
}
catch (Exception e) {
- throw new JellyException( "failed to invoke method: " + method + " on bean: " + parentObject + " reason: " + e, e );
+ throw new JellyTagException( "failed to invoke method: " + method + " on bean: " + parentObject + " reason: " + e, e );
}
}
else {
@@ -124,12 +125,12 @@
if(tagClass == Object.class)
tagClass = findAddMethodClass(parentClass);
if(tagClass == null)
- throw new JellyException("unable to infer element class for tag "+getTagName());
+ throw new JellyTagException("unable to infer element class for tag "+getTagName());
return super.newInstance(tagClass, attributes, output) ;
}
}
- throw new JellyException("The " + getTagName() + " tag must be nested within a tag which maps to a BeanSource implementor");
+ throw new JellyTagException("The " + getTagName() + " tag must be nested within a tag which maps to a BeanSource implementor");
}
/**
1.4 +11 -10 jakarta-commons-sandbox/jelly/jelly-tags/bean/src/java/org/apache/commons/jelly/tags/bean/BeanTag.java
Index: BeanTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/bean/src/java/org/apache/commons/jelly/tags/bean/BeanTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- BeanTag.java 24 Jan 2003 10:04:30 -0000 1.3
+++ BeanTag.java 24 Jan 2003 22:53:33 -0000 1.4
@@ -69,6 +69,7 @@
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.beanutils.MethodUtils;
import org.apache.commons.jelly.JellyException;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.impl.BeanSource;
import org.apache.commons.jelly.impl.CollectionTag;
import org.apache.commons.jelly.tags.core.UseBeanTag;
@@ -119,7 +120,7 @@
* Output the tag as a named variable. If the parent bean has an adder or setter
* method then invoke that to register this bean with its parent.
*/
- protected void processBean(String var, Object bean) throws JellyException {
+ protected void processBean(String var, Object bean) throws JellyTagException {
if (var != null) {
context.setVariable(var, bean);
}
@@ -141,16 +142,16 @@
method.invoke(parentObject, args);
}
catch (Exception e) {
- throw new JellyException( "failed to invoke method: " + method + " on bean: " + parentObject + " reason: " + e, e );
+ throw new JellyTagException( "failed to invoke method: " + method + " on bean: " + parentObject + " reason: " + e, e );
}
}
else {
try {
BeanUtils.setProperty(parentObject, tagName, bean);
} catch (IllegalAccessException e) {
- throw new JellyException(e);
+ throw new JellyTagException(e);
} catch (InvocationTargetException e) {
- throw new JellyException(e);
+ throw new JellyTagException(e);
}
}
}
@@ -187,7 +188,7 @@
/**
* @return the parent bean object
*/
- protected Object getParentObject() throws JellyException {
+ protected Object getParentObject() throws JellyTagException {
BeanSource tag = (BeanSource) findAncestorWithClass(BeanSource.class);
if (tag != null) {
return tag.getBean();
1.6 +14 -8 jakarta-commons-sandbox/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/ActionTag.java
Index: ActionTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/ActionTag.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ActionTag.java 24 Jan 2003 10:04:30 -0000 1.5
+++ ActionTag.java 24 Jan 2003 22:53:33 -0000 1.6
@@ -69,6 +69,7 @@
import javax.swing.Action;
import org.apache.commons.jelly.JellyException;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.MissingAttributeException;
import org.apache.commons.jelly.XMLOutput;
import org.apache.commons.jelly.tags.core.UseBeanTag;
@@ -93,13 +94,18 @@
// Tag interface
//-------------------------------------------------------------------------
- public void doTag(XMLOutput output) throws Exception {
+ public void doTag(XMLOutput output) throws JellyTagException {
Map attributes = getAttributes();
String var = (String) attributes.get( "var" );
Object classObject = attributes.remove( "class" );
// this method could return null in derived classes
- Class theClass = convertToClass(classObject);
+ Class theClass = null;
+ try {
+ theClass = convertToClass(classObject);
+ } catch (ClassNotFoundException e) {
+ throw new JellyTagException(e);
+ }
Object bean = newInstance(theClass, attributes, output);
setBean(bean);
@@ -142,7 +148,7 @@
* An existing Action could be specified via the 'action' attribute or an action class
* may be specified via the 'class' attribute, otherwise a default Action class is created.
*/
- protected Object newInstance(Class theClass, Map attributes, final XMLOutput output) throws JellyException {
+ protected Object newInstance(Class theClass, Map attributes, final XMLOutput output) throws JellyTagException {
Action action = (Action) attributes.remove( "action" );
if ( action == null ) {
if (theClass != null ) {
@@ -150,9 +156,9 @@
try {
return theClass.newInstance();
} catch (InstantiationException e) {
- throw new JellyException(e);
+ throw new JellyTagException(e);
} catch (IllegalAccessException e) {
- throw new JellyException(e);
+ throw new JellyTagException(e);
}
}
@@ -177,7 +183,7 @@
/**
* Either defines a variable or adds the current component to the parent
*/
- protected void processBean(String var, Object bean) throws JellyException {
+ protected void processBean(String var, Object bean) throws JellyTagException {
if (var != null) {
context.setVariable(var, bean);
}
@@ -187,7 +193,7 @@
tag.setAction((Action) bean);
}
else {
- throw new JellyException( "Either the 'var' attribute must be specified to export this Action or this tag must be nested within a JellySwing widget tag" );
+ throw new JellyTagException( "Either the 'var' attribute must be specified to export this Action or this tag must be nested within a JellySwing widget tag" );
}
}
}
@@ -196,7 +202,7 @@
/**
* Perform the strange setting of Action properties using its custom API
*/
- protected void setBeanProperties(Object bean, Map attributes) throws JellyException {
+ protected void setBeanProperties(Object bean, Map attributes) throws JellyTagException {
Action action = getAction();
for ( Iterator iter = attributes.entrySet().iterator(); iter.hasNext(); ) {
Map.Entry entry = (Map.Entry) iter.next();
1.5 +3 -3 jakarta-commons-sandbox/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/BorderAlignTag.java
Index: BorderAlignTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/BorderAlignTag.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- BorderAlignTag.java 24 Jan 2003 10:15:32 -0000 1.4
+++ BorderAlignTag.java 24 Jan 2003 22:53:33 -0000 1.5
@@ -64,7 +64,7 @@
import java.awt.BorderLayout;
import java.awt.Component;
-import org.apache.commons.jelly.JellyException;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
@@ -84,10 +84,10 @@
/**
* Adds a child component to this parent
*/
- public void addChild(Component component, Object constraints) throws JellyException {
+ public void addChild(Component component, Object constraints) throws JellyTagException {
BorderLayoutTag tag = (BorderLayoutTag) findAncestorWithClass( BorderLayoutTag.class );
if (tag == null) {
- throw new JellyException( "this tag must be nested within a <tr> tag" );
+ throw new JellyTagException( "this tag must be nested within a <tr> tag" );
}
tag.addLayoutComponent(component, getConstraints());
}
1.13 +14 -13 jakarta-commons-sandbox/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/ComponentTag.java
Index: ComponentTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/ComponentTag.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ComponentTag.java 24 Jan 2003 10:15:32 -0000 1.12
+++ ComponentTag.java 24 Jan 2003 22:53:33 -0000 1.13
@@ -82,6 +82,7 @@
import org.apache.commons.beanutils.ConvertUtils;
import org.apache.commons.jelly.JellyException;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.MissingAttributeException;
import org.apache.commons.jelly.XMLOutput;
import org.apache.commons.jelly.tags.core.UseBeanTag;
@@ -121,16 +122,16 @@
/**
* Sets the Action of this component
*/
- public void setAction(Action action) throws JellyException {
+ public void setAction(Action action) throws JellyTagException {
Component component = getComponent();
if ( component != null ) {
// lets just try set the 'action' property
try {
BeanUtils.setProperty( component, "action", action );
} catch (IllegalAccessException e) {
- throw new JellyException(e);
+ throw new JellyTagException(e);
} catch (InvocationTargetException e) {
- throw new JellyException(e);
+ throw new JellyTagException(e);
}
}
}
@@ -272,7 +273,7 @@
/**
* A class may be specified otherwise the Factory will be used.
*/
- protected Object newInstance(Class theClass, Map attributes, XMLOutput output) throws JellyException {
+ protected Object newInstance(Class theClass, Map attributes, XMLOutput output) throws JellyTagException {
try {
if (theClass != null ) {
return theClass.newInstance();
@@ -280,9 +281,9 @@
return factory.newInstance();
}
} catch (IllegalAccessException e) {
- throw new JellyException(e);
+ throw new JellyTagException(e);
} catch (InstantiationException e) {
- throw new JellyException(e);
+ throw new JellyTagException(e);
}
}
@@ -290,7 +291,7 @@
/**
* Either defines a variable or adds the current component to the parent
*/
- protected void processBean(String var, Object bean) throws JellyException {
+ protected void processBean(String var, Object bean) throws JellyTagException {
if (var != null) {
context.setVariable(var, bean);
}
@@ -302,7 +303,7 @@
}
else {
if (var == null) {
- throw new JellyException( "The 'var' attribute must be specified or this tag must be nested inside a JellySwing container tag like a widget or a layout" );
+ throw new JellyTagException( "The 'var' attribute must be specified or this tag must be nested inside a JellySwing container tag like a widget or a layout" );
}
}
}
@@ -311,7 +312,7 @@
/**
* Patch to handle wierd properties that don't quite match the Java Beans contract
*/
- protected void setBeanProperties(Object bean, Map attributes) throws JellyException {
+ protected void setBeanProperties(Object bean, Map attributes) throws JellyTagException {
for (Iterator iter = attributes.entrySet().iterator(); iter.hasNext(); ) {
Map.Entry entry = (Map.Entry) iter.next();
String name = (String) entry.getKey();
@@ -389,9 +390,9 @@
try {
BeanUtils.setProperty(component, name, value);
} catch (IllegalAccessException e) {
- throw new JellyException(e);
+ throw new JellyTagException(e);
} catch (InvocationTargetException e) {
- throw new JellyException(e);
+ throw new JellyTagException(e);
}
}
}
@@ -399,9 +400,9 @@
try {
BeanUtils.setProperty(bean, name, value);
} catch (IllegalAccessException e) {
- throw new JellyException(e);
+ throw new JellyTagException(e);
} catch (InvocationTargetException e) {
- throw new JellyException(e);
+ throw new JellyTagException(e);
}
}
}
1.4 +2 -2 jakarta-commons-sandbox/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/ContainerTag.java
Index: ContainerTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/ContainerTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ContainerTag.java 24 Jan 2003 10:04:30 -0000 1.3
+++ ContainerTag.java 24 Jan 2003 22:53:33 -0000 1.4
@@ -61,7 +61,7 @@
*/
package org.apache.commons.jelly.tags.swing;
-import org.apache.commons.jelly.JellyException;
+import org.apache.commons.jelly.JellyTagException;
import java.awt.Component;
@@ -79,5 +79,5 @@
* Adds a child component to this container with optional constraints.
* If the constraints are null they are ignored
*/
- public void addChild(Component component, Object constraints) throws JellyException;
+ public void addChild(Component component, Object constraints) throws JellyTagException;
}
1.3 +7 -6 jakarta-commons-sandbox/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/DialogTag.java
Index: DialogTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/DialogTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DialogTag.java 24 Jan 2003 10:04:30 -0000 1.2
+++ DialogTag.java 24 Jan 2003 22:53:33 -0000 1.3
@@ -69,6 +69,7 @@
import javax.swing.JDialog;
import org.apache.commons.jelly.JellyException;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.XMLOutput;
import org.apache.commons.jelly.tags.core.UseBeanTag;
import org.apache.commons.logging.Log;
@@ -97,7 +98,7 @@
* Creates a JDialog. The constructor used depends on the value of the owner attribute.
*/
protected Object newInstance(Class theClass, Map attributes, XMLOutput output)
- throws JellyException {
+ throws JellyTagException {
Object owner = attributes.remove( "owner" );
if (owner instanceof Frame) {
return new JDialog((Frame) owner);
1.6 +6 -6 jakarta-commons-sandbox/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/GbcTag.java
Index: GbcTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/GbcTag.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- GbcTag.java 24 Jan 2003 10:04:30 -0000 1.5
+++ GbcTag.java 24 Jan 2003 22:53:33 -0000 1.6
@@ -65,7 +65,7 @@
import java.awt.GridBagConstraints;
import java.util.Map;
-import org.apache.commons.jelly.JellyException;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.MissingAttributeException;
import org.apache.commons.jelly.XMLOutput;
import org.apache.commons.jelly.tags.core.UseBeanTag;
@@ -107,10 +107,10 @@
/**
* Adds a child component to this parent
*/
- public void addChild(Component component, Object constraints) throws JellyException {
+ public void addChild(Component component, Object constraints) throws JellyTagException {
GridBagLayoutTag tag = (GridBagLayoutTag) findAncestorWithClass( GridBagLayoutTag.class );
if (tag == null) {
- throw new JellyException( "this tag must be nested within a <tr> tag" );
+ throw new JellyTagException( "this tag must be nested within a <tr> tag" );
}
tag.addLayoutComponent(component, getConstraints());
}
@@ -134,14 +134,14 @@
/**
* A class may be specified otherwise the Factory will be used.
*/
- protected Object newInstance(Class theClass, Map attributes, XMLOutput output) throws JellyException {
+ protected Object newInstance(Class theClass, Map attributes, XMLOutput output) throws JellyTagException {
if (theClass != null ) {
try {
return theClass.newInstance();
} catch (IllegalAccessException e) {
- throw new JellyException(e);
+ throw new JellyTagException(e);
} catch (InstantiationException e) {
- throw new JellyException(e);
+ throw new JellyTagException(e);
}
}
else {
1.5 +4 -4 jakarta-commons-sandbox/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/LayoutTagSupport.java
Index: LayoutTagSupport.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/LayoutTagSupport.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- LayoutTagSupport.java 24 Jan 2003 10:04:30 -0000 1.4
+++ LayoutTagSupport.java 24 Jan 2003 22:53:33 -0000 1.5
@@ -64,7 +64,7 @@
import java.awt.Component;
import java.awt.LayoutManager;
-import org.apache.commons.jelly.JellyException;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
import org.apache.commons.logging.Log;
@@ -90,7 +90,7 @@
/**
* Adds the given layout component to the container with the specified constraints
*/
- public void addLayoutComponent(Component component, Object constraints) throws JellyException {
+ public void addLayoutComponent(Component component, Object constraints) throws JellyTagException {
getComponentTag().addChild(component, constraints);
}
@@ -130,10 +130,10 @@
/**
* @return the parent component tag or throw an exception
*/
- protected ComponentTag getComponentTag() throws JellyException {
+ protected ComponentTag getComponentTag() throws JellyTagException {
ComponentTag tag = (ComponentTag) findAncestorWithClass( ComponentTag.class );
if ( tag == null ) {
- throw new JellyException( "This tag must be nested within a JellySwing widget tag" );
+ throw new JellyTagException( "This tag must be nested within a JellySwing widget tag" );
}
return tag;
}
1.6 +3 -2 jakarta-commons-sandbox/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/TableModelColumnTag.java
Index: TableModelColumnTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/TableModelColumnTag.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TableModelColumnTag.java 24 Jan 2003 10:04:30 -0000 1.5
+++ TableModelColumnTag.java 24 Jan 2003 22:53:33 -0000 1.6
@@ -62,6 +62,7 @@
package org.apache.commons.jelly.tags.swing;
import org.apache.commons.jelly.JellyException;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.expression.Expression;
import org.apache.commons.jelly.tags.core.UseBeanTag;
import org.apache.commons.jelly.tags.swing.model.ExpressionTableColumn;
@@ -87,12 +88,12 @@
// Implementation methods
//-------------------------------------------------------------------------
- protected void processBean(String var, Object bean) throws JellyException {
+ protected void processBean(String var, Object bean) throws JellyTagException {
super.processBean(var, bean);
TableModelTag tag = (TableModelTag) findAncestorWithClass( TableModelTag.class );
if ( tag == null ) {
- throw new JellyException( "This tag must be nested within a <tableModel> tag" );
+ throw new JellyTagException( "This tag must be nested within a <tableModel> tag" );
}
tag.getTableModel().addColumn( getColumn() );
}
1.5 +4 -4 jakarta-commons-sandbox/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/TableModelTag.java
Index: TableModelTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/TableModelTag.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TableModelTag.java 24 Jan 2003 10:04:30 -0000 1.4
+++ TableModelTag.java 24 Jan 2003 22:53:33 -0000 1.5
@@ -63,7 +63,7 @@
import javax.swing.JTable;
-import org.apache.commons.jelly.JellyException;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.tags.core.UseBeanTag;
import org.apache.commons.jelly.tags.swing.model.ExpressionTableModel;
@@ -82,12 +82,12 @@
// Implementation methods
//-------------------------------------------------------------------------
- protected void processBean(String var, Object bean) throws JellyException {
+ protected void processBean(String var, Object bean) throws JellyTagException {
super.processBean(var, bean);
ComponentTag tag = (ComponentTag) findAncestorWithClass( ComponentTag.class );
if ( tag == null ) {
- throw new JellyException( "This tag must be nested within a JellySwing <table> tag" );
+ throw new JellyTagException( "This tag must be nested within a JellySwing <table> tag" );
}
ExpressionTableModel model = getTableModel();
model.setContext(context);
@@ -98,7 +98,7 @@
table.setModel(model);
}
else {
- throw new JellyException( "This tag must be nested within a JellySwing <table> tag" );
+ throw new JellyTagException( "This tag must be nested within a JellySwing <table> tag" );
}
}
1.6 +3 -3 jakarta-commons-sandbox/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/TdTag.java
Index: TdTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/TdTag.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TdTag.java 24 Jan 2003 10:04:30 -0000 1.5
+++ TdTag.java 24 Jan 2003 22:53:33 -0000 1.6
@@ -64,7 +64,7 @@
import java.awt.Component;
import java.awt.GridBagConstraints;
-import org.apache.commons.jelly.JellyException;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
import org.apache.commons.logging.Log;
@@ -98,11 +98,11 @@
/**
* Adds a child component to this parent
*/
- public void addChild(Component component, Object constraints) throws JellyException {
+ public void addChild(Component component, Object constraints) throws JellyTagException {
// add my child component to the layout manager
TrTag tag = (TrTag) findAncestorWithClass( TrTag.class );
if (tag == null) {
- throw new JellyException( "this tag must be nested within a <tr> tag" );
+ throw new JellyTagException( "this tag must be nested within a <tr> tag" );
}
tag.addCell(component, createConstraints());
}
1.5 +3 -3 jakarta-commons-sandbox/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/TrTag.java
Index: TrTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/swing/src/java/org/apache/commons/jelly/tags/swing/TrTag.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TrTag.java 24 Jan 2003 10:04:30 -0000 1.4
+++ TrTag.java 24 Jan 2003 22:53:33 -0000 1.5
@@ -67,7 +67,7 @@
import java.util.Iterator;
import java.util.List;
-import org.apache.commons.jelly.JellyException;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
import org.apache.commons.jelly.tags.swing.impl.Cell;
@@ -96,7 +96,7 @@
/**
* Adds a new cell to this row
*/
- public void addCell(Component component, GridBagConstraints constraints) throws JellyException {
+ public void addCell(Component component, GridBagConstraints constraints) throws JellyTagException {
constraints.gridx = cells.size();
cells.add(new Cell(constraints, component));
}
@@ -107,7 +107,7 @@
public void doTag(final XMLOutput output) throws Exception {
tableLayoutTag = (TableLayoutTag) findAncestorWithClass( TableLayoutTag.class );
if (tableLayoutTag == null) {
- throw new JellyException( "this tag must be nested within a <tableLayout> tag" );
+ throw new JellyTagException( "this tag must be nested within a <tableLayout> tag" );
}
rowIndex = tableLayoutTag.nextRowIndex();
cells.clear();
1.4 +9 -9 jakarta-commons-sandbox/jelly/jelly-tags/swt/src/java/org/apache/commons/jelly/tags/swt/LayoutDataTag.java
Index: LayoutDataTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/swt/src/java/org/apache/commons/jelly/tags/swt/LayoutDataTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- LayoutDataTag.java 24 Jan 2003 10:15:32 -0000 1.3
+++ LayoutDataTag.java 24 Jan 2003 22:53:33 -0000 1.4
@@ -65,7 +65,7 @@
import java.lang.reflect.InvocationTargetException;
import java.util.Map;
-import org.apache.commons.jelly.JellyException;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.XMLOutput;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -94,7 +94,7 @@
/**
* Either defines a variable or adds the current component to the parent
*/
- protected void processBean(String var, Object bean) throws JellyException {
+ protected void processBean(String var, Object bean) throws JellyTagException {
super.processBean(var, bean);
Widget parent = getParentWidget();
@@ -104,7 +104,7 @@
control.setLayoutData(getBean());
}
else {
- throw new JellyException("This tag must be nested within a control widget tag");
+ throw new JellyTagException("This tag must be nested within a control widget tag");
}
}
@@ -116,7 +116,7 @@
Class theClass,
Map attributes,
XMLOutput output)
- throws JellyException {
+ throws JellyTagException {
String text = (String) attributes.remove("style");
if (text != null) {
@@ -132,13 +132,13 @@
return constructor.newInstance(values);
}
} catch (NoSuchMethodException e) {
- throw new JellyException(e);
+ throw new JellyTagException(e);
} catch (InstantiationException e) {
- throw new JellyException(e);
+ throw new JellyTagException(e);
} catch (IllegalAccessException e) {
- throw new JellyException(e);
+ throw new JellyTagException(e);
} catch (InvocationTargetException e) {
- throw new JellyException(e);
+ throw new JellyTagException(e);
}
}
return super.newInstance(theClass, attributes, output);
@@ -148,7 +148,7 @@
* @see org.apache.commons.jelly.tags.swt.LayoutTagSupport#convertValue(java.lang.Object, java.lang.String, java.lang.Object)
*/
protected Object convertValue(Object bean, String name, Object value)
- throws JellyException {
+ throws JellyTagException {
if (bean instanceof GridData) {
if (name.endsWith("Alignment") && value instanceof String) {
1.3 +4 -4 jakarta-commons-sandbox/jelly/jelly-tags/swt/src/java/org/apache/commons/jelly/tags/swt/LayoutTag.java
Index: LayoutTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/swt/src/java/org/apache/commons/jelly/tags/swt/LayoutTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LayoutTag.java 24 Jan 2003 10:04:31 -0000 1.2
+++ LayoutTag.java 24 Jan 2003 22:53:33 -0000 1.3
@@ -61,7 +61,7 @@
*/
package org.apache.commons.jelly.tags.swt;
-import org.apache.commons.jelly.JellyException;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.eclipse.swt.SWT;
@@ -105,7 +105,7 @@
/**
* Either defines a variable or adds the current component to the parent
*/
- protected void processBean(String var, Object bean) throws JellyException {
+ protected void processBean(String var, Object bean) throws JellyTagException {
super.processBean(var, bean);
Widget parent = getParentWidget();
@@ -114,7 +114,7 @@
composite.setLayout(getLayout());
}
else {
- throw new JellyException("This tag must be nested within a composite widget tag");
+ throw new JellyTagException("This tag must be nested within a composite widget tag");
}
}
@@ -122,7 +122,7 @@
* @see org.apache.commons.jelly.tags.swt.LayoutTagSupport#convertValue(java.lang.Object, java.lang.String, java.lang.Object)
*/
protected Object convertValue(Object bean, String name, Object value)
- throws JellyException {
+ throws JellyTagException {
if (bean instanceof FillLayout && name.equals("type") && value instanceof String) {
int style = SwtHelper.parseStyle(SWT.class, (String) value);
1.3 +7 -7 jakarta-commons-sandbox/jelly/jelly-tags/swt/src/java/org/apache/commons/jelly/tags/swt/LayoutTagSupport.java
Index: LayoutTagSupport.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/swt/src/java/org/apache/commons/jelly/tags/swt/LayoutTagSupport.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LayoutTagSupport.java 24 Jan 2003 10:04:31 -0000 1.2
+++ LayoutTagSupport.java 24 Jan 2003 22:53:33 -0000 1.3
@@ -68,7 +68,7 @@
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.beanutils.ConvertUtils;
-import org.apache.commons.jelly.JellyException;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.tags.core.UseBeanTag;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -120,7 +120,7 @@
/**
* Either defines a variable or adds the current component to the parent
*/
- protected void processBean(String var, Object bean) throws JellyException {
+ protected void processBean(String var, Object bean) throws JellyTagException {
if (var != null) {
context.setVariable(var, bean);
}
@@ -130,7 +130,7 @@
* @see org.apache.commons.jelly.tags.core.UseBeanTag#setBeanProperties(java.lang.Object, java.util.Map)
*/
protected void setBeanProperties(Object bean, Map attributes)
- throws JellyException {
+ throws JellyTagException {
if (bean != null) {
Class theClass = bean.getClass();
@@ -154,11 +154,11 @@
BeanUtils.setProperty(bean, name, value);
}
} catch (NoSuchFieldException e) {
- throw new JellyException(e);
+ throw new JellyTagException(e);
} catch (IllegalAccessException e) {
- throw new JellyException(e);
+ throw new JellyTagException(e);
} catch (InvocationTargetException e) {
- throw new JellyException(e);
+ throw new JellyTagException(e);
}
}
}
@@ -173,7 +173,7 @@
* @param value the value of the property
* @return the new value
*/
- protected Object convertValue(Object bean, String name, Object value) throws JellyException {
+ protected Object convertValue(Object bean, String name, Object value) throws JellyTagException {
return value;
}
1.3 +3 -3 jakarta-commons-sandbox/jelly/jelly-tags/swt/src/java/org/apache/commons/jelly/tags/swt/MenuTag.java
Index: MenuTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/swt/src/java/org/apache/commons/jelly/tags/swt/MenuTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MenuTag.java 24 Jan 2003 10:15:32 -0000 1.2
+++ MenuTag.java 24 Jan 2003 22:53:33 -0000 1.3
@@ -61,7 +61,7 @@
*/
package org.apache.commons.jelly.tags.swt;
-import org.apache.commons.jelly.JellyException;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.eclipse.swt.widgets.Control;
@@ -130,7 +130,7 @@
* @see org.apache.commons.jelly.tags.swt.WidgetTag#createWidget(java.lang.Class, org.eclipse.swt.widgets.Widget, int)
*/
protected Object createWidget(Class theClass, Widget parent, int style)
- throws JellyException {
+ throws JellyTagException {
if (parent instanceof Decorations) {
return super.createWidget(theClass, parent, style);
@@ -146,7 +146,7 @@
return new Menu((Control) parent);
}
else {
- throw new JellyException("This tag must be nested inside a <shell>, <menu>, <menuItem> or control tag");
+ throw new JellyTagException("This tag must be nested inside a <shell>, <menu>, <menuItem> or control tag");
}
}
}
1.3 +6 -6 jakarta-commons-sandbox/jelly/jelly-tags/swt/src/java/org/apache/commons/jelly/tags/swt/SwtHelper.java
Index: SwtHelper.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/swt/src/java/org/apache/commons/jelly/tags/swt/SwtHelper.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SwtHelper.java 24 Jan 2003 10:04:31 -0000 1.2
+++ SwtHelper.java 24 Jan 2003 22:53:33 -0000 1.3
@@ -64,7 +64,7 @@
import java.lang.reflect.Field;
import java.util.StringTokenizer;
-import org.apache.commons.jelly.JellyException;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.tags.core.UseBeanTag;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -90,7 +90,7 @@
* @param text is a comma delimited text value such as "border, resize"
* @return the int code
*/
- public static int parseStyle(Class constantClass, String text) throws JellyException {
+ public static int parseStyle(Class constantClass, String text) throws JellyTagException {
return parseStyle(constantClass, text, true);
}
@@ -105,7 +105,7 @@
*
* @return the int code
*/
- public static int parseStyle(Class constantClass, String text, boolean toUpperCase) throws JellyException{
+ public static int parseStyle(Class constantClass, String text, boolean toUpperCase) throws JellyTagException{
int answer = 0;
if (text != null) {
if (toUpperCase) {
@@ -124,7 +124,7 @@
* @return the code for the given word or zero if the word doesn't match a
* valid style
*/
- public static int getStyleCode(Class constantClass,String text) throws JellyException {
+ public static int getStyleCode(Class constantClass,String text) throws JellyTagException {
try {
Field field = constantClass.getField(text);
if (field == null) {
@@ -133,9 +133,9 @@
}
return field.getInt(null);
} catch (NoSuchFieldException e) {
- throw new JellyException("The value: " + text + " is not understood", e);
+ throw new JellyTagException("The value: " + text + " is not understood", e);
} catch (IllegalAccessException e) {
- throw new JellyException("The value: " + text + " is not understood", e);
+ throw new JellyTagException("The value: " + text + " is not understood", e);
}
}
}
1.3 +9 -9 jakarta-commons-sandbox/jelly/jelly-tags/swt/src/java/org/apache/commons/jelly/tags/swt/WidgetTag.java
Index: WidgetTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/swt/src/java/org/apache/commons/jelly/tags/swt/WidgetTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- WidgetTag.java 24 Jan 2003 10:04:31 -0000 1.2
+++ WidgetTag.java 24 Jan 2003 22:53:33 -0000 1.3
@@ -65,7 +65,7 @@
import java.lang.reflect.InvocationTargetException;
import java.util.Map;
-import org.apache.commons.jelly.JellyException;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.XMLOutput;
import org.apache.commons.jelly.tags.core.UseBeanTag;
import org.apache.commons.logging.Log;
@@ -127,7 +127,7 @@
/**
* Factory method to create a new widget
*/
- protected Object newInstance(Class theClass, Map attributes, XMLOutput output) throws JellyException {
+ protected Object newInstance(Class theClass, Map attributes, XMLOutput output) throws JellyTagException {
int style = getStyle(attributes);
// now lets call the constructor with the parent
@@ -158,9 +158,9 @@
* @param style the SWT style code
* @return the new Widget
*/
- protected Object createWidget(Class theClass, Widget parent, int style) throws JellyException {
+ protected Object createWidget(Class theClass, Widget parent, int style) throws JellyTagException {
if (theClass == null) {
- throw new JellyException( "No Class available to create the new widget");
+ throw new JellyTagException( "No Class available to create the new widget");
}
try {
@@ -190,13 +190,13 @@
}
return theClass.newInstance();
} catch (NoSuchMethodException e) {
- throw new JellyException(e);
+ throw new JellyTagException(e);
} catch (InstantiationException e) {
- throw new JellyException(e);
+ throw new JellyTagException(e);
} catch (IllegalAccessException e) {
- throw new JellyException(e);
+ throw new JellyTagException(e);
} catch (InvocationTargetException e) {
- throw new JellyException(e);
+ throw new JellyTagException(e);
}
}
@@ -204,7 +204,7 @@
* Creates the SWT style code for the current attributes
* @return the SWT style code
*/
- protected int getStyle(Map attributes) throws JellyException {
+ protected int getStyle(Map attributes) throws JellyTagException {
String text = (String) attributes.remove("style");
if (text != null) {
return SwtHelper.parseStyle(SWT.class, text);
1.4 +2 -2 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/BeanSource.java
Index: BeanSource.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/BeanSource.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- BeanSource.java 24 Jan 2003 10:04:32 -0000 1.3
+++ BeanSource.java 24 Jan 2003 22:53:33 -0000 1.4
@@ -61,7 +61,7 @@
*/
package org.apache.commons.jelly.impl;
-import org.apache.commons.jelly.JellyException;
+import org.apache.commons.jelly.JellyTagException;
/**
* A tag which is associated with a JavaBean, such as a {@link DynamicBeanTag}
@@ -74,5 +74,5 @@
/**
* @return the bean to which this tag is associated
*/
- public Object getBean() throws JellyException;
+ public Object getBean() throws JellyTagException;
}
1.3 +18 -13 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/ArgTag.java
Index: ArgTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/ArgTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ArgTag.java 30 Nov 2002 07:41:21 -0000 1.2
+++ ArgTag.java 24 Jan 2003 22:53:33 -0000 1.3
@@ -74,6 +74,7 @@
import org.apache.commons.beanutils.converters.LongConverter;
import org.apache.commons.beanutils.converters.ShortConverter;
import org.apache.commons.jelly.JellyException;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.XMLOutput;
/**
@@ -113,7 +114,7 @@
// tag methods
//-------------------------------------------------------------------------
- public void doTag(XMLOutput output) throws Exception {
+ public void doTag(XMLOutput output) throws JellyTagException {
invokeBody(output);
Class klass = null;
@@ -142,7 +143,11 @@
klass = Double.TYPE;
assertNotNull(value);
} else if(null != typeString) {
- klass = getClassLoader().loadClass(typeString);
+ try {
+ klass = getClassLoader().loadClass(typeString);
+ } catch (ClassNotFoundException e) {
+ throw new JellyTagException(e);
+ }
} else if(null == value) { // and (by construction) null == typeString
klass = Object.class;
} else {
@@ -155,7 +160,7 @@
ArgTagParent parent = (ArgTagParent)findAncestorWithClass(ArgTagParent.class);
if(null == parent) {
- throw new JellyException("This tag must be enclosed inside an ArgTagParent implementation (for example, <new> or <invoke>)" );
+ throw new JellyTagException("This tag must be enclosed inside an ArgTagParent implementation (for example, <new> or <invoke>)" );
} else {
parent.addArgument(klass,value);
}
@@ -164,9 +169,9 @@
// private methods
//-------------------------------------------------------------------------
- private void assertNotNull(Object value) throws JellyException {
+ private void assertNotNull(Object value) throws JellyTagException {
if(null == value) {
- throw new JellyException("A " + typeString + " instance cannot be null.");
+ throw new JellyTagException("A " + typeString + " instance cannot be null.");
}
}
@@ -186,18 +191,18 @@
// static stuff
//-------------------------------------------------------------------------
- private static Object convert(Class klass, Object value) throws JellyException {
+ private static Object convert(Class klass, Object value) throws JellyTagException {
if(null == value) {
return null;
} else if(!klass.isInstance(value)) {
Converter converter = (Converter)(converterMap.get(klass));
if(null == converter) {
- throw new JellyException("Can't convert " + value + " to " + klass);
+ throw new JellyTagException("Can't convert " + value + " to " + klass);
} else {
try {
return converter.convert(klass,value);
} catch(ConversionException e) {
- throw new JellyException("Can't convert " + value + " to " + klass + " (" + e.toString() + ")",e);
+ throw new JellyTagException("Can't convert " + value + " to " + klass + " (" + e.toString() + ")",e);
}
}
} else {
1.4 +1 -1 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/BreakTag.java
Index: BreakTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/BreakTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- BreakTag.java 10 Dec 2002 01:33:39 -0000 1.3
+++ BreakTag.java 24 Jan 2003 22:53:33 -0000 1.4
@@ -90,7 +90,7 @@
// Tag interface
//-------------------------------------------------------------------------
- public void doTag(XMLOutput output) throws Exception {
+ public void doTag(XMLOutput output) throws BreakException {
if (test == null || test.evaluateAsBoolean(context)) {
throw new BreakException();
}
1.4 +9 -8 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/CaseTag.java
Index: CaseTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/CaseTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CaseTag.java 30 Oct 2002 19:16:21 -0000 1.3
+++ CaseTag.java 24 Jan 2003 22:53:33 -0000 1.4
@@ -62,6 +62,7 @@
package org.apache.commons.jelly.tags.core;
import org.apache.commons.jelly.JellyException;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.MissingAttributeException;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
@@ -96,16 +97,16 @@
this.fallThru = fallThru;
}
- public void doTag(XMLOutput output) throws Exception {
+ public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException {
if(null == this.valueExpression) {
throw new MissingAttributeException("value");
}
SwitchTag tag = (SwitchTag)findAncestorWithClass(SwitchTag.class);
if(null == tag) {
- throw new JellyException("This tag must be enclosed inside a <switch> tag" );
+ throw new JellyTagException("This tag must be enclosed inside a <switch> tag" );
}
if(tag.hasDefaultBeenEncountered()) {
- throw new JellyException("<default> should be the last tag within a <switch>" );
+ throw new JellyTagException("<default> should be the last tag within a <switch>" );
}
Object value = valueExpression.evaluate(context);
if(tag.isFallingThru() ||
1.4 +2 -1 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/CatchTag.java
Index: CatchTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/CatchTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CatchTag.java 11 Dec 2002 12:40:54 -0000 1.3
+++ CatchTag.java 24 Jan 2003 22:53:33 -0000 1.4
@@ -61,6 +61,7 @@
*/
package org.apache.commons.jelly.tags.core;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
@@ -81,7 +82,7 @@
// Tag interface
//-------------------------------------------------------------------------
- public void doTag(XMLOutput output) throws Exception {
+ public void doTag(XMLOutput output) throws JellyTagException {
if (var != null) {
context.removeVariable(var);
}
1.9 +7 -6 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/ChooseTag.java
Index: ChooseTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/ChooseTag.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ChooseTag.java 11 Dec 2002 12:40:54 -0000 1.8
+++ ChooseTag.java 24 Jan 2003 22:53:33 -0000 1.9
@@ -61,6 +61,7 @@
*/
package org.apache.commons.jelly.tags.core;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
@@ -78,7 +79,7 @@
// Tag interface
//-------------------------------------------------------------------------
- public void doTag(XMLOutput output) throws Exception {
+ public void doTag(XMLOutput output) throws JellyTagException {
setBlockEvaluated(false);
invokeBody(output);
}
1.4 +9 -8 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/DefaultTag.java
Index: DefaultTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/DefaultTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DefaultTag.java 30 Oct 2002 19:16:21 -0000 1.3
+++ DefaultTag.java 24 Jan 2003 22:53:33 -0000 1.4
@@ -62,6 +62,7 @@
package org.apache.commons.jelly.tags.core;
import org.apache.commons.jelly.JellyException;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
@@ -91,13 +92,13 @@
this.fallThru = fallThru;
}
- public void doTag(XMLOutput output) throws Exception {
+ public void doTag(XMLOutput output) throws JellyTagException {
SwitchTag tag = (SwitchTag)findAncestorWithClass(SwitchTag.class);
if(null == tag) {
- throw new JellyException("This tag must be enclosed inside a <switch> tag" );
+ throw new JellyTagException("This tag must be enclosed inside a <switch> tag" );
}
if(tag.hasDefaultBeenEncountered()) {
- throw new JellyException("Only one <default> tag is allowed per <switch>.");
+ throw new JellyTagException("Only one <default> tag is allowed per <switch>.");
}
tag.defaultEncountered();
if(tag.isFallingThru() || (!tag.hasSomeCaseMatched())) {
1.12 +16 -7 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/ExprTag.java
Index: ExprTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/ExprTag.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- ExprTag.java 11 Dec 2002 12:40:54 -0000 1.11
+++ ExprTag.java 24 Jan 2003 22:53:33 -0000 1.12
@@ -61,12 +61,15 @@
*/
package org.apache.commons.jelly.tags.core;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
import org.apache.commons.jelly.expression.Expression;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.xml.sax.SAXException;
+
/** A tag which evaluates an expression
*
* @tag out
@@ -86,11 +89,17 @@
// Tag interface
//-------------------------------------------------------------------------
- public void doTag(XMLOutput output) throws Exception {
+ public void doTag(XMLOutput output) throws JellyTagException {
if (value != null) {
String text = value.evaluateAsString(context);
if (text != null) {
- output.write(text);
+
+ try {
+ output.write(text);
+ }
+ catch (SAXException e) {
+ throw new JellyTagException("could not write the XMLOutput",e);
+ }
}
}
}
1.9 +28 -18 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/FileTag.java
Index: FileTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/FileTag.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- FileTag.java 24 Jan 2003 10:04:33 -0000 1.8
+++ FileTag.java 24 Jan 2003 22:53:34 -0000 1.9
@@ -56,13 +56,16 @@
*/
package org.apache.commons.jelly.tags.core;
+import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
import java.io.Writer;
import org.apache.commons.jelly.JellyException;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
import org.dom4j.io.HTMLWriter;
@@ -93,19 +96,27 @@
// Tag interface
//-------------------------------------------------------------------------
- public void doTag(final XMLOutput output) throws Exception {
- if ( name != null ) {
- String encoding = (this.encoding != null) ? this.encoding : "UTF-8";
- Writer writer = new OutputStreamWriter( new FileOutputStream( name ), encoding );
- writeBody(writer);
- }
- else if (var != null) {
- StringWriter writer = new StringWriter();
- writeBody(writer);
- context.setVariable(var, writer.toString());
- }
- else {
- throw new JellyException( "This tag must have either the 'name' or the 'var' variables defined" );
+ public void doTag(final XMLOutput output) throws JellyTagException {
+ try {
+ if ( name != null ) {
+ String encoding = (this.encoding != null) ? this.encoding : "UTF-8";
+ Writer writer = new OutputStreamWriter( new FileOutputStream( name ), encoding );
+ writeBody(writer);
+ }
+ else if (var != null) {
+ StringWriter writer = new StringWriter();
+ writeBody(writer);
+ context.setVariable(var, writer.toString());
+ }
+ else {
+ throw new JellyTagException( "This tag must have either the 'name' or the 'var' variables defined" );
+ }
+ } catch (FileNotFoundException e) {
+ throw new JellyTagException(e);
+ } catch (UnsupportedEncodingException e) {
+ throw new JellyTagException(e);
+ } catch (SAXException e) {
+ throw new JellyTagException("could not write file",e);
}
}
@@ -185,16 +196,15 @@
/**
* Writes the body fo this tag to the given Writer
*/
- protected void writeBody(Writer writer) throws JellyException {
+ protected void writeBody(Writer writer) throws SAXException, JellyTagException {
XMLOutput newOutput = createXMLOutput(writer);
try {
newOutput.startDocument();
invokeBody(newOutput);
newOutput.endDocument();
- } catch (SAXException e) {
- throw new JellyException(e);
- } finally {
+ }
+ finally {
try { newOutput.close(); } catch (IOException e) {}
}
}
@@ -202,7 +212,7 @@
/**
* A Factory method to create a new XMLOutput from the given Writer.
*/
- protected XMLOutput createXMLOutput(Writer writer) throws JellyException {
+ protected XMLOutput createXMLOutput(Writer writer) {
OutputFormat format = null;
if (prettyPrint) {
1.20 +7 -6 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/ForEachTag.java
Index: ForEachTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/ForEachTag.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- ForEachTag.java 11 Dec 2002 12:40:54 -0000 1.19
+++ ForEachTag.java 24 Jan 2003 22:53:34 -0000 1.20
@@ -64,6 +64,7 @@
import java.util.Iterator;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.MissingAttributeException;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
@@ -115,7 +116,7 @@
// Tag interface
//-------------------------------------------------------------------------
- public void doTag(XMLOutput output) throws Exception {
+ public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException {
if (log.isDebugEnabled()) {
log.debug("running with items: " + items);
1.11 +7 -6 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/IfTag.java
Index: IfTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/IfTag.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- IfTag.java 11 Dec 2002 12:40:54 -0000 1.10
+++ IfTag.java 24 Jan 2003 22:53:34 -0000 1.11
@@ -61,6 +61,7 @@
*/
package org.apache.commons.jelly.tags.core;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.MissingAttributeException;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
@@ -81,7 +82,7 @@
// Tag interface
//-------------------------------------------------------------------------
- public void doTag(XMLOutput output) throws Exception {
+ public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException {
if (test != null) {
if (test.evaluateAsBoolean(context)) {
invokeBody(output);
1.6 +20 -13 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/ImportTag.java
Index: ImportTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/ImportTag.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ImportTag.java 11 Jan 2003 04:03:48 -0000 1.5
+++ ImportTag.java 24 Jan 2003 22:53:34 -0000 1.6
@@ -62,6 +62,8 @@
package org.apache.commons.jelly.tags.core;
+import org.apache.commons.jelly.JellyException;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.MissingAttributeException;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
@@ -112,18 +114,23 @@
* @param output the destination for output
* @throws Exception Any exception can be thrown
*/
- public void doTag(XMLOutput output) throws Exception {
+ public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException {
if (uri == null && file == null) {
throw new MissingAttributeException( "uri" );
}
- if (uri != null) {
- // we need to create a new JellyContext of the URI
- // take off the script name from the URL
- context.runScript(uri, output, true, isInherit() );
- } else {
- context.runScript(new java.io.File(file), output, true,
- isInherit());
+ try {
+ if (uri != null) {
+ // we need to create a new JellyContext of the URI
+ // take off the script name from the URL
+ context.runScript(uri, output, true, isInherit() );
+ } else {
+ context.runScript(new java.io.File(file), output, true,
+ isInherit());
+ }
+ }
+ catch (JellyException e) {
+ throw new JellyTagException("could not import script",e);
}
}
1.11 +14 -7 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/IncludeTag.java
Index: IncludeTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/IncludeTag.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- IncludeTag.java 11 Dec 2002 12:40:54 -0000 1.10
+++ IncludeTag.java 24 Jan 2003 22:53:34 -0000 1.11
@@ -62,6 +62,8 @@
package org.apache.commons.jelly.tags.core;
+import org.apache.commons.jelly.JellyException;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.MissingAttributeException;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
@@ -108,7 +110,7 @@
//-------------------------------------------------------------------------
- public void doTag(XMLOutput output) throws Exception {
+ public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException {
if (uri == null) {
@@ -120,7 +122,12 @@
// take off the script name from the URL
- context.runScript(uri, output, isExport(), isInherit() );
+ try {
+ context.runScript(uri, output, isExport(), isInherit() );
+ }
+ catch (JellyException e) {
+ throw new JellyTagException("could not include jelly script",e);
+ }
}
// Properties
1.3 +23 -7 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/InvokeTag.java
Index: InvokeTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/InvokeTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- InvokeTag.java 30 Nov 2002 07:41:21 -0000 1.2
+++ InvokeTag.java 24 Jan 2003 22:53:34 -0000 1.3
@@ -61,10 +61,12 @@
*/
package org.apache.commons.jelly.tags.core;
+import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.beanutils.MethodUtils;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.MissingAttributeException;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
@@ -111,7 +113,7 @@
// Tag interface
//-------------------------------------------------------------------------
- public void doTag(XMLOutput output) throws Exception {
+ public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException {
if ( null == methodName) {
throw new MissingAttributeException( "method" );
}
@@ -123,7 +125,21 @@
Object[] values = paramValues.toArray();
Class[] types = (Class[])(paramTypes.toArray(new Class[paramTypes.size()]));
- Object result = MethodUtils.invokeMethod(onInstance,methodName,values,types);
+
+ Object result = null;
+ try {
+ result = MethodUtils.invokeMethod(onInstance,methodName,values,types);
+ }
+ catch (NoSuchMethodException e) {
+ throw new JellyTagException(e);
+ }
+ catch (IllegalAccessException e) {
+ throw new JellyTagException(e);
+ }
+ catch (InvocationTargetException e) {
+ throw new JellyTagException(e);
+ }
+
paramTypes.clear();
paramValues.clear();
1.11 +7 -6 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/JellyTag.java
Index: JellyTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/JellyTag.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- JellyTag.java 11 Dec 2002 12:40:54 -0000 1.10
+++ JellyTag.java 24 Jan 2003 22:53:34 -0000 1.11
@@ -61,6 +61,7 @@
*/
package org.apache.commons.jelly.tags.core;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
import org.apache.commons.logging.Log;
@@ -82,7 +83,7 @@
// Tag interface
//-------------------------------------------------------------------------
- public void doTag(XMLOutput output) throws Exception {
+ public void doTag(XMLOutput output) throws JellyTagException {
if ( log.isDebugEnabled() ) {
log.debug( "Running body: " + getBody() );
1.7 +34 -15 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/NewTag.java
Index: NewTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/NewTag.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- NewTag.java 30 Nov 2002 07:41:21 -0000 1.6
+++ NewTag.java 24 Jan 2003 22:53:34 -0000 1.7
@@ -61,10 +61,12 @@
*/
package org.apache.commons.jelly.tags.core;
+import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.beanutils.ConstructorUtils;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.MissingAttributeException;
import org.apache.commons.jelly.XMLOutput;
@@ -104,7 +106,7 @@
// Tag interface
//-------------------------------------------------------------------------
- public void doTag(XMLOutput output) throws Exception {
+ public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException {
ArgTag parentArg = null;
if ( var == null ) {
parentArg = (ArgTag)(findAncestorWithClass(ArgTag.class));
@@ -117,21 +119,38 @@
}
invokeBody(output);
- Class theClass = getClassLoader().loadClass( className );
- Object object = null;
- if(paramTypes.size() == 0) {
- object = theClass.newInstance();
- } else {
- Object[] values = paramValues.toArray();
- Class[] types = (Class[])(paramTypes.toArray(new Class[paramTypes.size()]));
- object = ConstructorUtils.invokeConstructor(theClass,values,types);
- paramTypes.clear();
- paramValues.clear();
+ try {
+ Class theClass = getClassLoader().loadClass( className );
+ Object object = null;
+ if(paramTypes.size() == 0) {
+ object = theClass.newInstance();
+ } else {
+ Object[] values = paramValues.toArray();
+ Class[] types = (Class[])(paramTypes.toArray(new Class[paramTypes.size()]));
+ object = ConstructorUtils.invokeConstructor(theClass,values,types);
+ paramTypes.clear();
+ paramValues.clear();
+ }
+ if(null != var) {
+ context.setVariable(var, object);
+ } else {
+ parentArg.setValue(object);
+ }
+ }
+ catch (ClassNotFoundException e) {
+ throw new JellyTagException(e);
+ }
+ catch (InstantiationException e) {
+ throw new JellyTagException(e);
+ }
+ catch (NoSuchMethodException e) {
+ throw new JellyTagException(e);
}
- if(null != var) {
- context.setVariable(var, object);
- } else {
- parentArg.setValue(object);
+ catch (IllegalAccessException e) {
+ throw new JellyTagException(e);
+ }
+ catch (InvocationTargetException e) {
+ throw new JellyTagException(e);
}
}
}
1.10 +8 -8 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/OtherwiseTag.java
Index: OtherwiseTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/OtherwiseTag.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- OtherwiseTag.java 11 Dec 2002 12:40:54 -0000 1.9
+++ OtherwiseTag.java 24 Jan 2003 22:53:34 -0000 1.10
@@ -61,7 +61,7 @@
*/
package org.apache.commons.jelly.tags.core;
-import org.apache.commons.jelly.JellyException;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
@@ -77,10 +77,10 @@
// Tag interface
//-------------------------------------------------------------------------
- public void doTag(XMLOutput output) throws Exception {
+ public void doTag(XMLOutput output) throws JellyTagException {
ChooseTag tag = (ChooseTag) findAncestorWithClass( ChooseTag.class );
if ( tag == null ) {
- throw new JellyException( "This tag must be enclosed inside a <choose> tag" );
+ throw new JellyTagException( "This tag must be enclosed inside a <choose> tag" );
}
if ( ! tag.isBlockEvaluated() ) {
tag.setBlockEvaluated(true);
1.3 +1 -1 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/RemoveTag.java
Index: RemoveTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/RemoveTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- RemoveTag.java 30 Oct 2002 19:16:21 -0000 1.2
+++ RemoveTag.java 24 Jan 2003 22:53:34 -0000 1.3
@@ -80,7 +80,7 @@
// Tag interface
//-------------------------------------------------------------------------
- public void doTag(XMLOutput output) throws Exception {
+ public void doTag(XMLOutput output) throws MissingAttributeException {
if (var != null) {
context.removeVariable(var);
}
1.3 +2 -1 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/ScopeTag.java
Index: ScopeTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/ScopeTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ScopeTag.java 30 Oct 2002 19:16:20 -0000 1.2
+++ ScopeTag.java 24 Jan 2003 22:53:34 -0000 1.3
@@ -62,6 +62,7 @@
package org.apache.commons.jelly.tags.core;
import org.apache.commons.jelly.JellyContext;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
@@ -77,7 +78,7 @@
// Tag interface
//-------------------------------------------------------------------------
- public void doTag(XMLOutput output) throws Exception {
+ public void doTag(XMLOutput output) throws JellyTagException {
JellyContext newContext = context.newJellyContext();
getBody().run(newContext, output);
}
1.5 +10 -5 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/SetPropertiesTag.java
Index: SetPropertiesTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/SetPropertiesTag.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SetPropertiesTag.java 24 Jan 2003 10:04:33 -0000 1.4
+++ SetPropertiesTag.java 24 Jan 2003 22:53:34 -0000 1.5
@@ -62,6 +62,7 @@
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.jelly.JellyException;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.MissingAttributeException;
import org.apache.commons.jelly.MapTagSupport;
import org.apache.commons.jelly.XMLOutput;
@@ -91,14 +92,18 @@
// Tag interface
//-------------------------------------------------------------------------
- public void doTag(XMLOutput output) throws Exception {
+ public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException {
Map attributes = getAttributes();
Object bean = attributes.remove( "object" );
if ( bean == null ) {
// lets try find a parent bean
BeanSource tag = (BeanSource) findAncestorWithClass(BeanSource.class);
if (tag != null) {
- bean = tag.getBean();
+ try {
+ bean = tag.getBean();
+ } catch (JellyException e) {
+ throw new JellyTagException(e);
+ }
}
if (bean == null) {
throw new MissingAttributeException("bean");
@@ -114,13 +119,13 @@
* Sets the properties on the bean. Derived tags could implement some custom
* type conversion etc.
*/
- protected void setBeanProperties(Object bean, Map attributes) throws JellyException {
+ protected void setBeanProperties(Object bean, Map attributes) throws JellyTagException {
try {
BeanUtils.populate(bean, attributes);
} catch (IllegalAccessException e) {
- throw new JellyException("could not set the properties on a bean",e);
+ throw new JellyTagException("could not set the properties on a bean",e);
} catch (InvocationTargetException e) {
- throw new JellyException("could not set the properties on a bean",e);
+ throw new JellyTagException("could not set the properties on a bean",e);
}
}
}
1.12 +9 -8 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/SetTag.java
Index: SetTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/SetTag.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- SetTag.java 24 Jan 2003 10:04:33 -0000 1.11
+++ SetTag.java 24 Jan 2003 22:53:34 -0000 1.12
@@ -66,6 +66,7 @@
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.jelly.JellyException;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
import org.apache.commons.jelly.expression.Expression;
@@ -106,7 +107,7 @@
// Tag interface
//-------------------------------------------------------------------------
- public void doTag(XMLOutput output) throws Exception {
+ public void doTag(XMLOutput output) throws JellyTagException {
Object answer = null;
if ( value != null ) {
answer = value.evaluate(context);
@@ -125,10 +126,10 @@
}
else {
if ( target == null ) {
- throw new JellyException( "Either a 'var' or a 'target' attribute must be defined for this tag" );
+ throw new JellyTagException( "Either a 'var' or a 'target' attribute must be defined for this tag" );
}
if ( property == null ) {
- throw new JellyException( "You must define a 'property' attribute if you specify a 'target'" );
+ throw new JellyTagException( "You must define a 'property' attribute if you specify a 'target'" );
}
setPropertyValue( target, property, answer );
}
1.4 +7 -6 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/SwitchTag.java
Index: SwitchTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/SwitchTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SwitchTag.java 11 Dec 2002 12:40:54 -0000 1.3
+++ SwitchTag.java 24 Jan 2003 22:53:34 -0000 1.4
@@ -61,6 +61,7 @@
*/
package org.apache.commons.jelly.tags.core;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.MissingAttributeException;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
@@ -96,7 +97,7 @@
this.on = on;
}
- public void doTag(XMLOutput output) throws Exception {
+ public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException {
if(null == on) {
throw new MissingAttributeException("on");
} else {
1.8 +8 -2 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/ThreadTag.java
Index: ThreadTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/ThreadTag.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ThreadTag.java 11 Dec 2002 12:40:54 -0000 1.7
+++ ThreadTag.java 24 Jan 2003 22:53:34 -0000 1.8
@@ -58,8 +58,10 @@
import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.UnsupportedEncodingException;
import org.apache.commons.jelly.JellyContext;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
@@ -80,10 +82,14 @@
// Tag interface
//-------------------------------------------------------------------------
- public void doTag(final XMLOutput output) throws Exception {
+ public void doTag(final XMLOutput output) throws JellyTagException {
if ( xmlOutput == null ) {
// lets default to system.out
- xmlOutput = XMLOutput.createXMLOutput( System.out );
+ try {
+ xmlOutput = XMLOutput.createXMLOutput( System.out );
+ } catch (UnsupportedEncodingException e) {
+ throw new JellyTagException(e);
+ }
}
// lets create a child context
1.9 +23 -17 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/UseBeanTag.java
Index: UseBeanTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/UseBeanTag.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- UseBeanTag.java 24 Jan 2003 10:04:33 -0000 1.8
+++ UseBeanTag.java 24 Jan 2003 22:53:34 -0000 1.9
@@ -62,6 +62,7 @@
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.jelly.JellyException;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.MissingAttributeException;
import org.apache.commons.jelly.MapTagSupport;
import org.apache.commons.jelly.XMLOutput;
@@ -112,21 +113,26 @@
// Tag interface
//-------------------------------------------------------------------------
- public void doTag(XMLOutput output) throws Exception {
+ public void doTag(XMLOutput output) throws JellyTagException {
Map attributes = getAttributes();
String var = (String) attributes.get( "var" );
Object classObject = attributes.remove( "class" );
- // this method could return null in derived classes
- Class theClass = convertToClass(classObject);
-
- this.bean = newInstance(theClass, attributes, output);
- setBeanProperties(bean, attributes);
-
- // invoke body which could result in other properties being set
- invokeBody(output);
+ try {
+ // this method could return null in derived classes
+ Class theClass = convertToClass(classObject);
+
+ this.bean = newInstance(theClass, attributes, output);
+ setBeanProperties(bean, attributes);
- processBean(var, bean);
+ // invoke body which could result in other properties being set
+ invokeBody(output);
+
+ processBean(var, bean);
+ }
+ catch (ClassNotFoundException e) {
+ throw new JellyTagException(e);
+ }
}
// Implementation methods
@@ -182,13 +188,13 @@
* Derived tags could do something different here.
*/
protected Object newInstance(Class theClass, Map attributes, XMLOutput output)
- throws JellyException {
+ throws JellyTagException {
try {
return theClass.newInstance();
} catch (IllegalAccessException e) {
- throw new JellyException(e.toString());
+ throw new JellyTagException(e.toString());
} catch (InstantiationException e) {
- throw new JellyException(e.toString());
+ throw new JellyTagException(e.toString());
}
}
@@ -196,13 +202,13 @@
* Sets the properties on the bean. Derived tags could implement some custom
* type conversion etc.
*/
- protected void setBeanProperties(Object bean, Map attributes) throws JellyException {
+ protected void setBeanProperties(Object bean, Map attributes) throws JellyTagException {
try {
BeanUtils.populate(bean, attributes);
} catch (IllegalAccessException e) {
- throw new JellyException("could not set the properties of the bean",e);
+ throw new JellyTagException("could not set the properties of the bean",e);
} catch (InvocationTargetException e) {
- throw new JellyException("could not set the properties of the bean",e);
+ throw new JellyTagException("could not set the properties of the bean",e);
}
}
@@ -211,7 +217,7 @@
* This Strategy method allows derived tags to process the beans in different ways
* such as to register this bean with its parent tag etc.
*/
- protected void processBean(String var, Object bean) throws JellyException {
+ protected void processBean(String var, Object bean) throws JellyTagException {
if (var != null) {
context.setVariable(var, bean);
} else {
1.7 +3 -2 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/UseListTag.java
Index: UseListTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/UseListTag.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- UseListTag.java 24 Jan 2003 10:04:33 -0000 1.6
+++ UseListTag.java 24 Jan 2003 22:53:34 -0000 1.7
@@ -62,6 +62,7 @@
import java.util.Map;
import org.apache.commons.jelly.JellyException;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.expression.Expression;
import org.apache.commons.jelly.impl.CollectionTag;
@@ -106,12 +107,12 @@
// Implementation methods
//-------------------------------------------------------------------------
- protected void setBeanProperties(Object bean, Map attributes) throws JellyException {
+ protected void setBeanProperties(Object bean, Map attributes) throws JellyTagException {
items = (Expression) attributes.remove("items");
super.setBeanProperties(bean, attributes);
}
- protected void processBean(String var, Object bean) throws JellyException {
+ protected void processBean(String var, Object bean) throws JellyTagException {
super.processBean(var, bean);
List list = getList();
1.11 +8 -7 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/WhenTag.java
Index: WhenTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/WhenTag.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- WhenTag.java 11 Dec 2002 12:40:54 -0000 1.10
+++ WhenTag.java 24 Jan 2003 22:53:34 -0000 1.11
@@ -62,6 +62,7 @@
package org.apache.commons.jelly.tags.core;
import org.apache.commons.jelly.JellyException;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
import org.apache.commons.jelly.expression.Expression;
@@ -81,10 +82,10 @@
// Tag interface
//-------------------------------------------------------------------------
- public void doTag(XMLOutput output) throws Exception {
+ public void doTag(XMLOutput output) throws JellyTagException {
ChooseTag tag = (ChooseTag) findAncestorWithClass( ChooseTag.class );
if ( tag == null ) {
- throw new JellyException( "This tag must be enclosed inside a <choose> tag" );
+ throw new JellyTagException( "This tag must be enclosed inside a <choose> tag" );
}
if ( ! tag.isBlockEvaluated() && test != null ) {
if ( test.evaluateAsBoolean( context ) ) {
1.6 +2 -2 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/WhileTag.java
Index: WhileTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/WhileTag.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- WhileTag.java 11 Dec 2002 12:40:54 -0000 1.5
+++ WhileTag.java 24 Jan 2003 22:53:34 -0000 1.6
@@ -62,6 +62,7 @@
package org.apache.commons.jelly.tags.core;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.MissingAttributeException;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
@@ -97,8 +98,7 @@
* @throws MissingAttributeException when the test attribute is missing
* @throws Exception for anything else
*/
- public void doTag(XMLOutput output) throws MissingAttributeException,
- Exception {
+ public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException {
if (test != null) {
try {
while (test.evaluateAsBoolean(getContext())) {
1.5 +2 -1 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/WhitespaceTag.java
Index: WhitespaceTag.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/WhitespaceTag.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- WhitespaceTag.java 11 Dec 2002 12:40:54 -0000 1.4
+++ WhitespaceTag.java 24 Jan 2003 22:53:34 -0000 1.5
@@ -61,6 +61,7 @@
*/
package org.apache.commons.jelly.tags.core;
+import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.jelly.XMLOutput;
import org.apache.commons.logging.Log;
@@ -84,7 +85,7 @@
// Tag interface
//-------------------------------------------------------------------------
- public void doTag(XMLOutput output) throws Exception {
+ public void doTag(XMLOutput output) throws JellyTagException {
if ( log.isDebugEnabled() ) {
log.debug( "Running body: " + getBody() );
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>