Commit cd1b0e1e authored by mevenson@1c010e3e-69d0-11dd-93a8-456734b0d56f's avatar mevenson@1c010e3e-69d0-11dd-93a8-456734b0d56f
Browse files

Signal Java-side exceptions caught in JavaObject.printObject() as a Lisp error.

From ferada on #abcl: toString() should be caught, otherwise abcl
just stops http://paste.lisp.org/display/140719.
parent 0d250c8c
......@@ -359,26 +359,30 @@ public final class JavaObject extends LispObject {
if (obj instanceof ControlTransfer)
return obj.toString();
final String s;
if(obj != null) {
if (obj != null) {
Class<?> c = obj.getClass();
StringBuilder sb
= new StringBuilder(c.isArray() ? "jarray" : c.getName());
sb.append(' ');
String ts = obj.toString();
int length = -1;
LispObject stringLength = _JAVA_OBJECT_TO_STRING_LENGTH.symbolValueNoThrow();
if (stringLength instanceof Fixnum) {
length = Fixnum.getValue(stringLength);
}
if (length < 0) {
sb.append(ts);
}else if (ts.length() > length) {
// use '....' to not confuse user with PPRINT conventions
sb.append(ts.substring(0, length)).append("....");
} else {
sb.append(ts);
}
s = sb.toString();
try {
String ts = obj.toString();
int length = -1;
LispObject stringLength = _JAVA_OBJECT_TO_STRING_LENGTH.symbolValueNoThrow();
if (stringLength instanceof Fixnum) {
length = Fixnum.getValue(stringLength);
}
if (length < 0) {
sb.append(ts);
} else if (ts.length() > length) {
// use '....' to not confuse user with PPRINT conventions
sb.append(ts.substring(0, length)).append("....");
} else {
sb.append(ts);
}
s = sb.toString();
} catch (Exception e) {
return serror(new JavaException(e));
}
} else {
s = "null";
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment