myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Werner Punz (JIRA)" <...@myfaces.apache.org>
Subject [jira] Created: (MYFACES-2810) jsf.js npe in user reported case
Date Mon, 12 Jul 2010 12:07:49 GMT
jsf.js npe in user reported case
--------------------------------

                 Key: MYFACES-2810
                 URL: https://issues.apache.org/jira/browse/MYFACES-2810
             Project: MyFaces Core
          Issue Type: Bug
            Reporter: Werner Punz


Following came in from Markus B├╝ttner from the users list:

<h:form id="myForm">
<h:selectOneMenu id="selectMenu" value="#{myBean.menuValue}"
valueChangeListener="#{myBean.menuValueChangedListener}">
<f:selectItem itemValue="true" itemLabel="Yes"/>
<f:selectItem itemValue="false" itemLabel="No"/>
<f:ajax event="change" render="output"/>
</h:selectOneMenu>
<h:outputText id="output" value="#{myBean.menuValue}"/>
<h:commandButton action="action"/>
</h:form> 


Switching from no to yes works, but switching from yes to no causes the
following error messages in browser (firefox) and no request is send to
server:

clientError-TypeError-MyFaces ERROR:Affected Class:
myfaces._impl.xhrCore._AjaxUtils
Affected Method: encodeSubmittableFields
Error name: TypeError
Error message: subBuf is undefined
Error description: undefined
Error number: undefined
Error line number: 3380
- Note, this message is only sent, because project stage is development
and no other error listeners are registered.

The message in IE8:

lientError-TypeError-MyFaces ERROR:Affected Class:
myfaces._impl.xhrCore._AjaxUtils
Affected Method: encodeSubmittableFields
Error name: TypeError
Error message: 'undefined' ist Null oder kein Object
Error description: 'undefined' ist Null oder kein Object
Error number: -2146823281
Error line number: undefined
- Note, this message is only sent, because project stage is development
and no other error listeners are registered.

I tried to use boolean, String an enum Types for Value. But always the
same error. 


This is probably also the same bug Bruno Aranda has reported:

I think a bug was introduced in the revision 960856 last 6th of July,
in the _AjaxUtils class. A variable is initialized inside a loop, but
is accessed outside. If the loop contains no values, the variable will
be left undefined. This is the code, lines 196-207:

if (element.options[u].selected) {
                            var subBuf = [];
                            var elementOption = element.options[u];
                            subBuf.push(encodeURIComponent(name));
                            subBuf.push("=");
                            if (elementOption.getAttribute("value") != null) {

subBuf.push(encodeURIComponent(elementOption.value));
                            } else {

subBuf.push(encodeURIComponent(elementOption.text));
                            }

                        }  strBuf.push(subBuf.join(""));

subBuf is accessed outside the loop, but initialized inside. If there
are no "options selected", subBuf will throw an 'undefined' javascript
exception. I guess that subBuf should be initialized outside the loop?



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message