Added a convenience method to get the message of a Throwable, or the

class name if the message is null.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1875 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
ray
2006-07-12 23:56:00 +00:00
parent fd7c4d98eb
commit 78a832b7f9
@@ -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 <code>toString()</code>