Return-Path: Delivered-To: apmail-ws-axis-c-dev-archive@www.apache.org Received: (qmail 78990 invoked from network); 8 Nov 2007 23:45:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Nov 2007 23:45:14 -0000 Received: (qmail 23632 invoked by uid 500); 8 Nov 2007 23:44:59 -0000 Delivered-To: apmail-ws-axis-c-dev-archive@ws.apache.org Received: (qmail 23595 invoked by uid 500); 8 Nov 2007 23:44:59 -0000 Mailing-List: contact axis-c-dev-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: "Apache AXIS C Developers List" Reply-To: "Apache AXIS C Developers List" Delivered-To: mailing list axis-c-dev@ws.apache.org Received: (qmail 23536 invoked by uid 99); 8 Nov 2007 23:44:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Nov 2007 15:44:59 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Nov 2007 23:45:11 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id EC5F271423E for ; Thu, 8 Nov 2007 15:44:50 -0800 (PST) Message-ID: <27770905.1194565490965.JavaMail.jira@brutus> Date: Thu, 8 Nov 2007 15:44:50 -0800 (PST) From: "Michael Mole (JIRA)" To: axis-c-dev@ws.apache.org Subject: [jira] Commented: (AXIS2C-753) Program crashes if optional elements are not provided In-Reply-To: <26484804.1194275210813.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/AXIS2C-753?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12541179 ] Michael Mole commented on AXIS2C-753: ------------------------------------- I looked at CADBBeanTemplateSource.xsl and it seems that this checking is only done for array elements. This should generate code similar to the "setter" methods. So in the context of the above complexType, the serialize method should look like this: if ( _Foo->foo-element != NULL ) { start_input_str = "foo-element, env, current_node, AXIS2_FALSE); axutil_stream_write(stream, env, end_input_str, end_input_str_len); } Also, if minOccurs is not specified, perhaps it should return an error if _Foo->foo-element is NULL. > Program crashes if optional elements are not provided > ----------------------------------------------------- > > Key: AXIS2C-753 > URL: https://issues.apache.org/jira/browse/AXIS2C-753 > Project: Axis2-C > Issue Type: Bug > Components: code generation > Affects Versions: 1.1.0 > Reporter: Michael Mole > Priority: Critical > > I am using the code generation tool from approx. 11/1/2007 Axis2/Java nightly snapshot. I am using it to generate C databindings > My generated adb databinding code is writing elements in the serialize method even when minOccurs="0". I think if anything has a minOccurs="0", the generated serialize should check if the element has been provided by surrounding the code block with an "if ( foo-element !- NULL )". Otherwise, the program will crash if the optional element has not been provided. > I have a datatype defined as follows: > > > minOccurs="0"> > > > > In my serialize method I'm seeing something like this: > start_input_str = " > start_input_str_len = axutil_strlen(start_input_str); > end_input_str = ""; > end_input_str_len = axutil_strlen(end_input_str); > > axutil_stream_write(stream, env, start_input_str, start_input_str_len); > > adb_foo-element_serialize(_Foo->foo-element, > env, current_node, > AXIS2_FALSE > ); > > axutil_stream_write(stream, env, end_input_str, end_input_str_len); -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org For additional commands, e-mail: axis-c-dev-help@ws.apache.org