Fixed schema resolution strategy 27/4327/1
authorTony Tkacik <ttkacik@cisco.com>
Thu, 16 Jan 2014 17:05:11 +0000 (18:05 +0100)
committerTony Tkacik <ttkacik@cisco.com>
Thu, 16 Jan 2014 17:05:11 +0000 (18:05 +0100)
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/codec/xml/XmlDocumentUtils.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/impl/util/YangSourceContext.java

index 09e743d49b8f7e425bdc4764621420a23f233d04..63968e056f7d5bf6bd693ca2a8ad6de1f020fdc1 100644 (file)
@@ -121,7 +121,7 @@ public class XmlDocumentUtils {
         } else {
             ret = doc.createElementNS(null, dataType.getLocalName());
         }
-        if (data instanceof AttributesContainer) {
+        if (data instanceof AttributesContainer && ((AttributesContainer) data).getAttributes() != null) {
             for (Entry<QName, String> attribute : ((AttributesContainer) data).getAttributes().entrySet()) {
                 ret.setAttributeNS(attribute.getKey().getNamespace().toString(), attribute.getKey().getLocalName(),
                         attribute.getValue());
@@ -229,9 +229,9 @@ public class XmlDocumentUtils {
         TypeDefinitionAwareCodec<Object, ? extends TypeDefinition<?>> codec = codecProvider.codecFor(schema.getType());
         String text = xmlElement.getTextContent();
         Object value;
-        if(codec != null) {
+        if (codec != null) {
             value = codec.deserialize(text);
-            
+
         } else {
             value = xmlElement.getTextContent();
         }
@@ -243,9 +243,9 @@ public class XmlDocumentUtils {
         TypeDefinitionAwareCodec<Object, ? extends TypeDefinition<?>> codec = codecProvider.codecFor(schema.getType());
         String text = xmlElement.getTextContent();
         Object value;
-        if(codec != null) {
+        if (codec != null) {
             value = codec.deserialize(text);
-            
+
         } else {
             value = xmlElement.getTextContent();
         }
index c35185fae7eefb406d8832081d15a400ee0fc43d..996a20c24d4fbfbfa74b02efa36cf0724f251e23 100644 (file)
@@ -166,7 +166,7 @@ public class YangSourceContext implements AdvancedSchemaSourceProvider<InputStre
                     for (ModuleImport dependency : info.getDependencies()) {
                         LOG.debug("Source: {} Resolving dependency: {}",identifier,dependency);
                         ResolutionState dependencyState = resolveDependency(dependency);
-                        if (dependencyState == ResolutionState.MISSING_SOURCE) {
+                        if (dependencyState != ResolutionState.EVERYTHING_OK) {
                             potentialState = ResolutionState.MISSING_DEPENDENCY;
                             missingDependencies.put(identifier, dependency);
                         }