Return-Path: Delivered-To: apmail-cxf-issues-archive@www.apache.org Received: (qmail 21298 invoked from network); 11 Apr 2010 17:48:53 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 11 Apr 2010 17:48:53 -0000 Received: (qmail 94811 invoked by uid 500); 11 Apr 2010 17:48:53 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 94790 invoked by uid 500); 11 Apr 2010 17:48:53 -0000 Mailing-List: contact issues-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list issues@cxf.apache.org Received: (qmail 94782 invoked by uid 99); 11 Apr 2010 17:48:53 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 11 Apr 2010 17:48:53 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 11 Apr 2010 17:48:50 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o3BHgf1E012493 for ; Sun, 11 Apr 2010 13:42:41 -0400 (EDT) Message-ID: <25190750.11591271007761199.JavaMail.jira@thor> Date: Sun, 11 Apr 2010 13:42:41 -0400 (EDT) From: =?utf-8?Q?Bj=C3=B6rn_H=C3=A4user_=28JIRA=29?= To: issues@cxf.apache.org Subject: [jira] Created: (CXF-2761) JavaScript variable "item" wont be reinitialized MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org 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=C3=B6rn H=C3=A4user Take a look at the generated JS-Code, and especially at the variable item. {noformat} function ws_ejb_core_lunchroulette_de__userGetMeetingpoints_deserialize (cx= fjsutils, element) { var newobject =3D new ws_ejb_core_lunchroulette_de__userGetMeetingpoint= s(); cxfjsutils.trace('element: ' + cxfjsutils.traceElementName(element)); var curElement =3D cxfjsutils.getFirstElementChild(element); var item; cxfjsutils.trace('curElement: ' + cxfjsutils.traceElementName(curElemen= t)); cxfjsutils.trace('processing session'); var value =3D null; if (!cxfjsutils.isElementNil(curElement)) { value =3D cxfjsutils.getNodeText(curElement); item =3D value; } newobject.setSession(item); if (curElement !=3D null) { curElement =3D cxfjsutils.getNextElementSibling(curElement); } cxfjsutils.trace('curElement: ' + cxfjsutils.traceElementName(curElemen= t)); cxfjsutils.trace('processing filter'); var value =3D null; if (!cxfjsutils.isElementNil(curElement)) { item =3D ws_ejb_core_lunchroulette_de__filter_deserialize(cxfjsutils, = curElement); } newobject.setFilter(item); if (curElement !=3D null) { curElement =3D cxfjsutils.getNextElementSibling(curElement); } return newobject; } {noformat} It is possible that item is filled with the value of the first "element" an= d not changed for the second element, and so the second vlement will get th= e value for the first element. Easy fix (in my opinion): {noformat} utils.appendLine("newobject." + accessorName + "(item);"); utils.appendLine("var item =3D null;"); if (!itemInfo.isArray()) { utils.startIf("curElement !=3D null"); utils.appendLine("curElement =3D cxfjsutils.getNextElementSibli= ng(curElement);"); utils.endBlock(); } {noformat} Line 661 and following in SchemaJavascriptBuilder.java. Thanks in advance, Bj=C3=B6rn --=20 This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: htt= ps://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira