You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-commits@ws.apache.org by da...@apache.org on 2007/01/04 20:37:38 UTC

svn commit: r492702 - /webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/impl/SimpleResourcePropertyCollection.java

Author: danj
Date: Thu Jan  4 11:37:37 2007
New Revision: 492702

URL: http://svn.apache.org/viewvc?view=rev&rev=492702
Log:
Modified WSRP schema validation so that nillable check uses xsd:nil attribute instead of 
examining element content. This is a fix for MUSE-159.

Modified:
    webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/impl/SimpleResourcePropertyCollection.java

Modified: webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/impl/SimpleResourcePropertyCollection.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/impl/SimpleResourcePropertyCollection.java?view=diff&rev=492702&r1=492701&r2=492702
==============================================================================
--- webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/impl/SimpleResourcePropertyCollection.java (original)
+++ webservices/muse/trunk/modules/muse-wsrf-impl/src/org/apache/muse/ws/resource/properties/impl/SimpleResourcePropertyCollection.java Thu Jan  4 11:37:37 2007
@@ -27,11 +27,11 @@
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
-
 import org.apache.muse.util.MultiMap;
 import org.apache.muse.util.messages.Messages;
 import org.apache.muse.util.messages.MessagesFactory;
 import org.apache.muse.util.xml.XmlUtils;
+import org.apache.muse.util.xml.XsdUtils;
 import org.apache.muse.ws.resource.WsResourceCapability;
 import org.apache.muse.ws.resource.basefaults.BaseFault;
 import org.apache.muse.ws.resource.metadata.MetadataDescriptor;
@@ -1158,13 +1158,11 @@
         
         for (int n = 0; n < instances.length; ++n)
         {
-            //
-            // check for child elements, attributes, and text, all of 
-            // which qualify an element as "not null"
-            //
-            if (!instances[n].hasChildNodes() && 
-                !instances[n].hasAttributes() && 
-                XmlUtils.extractText(instances[n]) == null)
+            String nil = XmlUtils.getAttribute(instances[n], XsdUtils.NIL_QNAME);
+            boolean nilExists = nil != null && nil.length() > 0;
+            boolean isNil = nilExists ? Boolean.valueOf(nil).booleanValue() : false;
+            
+            if (isNil)
                 throw new SchemaValidationFault(_MESSAGES.get("NotNillable", new Object[]{ qname }));
         }
     }



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