ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1793862 - /webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java
Date Thu, 04 May 2017 19:47:08 GMT
Author: dkulp
Date: Thu May  4 19:47:08 2017
New Revision: 1793862

URL: http://svn.apache.org/viewvc?rev=1793862&view=rev
Log:
[XMLSCHEMA-44] Make XmlSchemaCollection get* APIs null-safe.  Patch from Gary Gregory applied

Modified:
    webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java

Modified: webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java
URL: http://svn.apache.org/viewvc/webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java?rev=1793862&r1=1793861&r2=1793862&view=diff
==============================================================================
--- webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java
(original)
+++ webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java
Thu May  4 19:47:08 2017
@@ -768,6 +768,9 @@ public final class XmlSchemaCollection {
      * @return the attribute or null.
      */
     public XmlSchemaAttribute getAttributeByQName(QName schemaAttributeName) {
+    	if (schemaAttributeName == null) {
+    		return null;
+    	}
         String uri = schemaAttributeName.getNamespaceURI();
         for (Map.Entry<SchemaKey, XmlSchema> entry : schemas.entrySet()) {
             if (entry.getKey().getNamespace().equals(uri)) {
@@ -788,6 +791,9 @@ public final class XmlSchemaCollection {
      * @return the element object, or null.
      */
     public XmlSchemaElement getElementByQName(QName qname) {
+    	if (qname == null) {
+    		return null;
+    	}
         String uri = qname.getNamespaceURI();
         for (Map.Entry<SchemaKey, XmlSchema> entry : schemas.entrySet()) {
             if (entry.getKey().getNamespace().equals(uri)) {
@@ -802,6 +808,9 @@ public final class XmlSchemaCollection {
 
     
     public XmlSchemaAttributeGroup getAttributeGroupByQName(QName name) {
+    	if (name == null) {
+    		return null;
+    	}
         String uri = name.getNamespaceURI();
         for (Map.Entry<SchemaKey, XmlSchema> entry : schemas.entrySet()) {
             if (entry.getKey().getNamespace().equals(uri)) {
@@ -816,6 +825,9 @@ public final class XmlSchemaCollection {
     }
     
     public XmlSchemaGroup getGroupByQName(QName name) {
+    	if (name == null) {
+    		return null;
+    	}
         String uri = name.getNamespaceURI();
         for (Map.Entry<SchemaKey, XmlSchema> entry : schemas.entrySet()) {
             if (entry.getKey().getNamespace().equals(uri)) {
@@ -830,6 +842,9 @@ public final class XmlSchemaCollection {
     }
     
     public XmlSchemaNotation getNotationByQName(QName name) {
+    	if (name == null) {
+    		return null;
+    	}
         String uri = name.getNamespaceURI();
         for (Map.Entry<SchemaKey, XmlSchema> entry : schemas.entrySet()) {
             if (entry.getKey().getNamespace().equals(uri)) {



Mime
View raw message