Skip to content

Commit

Permalink
Try toString but catch exception in getVariableValues.
Browse files Browse the repository at this point in the history
  • Loading branch information
srogmann committed Jul 11, 2021
1 parent b2c20b9 commit 12979fb
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/main/java/org/rogmann/jsmud/ClassRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -814,9 +814,19 @@ public List<VMValue> getVariableValues(MethodFrame methodFrame, List<SlotRequest
final Object value = MethodFrame.convertJvmTypeIntoFieldType(eTag.getClassTag(), valueJvm);
final Tag tagReply;
if (LOG.isDebugEnabled()) {
String sValue = null;
if (value != null) {
try {
sValue = value.toString();
} catch (Exception e) {
// e.g. proxy which doesn't implement toString().
sValue = String.format("instance of (%s) without toString: %s",
value.getClass(), e);
}
}
LOG.debug(String.format("getVariableValues: method=%s, slot=%d, value=%s",
methodFrame.getMethod().getName(), Integer.valueOf(slot),
value));
sValue));
}
if (value instanceof String) {
tagReply = Tag.STRING;
Expand Down

0 comments on commit 12979fb

Please sign in to comment.