src/main/java/org/jmxtrans/agent/util/StringUtils2.java
@Nonnull
    public static String trimToEmpty(@Nullable String str) {
        if (str == null) {
            return "";
        } else {
            return str.trim();
        }
    }
@Nonnull
    public static String trimToEmpty(@Nullable String str) {
        if (str == null) {
            return "";
        } else {
            return str.trim();
        }
    }
if the given string is {@code null}, return {@code ""}, else return {@link String#trim()}.

@param str the string to trim
@return the trimmed string