You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rampart-dev@ws.apache.org by "Asim Mahmood (JIRA)" <ji...@apache.org> on 2010/09/20 18:34:35 UTC

[jira] Commented: (AXIS2-4222) Codegen introduces infinite loop in generated code ( while deserealising )

    [ https://issues.apache.org/jira/browse/AXIS2-4222?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12912568#action_12912568 ] 

Asim Mahmood commented on AXIS2-4222:
-------------------------------------

I've run into the same issue. Is there an updates on if this will be fixed in the next release?

Thanks

> Codegen introduces infinite loop in generated code ( while deserealising ) 
> ---------------------------------------------------------------------------
>
>                 Key: AXIS2-4222
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4222
>             Project: Axis2
>          Issue Type: Bug
>          Components: codegen
>    Affects Versions: 1.5
>         Environment: current codebase from svn
>            Reporter: Konstantin Pribluda
>         Attachments: axis-4222.patch
>
>
> I have following complex type:
> ---------------- snip -------------
> 	<xs:complexType name="typePRODUCTLINK">
> 		<xs:sequence>
> 			<xs:choice>
> 				<xs:element ref="P_ID"/>
> 				<xs:element ref="P_NVAG_PID"/>
> 			</xs:choice>
> 			<xs:element name="LINK_SORT" minOccurs="0">
> 				<xs:annotation>
> 					<xs:documentation>(Sortierung)</xs:documentation>
> 				</xs:annotation>
> 				<xs:simpleType>
> 					<xs:restriction base="typeSORT">
> 						<xs:totalDigits value="3"/>
> 					</xs:restriction>
> 				</xs:simpleType>
> 			</xs:element>
> 		</xs:sequence>
> 	</xs:complexType>
> -------------------- snap ----------------------
> And it produces following while loop:
> ------------------------ snip ---------------
>                 while(!reader.isEndElement()) {
>                     if (reader.isStartElement() ){
>                 
>                                     if (reader.isStartElement() ){
>                                 
>                                                 object.setTypePRODUCTLINKChoice_type0(censored.TypePRODUCTLINKChoice_type0.Factory.parse(reader));
>                                             
>                               }  // End of if for expected property start element
>                                 
>                                         else
>                                     
>                                     if (reader.isStartElement() && new javax.xml.namespace.QName("censored","LINK_SORT").equals(reader.getName())){
>                                 
>                                                 object.setLINK_SORT(censored.LINK_SORT_type1.Factory.parse(reader));
>                                               
>                                         reader.next();
>                                     
>                               }  // End of if for expected property start element
>                                 
>                              } else {
>                                 reader.next();
>                              }  
>                            }  // end of while loop
> --------------------- snap -----------------
> This is obvious,  that this while loop never goes for LINK_SORT, and thus never terminates
> for such XML snippet:
> ------------------- snip -----------------
> <P_SUBPRODUCT type="FAMILY">
> <P_ID>402322g</P_ID>
> <LINK_SORT>1</LINK_SORT>
> </P_SUBPRODUCT>
> ------------------- snap ----------------
> I was able to identify problem source in ADBBeanTemplateXSL ( from line 2816 ):
> -----------------snip----------
>                            <xsl:choose>
>                                 <xsl:when test="$unordered and not($choice and $hasParticleType)">  <!-- One property per iteration if unordered -->
>                                     <xsl:if test="position()>1">
>                                         else
>                                     </xsl:if>
>                                 </xsl:when>
>                                 <xsl:otherwise>
>                                     <!-- If sequence, advance to start of next property or to end of outer element -->
>                                     while (!reader.isStartElement() &amp;&amp; !reader.isEndElement()) reader.next();
>                                 </xsl:otherwise>
>                             </xsl:choose>
> -----------------snap---------
> If I manually edit generated beans as if "otherwise" was choosen, everything works as expected.
> So IMHO bug is somewhere in choice condition. ( but unfortunately my limited
> experience with codegen codebase does not allow me to produce a patch at the moment,
> though it may change really soon ) 

-- 
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: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org