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:
@@ -276,6 +276,19 @@ public class StringUtil
|
|||||||
return _ffmt.format(value);
|
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
|
* Converts the supplied object to a string. Normally this is
|
||||||
* accomplished via the object's built in <code>toString()</code>
|
* accomplished via the object's built in <code>toString()</code>
|
||||||
|
|||||||
Reference in New Issue
Block a user