You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by co...@apache.org on 2019/12/16 11:21:49 UTC

[ws-xmlschema] branch master updated: Fixing a few issues thrown up by LGTM

This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ws-xmlschema.git


The following commit(s) were added to refs/heads/master by this push:
     new afa27ce  Fixing a few issues thrown up by LGTM
afa27ce is described below

commit afa27cede5ce354ae88cdb47f35330a847af661a
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Mon Dec 16 10:00:30 2019 +0000

    Fixing a few issues thrown up by LGTM
---
 .../java/org/apache/ws/commons/schema/SchemaBuilder.java   |  5 ++---
 .../org/apache/ws/commons/schema/XmlSchemaSerializer.java  |  6 +++---
 .../ws/commons/schema/extensions/ExtensionRegistry.java    | 14 +++++++-------
 .../ws/commons/schema/docpath/XmlSchemaPathFinder.java     |  2 +-
 .../apache/ws/commons/schema/walker/XmlSchemaScope.java    |  4 ----
 5 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/xmlschema-core/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java b/xmlschema-core/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java
index 2bc4ee2..10af77c 100644
--- a/xmlschema-core/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java
+++ b/xmlschema-core/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java
@@ -145,11 +145,10 @@ public class SchemaBuilder {
     }
 
     /**
-     * build method taking in a document and a validation handler
+     * build method taking in a document and a uri
      *
      * @param doc
      * @param uri
-     * @param veh
      */
     XmlSchema build(Document doc, String uri) {
         Element schemaEl = doc.getDocumentElement();
@@ -275,7 +274,7 @@ public class SchemaBuilder {
      * @param schema
      * @param complexEl
      * @param schemaEl
-     * @param b
+     * @param topLevel
      */
     XmlSchemaComplexType handleComplexType(XmlSchema schema, Element complexEl, Element schemaEl,
                                            boolean topLevel) {
diff --git a/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java b/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java
index 5ec8dcc..e535b4f 100644
--- a/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java
+++ b/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java
@@ -508,7 +508,7 @@ public class XmlSchemaSerializer {
             String attGroupName = attributeGroupObj.getName();
             attributeGroup.setAttributeNS(null, "name", attGroupName);
         } else {
-            throw new XmlSchemaSerializerException("Attribute group must" + "have name");
+            throw new XmlSchemaSerializerException("Attribute group must have name");
         }
         if (attributeGroupObj.getId() != null) {
             attributeGroup.setAttributeNS(null, "id", attributeGroupObj.getId());
@@ -1624,7 +1624,7 @@ public class XmlSchemaSerializer {
         if (schemaObj.getAttributeFormDefault() != null) {
             String formQualified = schemaObj.getAttributeFormDefault().toString();
 
-            if (!formQualified.equals(XmlSchemaForm.NONE)) {
+            if (!formQualified.equals(XmlSchemaForm.NONE.toString())) {
                 serializedSchema.setAttributeNS(null, "attributeFormDefault", formQualified);
             }
         }
@@ -1632,7 +1632,7 @@ public class XmlSchemaSerializer {
         if (schemaObj.getElementFormDefault() != null) {
             String formQualified = schemaObj.getElementFormDefault().toString();
 
-            if (!formQualified.equals(XmlSchemaForm.NONE)) {
+            if (!formQualified.equals(XmlSchemaForm.NONE.toString())) {
                 serializedSchema.setAttributeNS(null, "elementFormDefault", formQualified);
             }
         }
diff --git a/xmlschema-core/src/main/java/org/apache/ws/commons/schema/extensions/ExtensionRegistry.java b/xmlschema-core/src/main/java/org/apache/ws/commons/schema/extensions/ExtensionRegistry.java
index e2b09e8..2af517d 100644
--- a/xmlschema-core/src/main/java/org/apache/ws/commons/schema/extensions/ExtensionRegistry.java
+++ b/xmlschema-core/src/main/java/org/apache/ws/commons/schema/extensions/ExtensionRegistry.java
@@ -86,21 +86,21 @@ public class ExtensionRegistry {
     }
 
     /**
-     * remove the registration for a serializer with a QName
+     * remove the registration for a serializer with a Class
      * 
-     * @param name - the QName of the element/attribute the serializer is associated with
+     * @param classOfType - the Class of the element/attribute the serializer is associated with
      */
-    public void unregisterSerializer(QName name) {
-        extensionSerializers.remove(name);
+    public void unregisterSerializer(Class<?> classOfType) {
+        extensionSerializers.remove(classOfType);
     }
 
     /**
      * remove the registration for a deserializer with a QName
      * 
-     * @param classOfType - the the deserializer is associated with
+     * @param name - the QName fo the element that the deserializer is associated with
      */
-    public void unregisterDeserializer(Class<?> classOfType) {
-        extensionDeserializers.remove(classOfType);
+    public void unregisterDeserializer(QName name) {
+        extensionDeserializers.remove(name);
     }
 
     /**
diff --git a/xmlschema-walker/src/main/java/org/apache/ws/commons/schema/docpath/XmlSchemaPathFinder.java b/xmlschema-walker/src/main/java/org/apache/ws/commons/schema/docpath/XmlSchemaPathFinder.java
index a88f0fa..7bde973 100644
--- a/xmlschema-walker/src/main/java/org/apache/ws/commons/schema/docpath/XmlSchemaPathFinder.java
+++ b/xmlschema-walker/src/main/java/org/apache/ws/commons/schema/docpath/XmlSchemaPathFinder.java
@@ -1681,7 +1681,7 @@ public final class XmlSchemaPathFinder<U, V> extends DefaultHandler {
         } while ((iter != null)
                  && !iter.getStateMachineNode().getNodeType().equals(XmlSchemaStateMachineNode.Type.ELEMENT));
 
-        if (!iter.getStateMachineNode().getNodeType().equals(XmlSchemaStateMachineNode.Type.ELEMENT)
+        if (iter == null || !iter.getStateMachineNode().getNodeType().equals(XmlSchemaStateMachineNode.Type.ELEMENT)
             || !iter.getStateMachineNode().getElement().getQName().equals(element)) {
             throw new IllegalStateException("Walked up tree and stopped at node "
                                             + currentPath.getStateMachineNode()
diff --git a/xmlschema-walker/src/main/java/org/apache/ws/commons/schema/walker/XmlSchemaScope.java b/xmlschema-walker/src/main/java/org/apache/ws/commons/schema/walker/XmlSchemaScope.java
index f87c1dc..4b0307d 100644
--- a/xmlschema-walker/src/main/java/org/apache/ws/commons/schema/walker/XmlSchemaScope.java
+++ b/xmlschema-walker/src/main/java/org/apache/ws/commons/schema/walker/XmlSchemaScope.java
@@ -95,10 +95,6 @@ final class XmlSchemaScope {
      * Initializes a new {@link XmlSchemaScope} with a base
      * {@link XmlSchemaElement}. The element type and attributes will be
      * traversed, and attribute lists and element children will be retrieved.
-     *
-     * @param element The base element to build the scope from.
-     * @param substitutions The master list of substitution groups to pull from.
-     * @param userRecognizedTypes The set of types recognized by the caller.
      */
     XmlSchemaScope(XmlSchemaType type, SchemasByNamespace xmlSchemasByNamespace,
                    Map<QName, XmlSchemaScope> scopeCache, Set<QName> userRecognizedTypes) {