Fehlerkorrektur im CLI-Servlet

This commit is contained in:
Peter Hormanns 2011-05-19 12:31:34 +00:00
parent 23bcbfb199
commit a89989b1fd

View File

@ -123,23 +123,23 @@ public class CLIClientConnectorServlet extends HttpServlet {
String type = m[j].getParameterTypes()[0].getCanonicalName();
try {
if (type.equals("java.lang.String"))
m[j].invoke(o, value);
m[j].invoke(realO, value);
else if (type.equals("java.lang.Integer") || type.equals("int"))
m[j].invoke(o, Integer.parseInt(value));
m[j].invoke(realO, Integer.parseInt(value));
else if (type.equals("java.lang.Long") || type.equals("long"))
m[j].invoke(o, Long.parseLong(value));
m[j].invoke(realO, Long.parseLong(value));
else if (type.equals("java.lang.Boolean") || type.equals("boolean"))
m[j].invoke(o, Boolean.valueOf(value));
m[j].invoke(realO, Boolean.valueOf(value));
else if (type.equals("java.util.Date")) {
DateFormat df = DateFormat.getInstance();
m[j].invoke(o, df.parse(value));
m[j].invoke(realO, df.parse(value));
} else {
Method m2 = module.getClass().getMethod(
"findByString", Class.class, String.class);
Object entity =
m2.invoke(module, m[j].getParameterTypes()[0], value);
if (entity != null)
m[j].invoke(o, entity);
m[j].invoke(realO, entity);
else
throw new BusinessException(
"not object found for '" + value + "'");