}
seb.pack();
} catch (TransformerConfigurationException e) {
String msg = "Error creating TransformerHandler: " + e.getMessage();
logger.error(msg, e);
throw new CannotExecuteException (msg);
} catch (SAXException se) {
String msg = "Error during transformation: " + se.getMessage();
logger.error (msg, se);
throw new CannotExecuteException (msg);
}
if (logger.isDebugEnabled()) {
logTransformationResult (seb);
}
// assemble the result, do additional mapping
Map resData = new HashMap ();
Document jdomRes = null;
for (int i = 0; i < formPars.length; i++) {
if (logger.isDebugEnabled()) {
logger.debug("formPars[i].id() = " + formPars[i].id());
logger.debug("formPars[i].type() = " + formPars[i].type());
logger.debug("formPars[i].mode() = " + formPars[i].mode());
}
if (formPars[i].mode() == FormalParameter.Mode.IN) {
continue;
}
XPath path = (XPath)returnParamInfo.get(formPars[i].id());
if (logger.isDebugEnabled()) {
logger.debug("path = " + path);
}
if (path == null) {
resData.put(formPars[i].id(), seb);
continue;
}
// Handle path expression
if (jdomRes == null) {
try {
SAXHandler hdlr = new SAXHandler ();
seb.emit (hdlr);
jdomRes = hdlr.getDocument();
} catch (SAXException e) {
String msg = "Problem converting SAX to JDOM: "
+ e.getMessage ();
logger.error (msg, e);
throw new CannotExecuteException (msg);
}
}
if (formPars[i].type().equals(String.class)) {
String value = path.stringValueOf(jdomRes);
if (logger.isDebugEnabled()) {
logger.debug("value = " + value);
}
resData.put(formPars[i].id(), value);
} else if (formPars[i].type().equals(Date.class)) {
String sval = path.stringValueOf(jdomRes);
try {
Date value = XMLUtil.parseXsdDateTime(sval);
if (logger.isDebugEnabled()) {
logger.debug("value = " + value);
}
resData.put(formPars[i].id(), value);
} catch (ParseException e) {
throw (CannotExecuteException)
(new CannotExecuteException
("Problem parsing " + sval + " as xsd datetime: "
+ e.getMessage())).initCause(e);
}
} else if (formPars[i].type().equals(Double.class)) {
String sval = path.stringValueOf(jdomRes);
try {
double value = XMLUtil.parseXsdDouble(sval);
if (logger.isDebugEnabled()) {
logger.debug("value = " + value);
}
resData.put(formPars[i].id(), new Double(value));
} catch (NumberFormatException e) {
throw (CannotExecuteException)
(new CannotExecuteException
("Problem parsing " + sval + " as xsd double: "
+ e.getMessage())).initCause(e);
}
} else if (formPars[i].type().equals(Boolean.class)) {
String sval = path.stringValueOf(jdomRes);
try {
boolean value = XMLUtil.parseXsdBoolean(sval);
if (logger.isDebugEnabled()) {
logger.debug("value = " + value);
}
resData.put(formPars[i].id(), new Boolean(value));
} catch (ParseException e) {
throw (CannotExecuteException)
(new CannotExecuteException
("Problem parsing " + sval + " as xsd boolean: "
+ e.getMessage())).initCause(e);
}
} else if ((formPars[i].type() instanceof Class)
&& Number.class.isAssignableFrom