axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Konstantin Pribluda (JIRA)" <j...@apache.org>
Subject [jira] Commented: (AXIS2-4222) Codegen introduces infinite loop in generated code ( while deserealising )
Date Wed, 19 May 2010 13:19:57 GMT

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

Konstantin Pribluda commented on AXIS2-4222:
--------------------------------------------

As you see,  nobody from axis team cared to look at this issue in over a year. 
This patch worked for me back then. Now it has to be investigated.

> 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


Mime
View raw message