fusioncop / owasp-esapi-java

Automatically exported from code.google.com/p/owasp-esapi-java
Other
0 stars 0 forks source link

Validator.getValidInput returns null for empty string #243

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Call Validator.getValidInput("myContext", "", "myType", 100, true).

What is the expected output? What do you see instead?
The javadoc mentions for the allowNull parameter: "allowNull - If allowNull is 
true then an input that is NULL or an empty string will be legal. If allowNull 
is false then NULL or an empty String will throw a ValidationException." 
Reading this, I would expect that the empty string input is legal and that I 
get it returned from the call. However, I get a null value back.
Was this on purpose? What would be the reason behind this?

What version of the product are you using? On what operating system?
2.0GA

Does this issue affect only a specified browser or set of browsers?
No.

Please provide any additional information below.
Location of the code:
StringValidationRule.java, line 272, there is the following code:
    // check for empty/null
    if(checkEmpty(context, input) == null)
        return null;

Original issue reported on code.google.com by Dries.h...@gmail.com on 24 Aug 2011 at 8:50