You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Bruno Aranda <br...@gmail.com> on 2010/07/12 14:01:10 UTC
Bug in _AjaxUtils - subBuf undefined
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
Re: Bug in _AjaxUtils - subBuf undefined
Posted by Werner Punz <we...@gmail.com>.
Hi, same problem as Markus Büttner reported.
I am on it currently. A bug introduced during my performance fixing last
week, sorry about that and thanks for reporting it. It is vital to get
the bugs out before 2.0.1.
Werner
Am 12.07.10 14:01, schrieb Bruno Aranda:
> 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(""));