bruno 2004/06/01 03:49:58
Modified: src/blocks/forms/java/org/apache/cocoon/forms/binding
AbstractCustomBinding.java CustomJXPathBinding.java
Log:
Let custom bindings throw any type of exception
Revision Changes Path
1.4 +12 -4
cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/binding/AbstractCustomBinding.java
Index: AbstractCustomBinding.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/binding/AbstractCustomBinding.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AbstractCustomBinding.java 1 May 2004 00:05:44 -0000 1.3
+++ AbstractCustomBinding.java 1 Jun 2004 10:49:58 -0000 1.4
@@ -50,7 +50,11 @@
* @throws BindingException
*/
public final void loadFormFromModel(Widget frmModel, Object objModel)
throws BindingException {
- doLoad(frmModel, (JXPathContext)objModel);
+ try {
+ doLoad(frmModel, (JXPathContext)objModel);
+ } catch (Exception e) {
+ throw new BindingException("Error executing custom binding", e);
+ }
}
/**
@@ -63,7 +67,11 @@
* @throws BindingException
*/
public final void saveFormToModel(Widget frmModel, Object objModel)
throws BindingException {
- doSave(frmModel, (JXPathContext)objModel);
+ try {
+ doSave(frmModel, (JXPathContext)objModel);
+ } catch (Exception e) {
+ throw new BindingException("Error executing custom binding", e);
+ }
}
/**
@@ -71,6 +79,6 @@
* @param frmModel
* @param context
*/
- protected abstract void doLoad(Widget frmModel, JXPathContext context)
throws BindingException;
- protected abstract void doSave(Widget frmModel, JXPathContext context)
throws BindingException;
+ protected abstract void doLoad(Widget frmModel, JXPathContext context)
throws Exception;
+ protected abstract void doSave(Widget frmModel, JXPathContext context)
throws Exception;
}
1.7 +2 -2
cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/binding/CustomJXPathBinding.java
Index: CustomJXPathBinding.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/binding/CustomJXPathBinding.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- CustomJXPathBinding.java 1 May 2004 00:05:44 -0000 1.6
+++ CustomJXPathBinding.java 1 Jun 2004 10:49:58 -0000 1.7
@@ -67,7 +67,7 @@
Widget selectedWidget = selectWidget(frmModel, this.widgetId);
JXPathContext context =
jxpc.getRelativeContext(jxpc.getPointer(this.xpath));
- this.wrappedBinding.doLoad(selectedWidget, context);
+ this.wrappedBinding.loadFormFromModel(selectedWidget, context);
}
/**
@@ -82,7 +82,7 @@
Widget selectedWidget = selectWidget(frmModel, this.widgetId);
JXPathContext context =
jxpc.getRelativeContext(jxpc.getPointer(this.xpath));
- this.wrappedBinding.doSave(selectedWidget, context);
+ this.wrappedBinding.saveFormToModel(selectedWidget, context);
}