diff --git a/src/java/com/samskivert/util/StringUtil.java b/src/java/com/samskivert/util/StringUtil.java index ecc2c167..13089dcf 100644 --- a/src/java/com/samskivert/util/StringUtil.java +++ b/src/java/com/samskivert/util/StringUtil.java @@ -276,6 +276,19 @@ public class StringUtil return _ffmt.format(value); } + /** + * Get the message in the specified throwable, or the short class + * name if there is no message. + */ + public static String getMessage (Throwable t) + { + String msg = t.getMessage(); + if (msg == null) { + msg = shortClassName(t); + } + return msg; + } + /** * Converts the supplied object to a string. Normally this is * accomplished via the object's built in toString()