myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Aranda <brunoara...@gmail.com>
Subject Bug in _AjaxUtils - subBuf undefined
Date Mon, 12 Jul 2010 12:01:10 GMT
Hi,

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?

Cheers,

Bruno

Mime
View raw message