Validatino of Indexed Properties Incorrectly Flags Required Fields When No 
Indexed Properties Submitted
-------------------------------------------------------------------------------------------------------

                 Key: STS-904
                 URL: http://www.stripesframework.org/jira/browse/STS-904
             Project: Stripes
          Issue Type: Bug
          Components: Validation
    Affects Versions: Release 1.5.7
         Environment: Windows, Tomcat 6, Java 6
            Reporter: Ryan Asleson
         Attachments: stripes-indexed-properties.zip

I know the summary isn't very clear, so here is what I see happening:  
According to the Stripes online documentation:

"Required field validations are only applied if at least one value with the 
same index was supplied."

In my case, I am not submitting ANY values with any indexes, however, Stripes 
is reporting validation messages for the fields that are marked as required.

To put it another way:  Say for example I have a List of Person objects on the 
ActionBean named persons.  On the ActionBean, the "List<Person> persons" is 
annotated so that the firstName property of the Person objects within the List 
is required.

If the form submits something like this:

persons[0].firstName=
persons[0].lastName=

Then Stripes will NOT show a "required" error message for firstName, because 
all of the values with the same index are empty.

However, if the form submits WITHOUT any indexed properties for persons, it is 
showing a required error message for firstName, which I'm guessing is not the 
intended behavior... at least I hope not!

Also, related to the above, if a required indexed property is marked as 
encrypted and no values are sent, a NullPointerException on line 494 of 
DefaultActionBeanPropertyBinder is is thrown.  I'm pretty sure that's not the 
intended behavior!

See the attached zip file.  It's a project that you can build and deploy to 
Tomcat that shows the errors and issues I'm seeing.  It's a NetBeans project so 
if you use NetBeans you can open the project right in NetBeans.  Otherwise, 
open it in your favorite IDE and run the "dist" task from build.xml to build a 
war file you can deploy.

Once you deploy, go to the /sip/MyTest.action page, and run the examples from 
there.

As I say in index.jsp, I think the problem stems from the fact that Stripes 
doesn't "know" that certain properties are indexed properties unless the 
indexed property names are submitted with the form.  But shouldn't Stripes know 
what's indexed by looking at the validation annotations and determining which 
properties contain Lists?


-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to