Update of /var/cvs/src/org/mmbase/util/functions
In directory james.mmbase.org:/tmp/cvs-serv27811
Modified Files:
BeanFunction.java
Log Message:
small try-catch block allows for clearer exceptions
See also: http://cvs.mmbase.org/viewcvs/src/org/mmbase/util/functions
Index: BeanFunction.java
===================================================================
RCS file: /var/cvs/src/org/mmbase/util/functions/BeanFunction.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- BeanFunction.java 10 Feb 2009 15:33:19 -0000 1.29
+++ BeanFunction.java 10 Feb 2009 15:42:21 -0000 1.30
@@ -27,7 +27,7 @@
* delegates to a static method in this class).
*
* @author Michiel Meeuwissen
- * @version $Id: BeanFunction.java,v 1.29 2009/02/10 15:33:19 michiel Exp $
+ * @version $Id: BeanFunction.java,v 1.30 2009/02/10 15:42:21 michiel Exp $
* @see org.mmbase.util.functions.MethodFunction
* @see org.mmbase.util.functions.FunctionFactory
* @since MMBase-1.8
@@ -262,7 +262,6 @@
* Instantiates the bean, calls all setters using the parameters, and
executes the method associated with this function.
*/
public Object getFunctionValue(Parameters parameters) {
- try {
Object b = getProducer().getInstance();
int count = 0;
Iterator<?> i = parameters.iterator();
@@ -270,6 +269,7 @@
while(i.hasNext() && j.hasNext()) {
Object value = i.next();
Method setter = j.next();
+ try {
if (value == null) {
if (setter.getParameterTypes()[0].isPrimitive()) {
log.debug("Tried to sed null in in primitive setter
method");
@@ -283,8 +283,12 @@
setter.invoke(b, value);
}
count++;
+ } catch (Exception e) {
+ throw new RuntimeException("" + setter + " value: " + value +
" " + e.getMessage(), e);
+ }
}
+ try {
Object ret = method.invoke(b);
return ret;
} catch (Exception e) {
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs