Skip to content

Commit ece2dd3

Browse files
Updating ESAPI util for ExplictMethod verify
Updating parameter null check to test null case. Removing null check on property result (if null ConfigurationException is thrown). Simplifying return from method to verify response is not empty.
1 parent c12a3e9 commit ece2dd3

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

src/main/java/org/owasp/esapi/ESAPI.java

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ public static void override( SecurityConfiguration config ) {
265265
* otherwise {@code false} is returned.
266266
*/
267267
public static boolean isMethodExplicityEnabled(String fullyQualifiedMethodName) {
268-
if ( fullyQualifiedMethodName != null && fullyQualifiedMethodName.trim().isEmpty() ) {
268+
if ( fullyQualifiedMethodName == null || fullyQualifiedMethodName.trim().isEmpty() ) {
269269
throw new IllegalArgumentException("Program error: fullyQualifiedMethodName parameter cannot be null or empty");
270270
}
271271
String desiredMethodName = fullyQualifiedMethodName.trim();
@@ -286,10 +286,6 @@ public static boolean isMethodExplicityEnabled(String fullyQualifiedMethodName)
286286
return false; // Property not found at all.
287287
}
288288

289-
if ( enabledMethods == null || enabledMethods.trim().isEmpty() ) {
290-
// TODO: Log something here? Maybe at DEBUG level?
291-
return false; // No methods in the list, so no match possible.
292-
}
293289

294290
// Split it up by ',' and then filter it by finding the first on that
295291
// matches the desired method name passed in as the method parameter.
@@ -298,11 +294,6 @@ public static boolean isMethodExplicityEnabled(String fullyQualifiedMethodName)
298294
.filter(methodName -> methodName.trim().equals( desiredMethodName ) )
299295
.findFirst()
300296
.orElse("");
301-
302-
if ( result.isEmpty() ) {
303-
return false; // No match, so method not enabled
304-
} else {
305-
return true; // Method found, thus enabled
306-
}
297+
return !result.isEmpty();
307298
}
308299
}

0 commit comments

Comments
 (0)