Skip to content

Commit 02c95cd

Browse files
committed
Fix Issue # 195 : BaseValidationRule.assertValid(String context, String input) causes NPE if input is not valid.
Made changes as required, also getvalid(string,string) should be called instead. Could not test the changes. Let me know if the error persists. Contact : [email protected]
1 parent 95d85be commit 02c95cd

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/java/org/owasp/esapi/reference/validation/BaseValidationRule.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public final void setEncoder( Encoder encoder ) {
8989
* {@inheritDoc}
9090
*/
9191
public void assertValid( String context, String input ) throws ValidationException {
92-
getValid( context, input, null );
92+
getValid( context, input );
9393
}
9494

9595
/**
@@ -100,7 +100,11 @@ public Object getValid( String context, String input, ValidationErrorList errorL
100100
try {
101101
valid = getValid( context, input );
102102
} catch (ValidationException e) {
103-
errorList.addError(context, e);
103+
if( errorList == null {
104+
throw e;
105+
} else {
106+
errorList.addError(context, e);
107+
}
104108
}
105109
return valid;
106110
}

0 commit comments

Comments
 (0)