Move utility method to CommonUtils

This commit is contained in:
Matt Drees 2018-07-24 08:35:18 -06:00
parent ba5982e1eb
commit 40dcc8b34a
2 changed files with 12 additions and 5 deletions

View File

@ -189,11 +189,7 @@ public final class SingleSignOutHandler {
}
private String getPath(HttpServletRequest request) {
return request.getServletPath() + nullToEmpty(request.getPathInfo());
}
private String nullToEmpty(String string) {
return string == null ? "" : string;
return request.getServletPath() + CommonUtils.nullToEmpty(request.getPathInfo());
}
/**

View File

@ -719,4 +719,15 @@ public final class CommonUtils {
}
}
/**
* Returns the string as-is, unless it's <code>null</code>;
* in this case an empty string is returned.
*
* @param string a possibly <code>null</code> string
* @return a non-<code>null</code> string
*/
public static String nullToEmpty(String string) {
return string == null ? "" : string;
}
}