Skip to content

Commit

Permalink
Do not fail to assemble a proper stack trace if there is a bad hashCo…
Browse files Browse the repository at this point in the history
…de() method
  • Loading branch information
dmlloyd committed Feb 3, 2012
1 parent beb0184 commit 62095b0
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,12 @@ public static void addFieldInformation(Throwable t, String fieldName) {
public static void addObjectInformation(Throwable t, Object targetObject) {
final TraceInformation ti = getOrAddTraceInformation(t);
final String targetClassName = getNiceClassName(targetObject.getClass());
final int targetHashCode = targetObject.hashCode();
int targetHashCode = 0;
try {
targetHashCode = targetObject.hashCode();
} catch (Throwable ignored) {
// guess we won't know the hash code!
}
final Info oldInfo = ti.info;
ti.info = new ObjectInfo(oldInfo, targetClassName, targetHashCode);
}
Expand Down

0 comments on commit 62095b0

Please sign in to comment.