You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2006/09/27 23:08:53 UTC

svn commit: r450579 - /webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl

Author: dims
Date: Wed Sep 27 14:08:52 2006
New Revision: 450579

URL: http://svn.apache.org/viewvc?view=rev&rev=450579
Log:
fix for AXIS2-1247 - wsdl2java generated client throws NumberFormatException on nil integer

Modified:
    webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl

Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl?view=diff&rev=450579&r1=450578&r2=450579
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl Wed Sep 27 14:08:52 2006
@@ -1590,9 +1590,12 @@
                                 </xsl:when>
                                 <!-- start of the simple types handling -->
                                 <xsl:otherwise>
+                                    <xsl:if test="@nillable">
+                                       if (!"true".equals(reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"))){
+                                    </xsl:if>
                                     java.lang.String content = reader.getElementText();
                                     <xsl:if test="not(enumFacet)">
-                                        <xsl:if test="$propertyTypeName=$propertyType">
+                                    <xsl:if test="$propertyTypeName=$propertyType">
                                             int index = content.indexOf(":");
                                             java.lang.String prefix ="";
                                             java.lang.String namespaceuri ="";
@@ -1602,15 +1605,20 @@
                                              }
                                              object.set<xsl:value-of select="$javaName"/>(
                                                   org.apache.axis2.databinding.utils.ConverterUtil.convertToQName(content,namespaceuri));
-                                         </xsl:if>
-                                         <xsl:if test="not($propertyTypeName=$propertyType)">
+                                    </xsl:if>
+                                    <xsl:if test="not($propertyTypeName=$propertyType)">
                                               object.set<xsl:value-of select="$javaName"/>(
                                         org.apache.axis2.databinding.utils.ConverterUtil.convertTo<xsl:value-of select="$shortTypeName"/>(content));
-                                         </xsl:if>
+                                    </xsl:if>
                                     </xsl:if>
                                     <xsl:if test="(enumFacet)">
                                     object = <xsl:value-of select="$name"/>.fromString(content);
                                     </xsl:if>
+                                    <xsl:if test="@nillable">
+                                       } else {
+                                           reader.getElementText(); // throw away text nodes if any.
+                                       }
+                                    </xsl:if>
                                     <xsl:if test="$isType or $anon">  <!-- This is a subelement property to be consumed -->
                                         reader.next();
                                     </xsl:if>
@@ -2582,6 +2590,9 @@
                                 </xsl:when>
                                 <!-- start of the simple types handling -->
                                 <xsl:otherwise>
+                                    <xsl:if test="@nillable">
+                                       if (!"true".equals(reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"))){
+                                    </xsl:if>
                                     java.lang.String content = reader.getElementText();
                                     <xsl:if test="$propertyTypeName=$propertyType">
                                             int index = content.indexOf(":");
@@ -2594,10 +2605,16 @@
                                              object.set<xsl:value-of select="$javaName"/>(
                                                   org.apache.axis2.databinding.utils.ConverterUtil.convertToQName(content,namespaceuri));
                                          </xsl:if>
-                                         <xsl:if test="not($propertyTypeName=$propertyType)">
+                                    <xsl:if test="not($propertyTypeName=$propertyType)">
                                               object.set<xsl:value-of select="$javaName"/>(
                                         org.apache.axis2.databinding.utils.ConverterUtil.convertTo<xsl:value-of select="$shortTypeName"/>(content));
                                           </xsl:if>
+                                    <xsl:if test="@nillable">
+                                        } else {
+                                            reader.getElementText(); // throw away text nodes if any.
+                                        }
+                                    </xsl:if>
+
                                     <xsl:if test="$isType or $anon">  <!-- This is a subelement property to be consumed -->
                                         reader.next();
                                     </xsl:if>



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org