cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bimargul...@apache.org
Subject svn commit: r609810 - in /incubator/cxf/trunk/rt/javascript/src/main: java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java resources/org/apache/cxf/javascript/cxf-utils.js
Date Mon, 07 Jan 2008 23:47:17 GMT
Author: bimargulies
Date: Mon Jan  7 15:47:09 2008
New Revision: 609810

URL: http://svn.apache.org/viewvc?rev=609810&view=rev
Log:
Fix to NPE when an <xs:any> was last.

Modified:
    incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
    incubator/cxf/trunk/rt/javascript/src/main/resources/org/apache/cxf/javascript/cxf-utils.js

Modified: incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java?rev=609810&r1=609809&r2=609810&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
Mon Jan  7 15:47:09 2008
@@ -456,7 +456,10 @@
 
         String anyNamespaceSpec = any.getNamespace();
         // we aren't dealing with any-after-any.
-        XmlSchemaElement nextElement = (XmlSchemaElement)nextItem.getParticle();
+        XmlSchemaElement nextElement = null;
+        if (nextItem != null) {
+            nextElement = (XmlSchemaElement)nextItem.getParticle();
+        }
         String matchType;
         String namespaceList = "[]";
         
@@ -472,11 +475,17 @@
             matchType = "org_apache_cxf_any_ns_matcher.LISTED";
             namespaceList = buildNamespaceList(anyNamespaceSpec);
         }
+        
+        String nextLocalPartConstant = "null";
+        if (nextElement != null) {
+            nextLocalPartConstant = "'" + nextElement.getQName().getLocalPart() + "'";
+        }
+        
         utils.appendLine("var matcher = new org_apache_cxf_any_ns_matcher("
                          + matchType
                          + ", '" + schemaInfo.getNamespaceURI() + "'"
                          + ", " + namespaceList
-                         + ", '" + nextElement.getQName().getLocalPart() + "'"
+                         + ", " + nextLocalPartConstant
                          + ");");
         
         if (array) {

Modified: incubator/cxf/trunk/rt/javascript/src/main/resources/org/apache/cxf/javascript/cxf-utils.js
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/resources/org/apache/cxf/javascript/cxf-utils.js?rev=609810&r1=609809&r2=609810&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/resources/org/apache/cxf/javascript/cxf-utils.js
(original)
+++ incubator/cxf/trunk/rt/javascript/src/main/resources/org/apache/cxf/javascript/cxf-utils.js
Mon Jan  7 15:47:09 2008
@@ -123,7 +123,7 @@
 				var ns = this.nslist[x];
 				if(ns == "##local") {
 					if((namespaceURI == null || namespaceURI == '') 
-						&& (localName != this.nextLocalPart))
+						&& (this.nextLocalPart != null && localName != this.nextLocalPart))
 						return true;  
 				} else {
 					if(ns == namespaceURI)
@@ -249,7 +249,7 @@
 function org_apache_cxf_getNodeText(node)
 {
     var r = "";
-    for(x = 0; x < node.childNodes.length; x ++) {
+    for(var x = 0; x < node.childNodes.length; x ++) {
         r = r + node.childNodes[x].nodeValue;
     }
     return r;



Mime
View raw message