public static String trimMessage(String trace) {
        Matcher msgMatcher = MSG_PATTERN.matcher(trace);
        if (msgMatcher.find()) {
            return msgMatcher.replaceFirst("");
        }
        return trace;
    }
Utility method to trim the message from a stack trace
string.
<p>
E.g. <code>java.lang.IllegalStateException: Potential loop detected </code>
will be trimmed to <code>java.lang.IllegalStateException</code>

@param trace string view of stack trace
@return trimmed stack trace
tika-core/src/main/java/org/apache/tika/utils/ExceptionUtils.java