axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dsosno...@apache.org
Subject svn commit: r530263 - in /webservices/axis2/branches/java/1_2/modules/jibx/src/org/apache/axis2/jibx: CodeGenerationUtility.java template/JibXDatabindingTemplate.xsl
Date Thu, 19 Apr 2007 04:25:31 GMT
Author: dsosnoski
Date: Wed Apr 18 21:25:30 2007
New Revision: 530263

URL: http://svn.apache.org/viewvc?view=rev&rev=530263
Log:
Fix AXIS2-2549 null pointer exception when using JiBX without a binding
Also avoid creating an instance object when unmarshalling unless separate create-type used
(allowing for substitution group support)

Modified:
    webservices/axis2/branches/java/1_2/modules/jibx/src/org/apache/axis2/jibx/CodeGenerationUtility.java
    webservices/axis2/branches/java/1_2/modules/jibx/src/org/apache/axis2/jibx/template/JibXDatabindingTemplate.xsl

Modified: webservices/axis2/branches/java/1_2/modules/jibx/src/org/apache/axis2/jibx/CodeGenerationUtility.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/jibx/src/org/apache/axis2/jibx/CodeGenerationUtility.java?view=diff&rev=530263&r1=530262&r2=530263
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/jibx/src/org/apache/axis2/jibx/CodeGenerationUtility.java
(original)
+++ webservices/axis2/branches/java/1_2/modules/jibx/src/org/apache/axis2/jibx/CodeGenerationUtility.java
Wed Apr 18 21:25:30 2007
@@ -311,7 +311,7 @@
             }
 
             // make sure classes will be generated for abstract mappings
-            if (unwrap && complexTypeMap.size() > 0 && !binding.isForceClasses())
{
+            if (unwrap && complexTypeMap.size() > 0 && (binding == null
|| !binding.isForceClasses())) {
                 throw new RuntimeException(
                         "unwrapped binding must use force-classes='true' option in " + path);
             }
@@ -577,7 +577,7 @@
             }
 
             // set binding lookup parameters
-            if (binding.getName() != null && binding.getTargetPackage() != null)
{
+            if (binding != null && binding.getName() != null && binding.getTargetPackage()
!= null) {
                 bindinit.setAttribute("binding-name", binding.getName());
                 bindinit.setAttribute("binding-package", binding.getTargetPackage());
             } else {
@@ -769,7 +769,7 @@
                     boolean isarray = element.getMaxOccurs() > 1;
                     param.setAttribute("array", Boolean.toString(isarray));
                     String javatype;
-                    String createtype;
+                    String createtype = null;
                     if (element.getSchemaType() instanceof XmlSchemaSimpleType) {
 
                         // simple type translates to format element in binding
@@ -779,7 +779,7 @@
                                     qname + ": no format definition found for type " +
                                     typename + " (used by element " + itemname + ')');
                         }
-                        javatype = createtype = format.getTypeName();
+                        javatype = format.getTypeName();
                         param.setAttribute("form", "simple");
                         param.setAttribute("serializer", format.getSerializerName());
                         param.setAttribute("deserializer", format.getDeserializerName());
@@ -821,9 +821,6 @@
                         }
                         javatype = mapping.getClassName();
                         createtype = mapping.getCreateType();
-                        if (createtype == null) {
-                            createtype = javatype;
-                        }
                         param.setAttribute("form", "complex");
                         param.setAttribute("type-index", tindex.toString());
 
@@ -851,7 +848,9 @@
                         }
                     }
                     param.setAttribute("java-type", javatype);
-                    param.setAttribute("create-type", createtype);
+                    if (createtype != null) {
+                        param.setAttribute("create-type", createtype);
+                    }
 
                     boolean isobj = !s_primitiveSet.contains(javatype);
                     String fulltype = javatype;

Modified: webservices/axis2/branches/java/1_2/modules/jibx/src/org/apache/axis2/jibx/template/JibXDatabindingTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/jibx/src/org/apache/axis2/jibx/template/JibXDatabindingTemplate.xsl?view=diff&rev=530263&r1=530262&r2=530263
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/jibx/src/org/apache/axis2/jibx/template/JibXDatabindingTemplate.xsl
(original)
+++ webservices/axis2/branches/java/1_2/modules/jibx/src/org/apache/axis2/jibx/template/JibXDatabindingTemplate.xsl
Wed Apr 18 21:25:30 2007
@@ -286,7 +286,7 @@
       
     </xsl:choose>
           } catch (org.jibx.runtime.JiBXException e) {
-              throw new org.apache.axis2.AxisFault(e);
+              throw org.apache.axis2.AxisFault.makeFault(e);
           }
           return envelope;
       }
@@ -690,7 +690,7 @@
             } else if (ex instanceof java.rmi.RemoteException) {
                 throw (java.rmi.RemoteException)ex;
             } else {
-                throw new org.apache.axis2.AxisFault(ex);
+                throw org.apache.axis2.AxisFault.makeFault(ex);
             }
         }
     
@@ -899,7 +899,7 @@
         <xsl:value-of select="@deserializer"/>(uctx.parseElementText("<xsl:value-of
select="@ns"/>", "<xsl:value-of select="@name"/>"))
       </xsl:when>
       <xsl:when test="@form='complex'">
-        uctx.getUnmarshaller(_type_index<xsl:value-of select="@type-index"/>).unmarshal(new
<xsl:value-of select="@create-type"/>(), uctx)
+        uctx.getUnmarshaller(_type_index<xsl:value-of select="@type-index"/>).unmarshal(<xsl:choose><xsl:when
test="string-length(normalize-space(@create-type)) = 0">null</xsl:when><xsl:otherwise>new
<xsl:value-of select="@create-type"/>()</xsl:otherwise></xsl:choose>, uctx)
       </xsl:when>
     </xsl:choose>
   </xsl:template>



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


Mime
View raw message