Skip to content

Commit

Permalink
Use Objects.requireNonNull()
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Dec 26, 2024
1 parent 8f94dce commit 1cd16da
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.apache.commons.vfs2.filter;

import java.io.File;
import java.util.Objects;

/**
* Enumeration of IO case sensitivity.
Expand Down Expand Up @@ -112,9 +113,8 @@ public static IOCase forName(final String name) {
* @throws NullPointerException if either string is null
*/
public int checkCompareTo(final String str1, final String str2) {
if (str1 == null || str2 == null) {
throw new NullPointerException("The strings must not be null");
}
Objects.requireNonNull(str1, "str1");
Objects.requireNonNull(str2, "str2");
return sensitive ? str1.compareTo(str2) : str1.compareToIgnoreCase(str2);
}

Expand Down

0 comments on commit 1cd16da

Please sign in to comment.