You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Daniel Kulp (JIRA)" <ji...@apache.org> on 2010/04/12 04:39:42 UTC

[jira] Assigned: (CXF-2761) JavaScript variable "item" wont be reinitialized

     [ https://issues.apache.org/jira/browse/CXF-2761?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp reassigned CXF-2761:
--------------------------------

    Assignee: Daniel Kulp

> JavaScript variable "item" wont be reinitialized
> ------------------------------------------------
>
>                 Key: CXF-2761
>                 URL: https://issues.apache.org/jira/browse/CXF-2761
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.2.7
>         Environment: Mac OS X
>            Reporter: Björn Häuser
>            Assignee: Daniel Kulp
>
> Take a look at the generated JS-Code, and especially at the variable item.
> {noformat}
> function ws_ejb_core_lunchroulette_de__userGetMeetingpoints_deserialize (cxfjsutils, element) {
>     var newobject = new ws_ejb_core_lunchroulette_de__userGetMeetingpoints();
>     cxfjsutils.trace('element: ' + cxfjsutils.traceElementName(element));
>     var curElement = cxfjsutils.getFirstElementChild(element);
>     var item;
>     cxfjsutils.trace('curElement: ' + cxfjsutils.traceElementName(curElement));
>     cxfjsutils.trace('processing session');
>     var value = null;
>     if (!cxfjsutils.isElementNil(curElement)) {
>      value = cxfjsutils.getNodeText(curElement);
>      item = value;
>     }
>     newobject.setSession(item);
>     if (curElement != null) {
>      curElement = cxfjsutils.getNextElementSibling(curElement);
>     }
>     cxfjsutils.trace('curElement: ' + cxfjsutils.traceElementName(curElement));
>     cxfjsutils.trace('processing filter');
>     var value = null;
>     if (!cxfjsutils.isElementNil(curElement)) {
>      item = ws_ejb_core_lunchroulette_de__filter_deserialize(cxfjsutils, curElement);
>     }
>     newobject.setFilter(item);
>     if (curElement != null) {
>      curElement = cxfjsutils.getNextElementSibling(curElement);
>     }
>     return newobject;
> }
> {noformat}
> It is possible that item is filled with the value of the first "element" and not changed for the second element, and so the second vlement will get the value for the first element.
> Easy fix (in my opinion):
> {noformat}
>         utils.appendLine("newobject." + accessorName + "(item);");
>         utils.appendLine("var item = null;");
>         if (!itemInfo.isArray()) {
>             utils.startIf("curElement != null");
>             utils.appendLine("curElement = cxfjsutils.getNextElementSibling(curElement);");
>             utils.endBlock();
>         }
> {noformat}
> Line 661 and following in SchemaJavascriptBuilder.java.
> Thanks in advance,
> Björn

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira