Use own validator ObjectUtils.anyNull to check null String input (#718)

This commit is contained in:
Arturo Bernal 2021-02-25 15:43:14 +01:00 committed by GitHub
parent ea34486551
commit 615c1dad1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -256,7 +256,7 @@ public static String removePattern(final String text, final String regex) {
* @see java.util.regex.Pattern
*/
public static String replaceAll(final String text, final Pattern regex, final String replacement) {
if (text == null || regex == null || replacement == null) {
if (ObjectUtils.anyNull(text, regex, replacement)) {
return text;
}
return regex.matcher(text).replaceAll(replacement);
@ -310,7 +310,7 @@ public static String replaceAll(final String text, final Pattern regex, final St
* @see java.util.regex.Pattern#DOTALL
*/
public static String replaceAll(final String text, final String regex, final String replacement) {
if (text == null || regex == null || replacement == null) {
if (ObjectUtils.anyNull(text, regex, replacement)) {
return text;
}
return text.replaceAll(regex, replacement);
@ -449,7 +449,7 @@ public static String replaceFirst(final String text, final String regex, final S
* @see Pattern#DOTALL
*/
public static String replacePattern(final String text, final String regex, final String replacement) {
if (text == null || regex == null || replacement == null) {
if (ObjectUtils.anyNull(text, regex, replacement)) {
return text;
}
return Pattern.compile(regex, Pattern.DOTALL).matcher(text).replaceAll(replacement);