public String getFullMessage() {
Throwable cause = getCause();
String separator = System.getProperty("file.separator");
if (cause instanceof RhinoException) {
RhinoException re = (RhinoException) cause;
StringWriter buf = new StringWriter();
PrintWriter writer = new PrintWriter(buf);
if (re instanceof WrappedException) {
// Make sure we're not printing the "Wrapped ...Exception:" part
writer.println(((WrappedException) re).getWrappedException()
.getMessage());
} else {
writer.println(re.details());
}
String[] stackTrace = re.getScriptStackTrace().split("\\r\\n|\\n|\\r");
String sourceName = re.sourceName();
if (sourceName != null) {
int lineNumber = re.lineNumber();
// Report sourceName / lineNumber if it is not in the stack
// trace already.
// TODO Why is this needed? Rhino bug?
if (stackTrace.length == 0 || stackTrace[0].indexOf(
sourceName + ":" + lineNumber) == -1) {