String msg = "";
if ("com.ibm.xsp.exception.EvaluationExceptionEx".equals(error.getClass().getName())) {
// EvaluationExceptionEx, so SSJS error is on a component property.
// Hit by ErrorOnLoad.xsp
EvaluationExceptionEx ee = (EvaluationExceptionEx) error;
InterpretException ie = (InterpretException) ee.getCause();
msg = "Error on " + ee.getErrorComponentId() + " " + ee.getErrorPropertyId() + " property/event, line "
+ Integer.toString(ie.getErrorLine()) + ":\n\n" + ie.getLocalizedMessage() + "\n\n" + ie.getExpressionText();
XspOpenLogUtil.getXspOpenLogItem().logErrorEx(ee, msg, null, null);
} else if ("javax.faces.FacesException".equals(error.getClass().getName())) {
// FacesException, so error is on event or method in EL
FacesException fe = (FacesException) error;
InterpretException ie = null;
EvaluationExceptionEx ee = null;
msg = "Error on ";
try {
// javax.faces.el.MethodNotFoundException hit by ErrorOnMethod.xsp
if (!"javax.faces.el.MethodNotFoundException".equals(fe.getCause().getClass().getName())) {
if ("com.ibm.xsp.exception.EvaluationExceptionEx".equals(fe.getCause().getClass().getName())) {
// Hit by ErrorOnClick.xsp
ee = (EvaluationExceptionEx) fe.getCause();
} else if ("javax.faces.el.PropertyNotFoundException".equals(fe.getCause().getClass().getName())) {
// Property not found exception, so error is on a component property
msg = "PropertyNotFoundException Error, cannot locate component:\n\n";
} else if ("com.ibm.xsp.exception.EvaluationExceptionEx".equals(fe.getCause().getCause().getClass().getName())) {
// Hit by using e.g. currentDocument.isNewDoc()
// i.e. using a Variable that relates to a valid Java object but a method that doesn't exist
ee = (EvaluationExceptionEx) fe.getCause().getCause();
}
if (null != ee) {
msg = msg + ee.getErrorComponentId() + " " + ee.getErrorPropertyId() + " property/event:\n\n";
if ("com.ibm.jscript.InterpretException".equals(ee.getCause().getClass().getName())) {
ie = (InterpretException) ee.getCause();
}
}
}
} catch (Throwable t) {
msg = "Unexpected error class: " + fe.getCause().getClass().getName() + "\n Message recorded is: ";
}
if (null != ie) {
msg = msg + Integer.toString(ie.getErrorLine()) + ":\n\n" + ie.getLocalizedMessage() + "\n\n" + ie.getExpressionText();
} else {
msg = msg + fe.getCause().getLocalizedMessage();
}
XspOpenLogUtil.getXspOpenLogItem().logErrorEx(fe.getCause(), msg, null, null);
} else if ("com.ibm.xsp.FacesExceptionEx".equals(error.getClass().getName())) {
// FacesException, so error is on event - doesn't get hit in examples. Can this still get hit??
FacesExceptionEx fe = (FacesExceptionEx) error;
try {
if ("lotus.domino.NotesException".equals(fe.getCause().getClass().getName())) {
// sometimes the cause is a NotesException
NotesException ne = (NotesException) fe.getCause();
msg = msg + "NotesException - " + Integer.toString(ne.id) + " " + ne.text;
} else if ("java.io.IOException".equals(error.getClass().getName())) {
IOException e = (IOException) error;
msg = "Java IO:" + error.toString();
XspOpenLogUtil.getXspOpenLogItem().logErrorEx(e.getCause(), msg, null, null);
} else {
EvaluationExceptionEx ee = (EvaluationExceptionEx) fe.getCause();
InterpretException ie = (InterpretException) ee.getCause();
msg = "Error on " + ee.getErrorComponentId() + " " + ee.getErrorPropertyId() + " property/event:\n\n"
+ Integer.toString(ie.getErrorLine()) + ":\n\n" + ie.getLocalizedMessage() + "\n\n" + ie.getExpressionText();
}
} catch (Throwable t) {
msg = "Unexpected error class: " + fe.getCause().getClass().getName() + "\n Message recorded is: "
+ fe.getCause().getLocalizedMessage();
;