[ http://issues.apache.org/jira/browse/MYFACES-187?page=comments#action_66217 ] Howard Abrams commented on MYFACES-187: ---------------------------------------
It seems there are 2 discrepancies with your comment above: 1. This does not behave the way the 1.1_1 RI does; that is how I found the bug in the first place. 2. If MyFaces needs to behave this way, why didn't any of the automated tests fail after this patch was submitted? I'm not sure how much more thorough information I can put into this issue. The comment from Martin Zdila contains a test case (you just need to turn his words into JSP). My original description explains the logical path through the code and in what situation getValue() will return the value from the value binding even though setValue() was called with a different value (because it is set to null, not "") I'm not trying to be difficult, I want to help... just let me know how. Perhaps you could explain why this code is needed? It seems validateValue() already checks for "", so it's not clear what forcing it to null in validate() accomplishes. Perhaps your statement was based on the code before 'validateValue' was added? > UIInput.getValue can return wrong (old) value > --------------------------------------------- > > Key: MYFACES-187 > URL: http://issues.apache.org/jira/browse/MYFACES-187 > Project: MyFaces > Type: Bug > Versions: 1.0.9 beta > Reporter: Howard Abrams > Assignee: Martin Marinschek > Fix For: Nightly Build > > 'UIInput.getValue' will return the wrong (old) value if called between > validation and update phase when the submitted value is "" and the old value > was a non-zero length string. > The offending code is in UIInput.validate: > if(submittedValue instanceof String && ((String) > submittedValue).length()==0) > { > submittedValue = null; > } > The effect of this is that when the client submits "", the submittedValue of > null works it's way down to 'setValue'. This would seem correct, but > 'getValue' checks to see if the value is null, and if it is, it uses the > value binding. The end result is that 'getValue' will return the wrong (old) > value if called between validation and update phase becuase the model has not > been updated yet, but the local value has been null'd. > Neither the spec, nor the offical JavaDoc mention this behavior. I belive the > code should be removed. Anyone know why it is there? -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
