Merge "BUG 652 leafref CCE & BUG 720 colons problem"
[controller.git] / opendaylight / netconf / config-netconf-connector / src / main / java / org / opendaylight / controller / netconf / confignetconfconnector / mapping / attributes / fromxml / AbstractAttributeReadingStrategy.java
index 867d94e0b70f628a1454cde825f44d6c27233528..701e96ecd95b8853fcee8ccf75b98a9ac6cb1b47 100644 (file)
@@ -8,6 +8,7 @@
 
 package org.opendaylight.controller.netconf.confignetconfconnector.mapping.attributes.fromxml;
 
+import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
 import org.opendaylight.controller.netconf.util.xml.XmlElement;
 
 import java.util.List;
@@ -25,13 +26,16 @@ public abstract class AbstractAttributeReadingStrategy implements AttributeReadi
     }
 
     @Override
-    public AttributeConfigElement readElement(List<XmlElement> configNodes) {
-        if (configNodes.size() == 0)
-            return AttributeConfigElement.createNullValue(nullableDefault);
-
+    public AttributeConfigElement readElement(List<XmlElement> configNodes) throws NetconfDocumentedException {
+        if (configNodes.size() == 0){
+            return AttributeConfigElement.createNullValue(postprocessNullableDefault(nullableDefault));
+        }
         return readElementHook(configNodes);
     }
 
-    abstract AttributeConfigElement readElementHook(List<XmlElement> configNodes);
+    abstract AttributeConfigElement readElementHook(List<XmlElement> configNodes) throws NetconfDocumentedException;
 
+    protected Object postprocessNullableDefault(String nullableDefault) {
+        return nullableDefault;
+    }
 }