1 package net.jaekl.cfb.util;
3 // Copyright (C) 2015 Christian Jaekl
5 import java.io.PrintWriter;
6 import java.io.StringWriter;
9 public static String stringify(Throwable thr)
11 StringWriter sw = new StringWriter();
12 PrintWriter pw = new PrintWriter(sw);
13 thr.printStackTrace(pw);
17 // Test for equality, while taking care to avoid
18 // dereferencing a null pointer.
19 // Note that two null pointers are considered equal.
20 public static boolean objsAreEqual(Object a, Object b)
22 if ((null == a) || (null == b)) {
29 // Return 1 if obj is null, or obj.hashCode() otherwise
30 public static int objHashCode(Object obj)
35 return obj.hashCode();