Added getExceptionMessage() utility method.

This commit is contained in:
nathan 2017-08-14 14:27:34 +02:00
parent 2f9a0da32f
commit 36c53f2bc9
1 changed files with 15 additions and 0 deletions

View File

@ -302,6 +302,21 @@ class OS {
.availableProcessors() - 2, 1);
}
/**
* @return the first line of the exception message from 'throwable'
*/
public static
String getExceptionMessage(final Throwable throwable) {
String message = throwable.getMessage();
int index = message.indexOf(OS.LINE_SEPARATOR);
if (index > -1) {
message = message.substring(0, index);
}
return message;
}
@Override
public final
Object clone() throws java.lang.CloneNotSupportedException {