Refactor shutdown-impl: add parameter to RPC, remove secret validation and masking.
[controller.git] / opendaylight / netconf / config-netconf-connector / src / main / java / org / opendaylight / controller / netconf / confignetconfconnector / mapping / attributes / fromxml / SimpleAttributeReadingStrategy.java
index a8605243af3f77f587563d453ea69d51401f2aa4..625e4ab3dfe9f8c4a7aeb28879eb8daad31e1bfa 100644 (file)
@@ -10,10 +10,14 @@ package org.opendaylight.controller.netconf.confignetconfconnector.mapping.attri
 
 import com.google.common.base.Preconditions;
 import org.opendaylight.controller.netconf.util.xml.XmlElement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.util.List;
 
 public class SimpleAttributeReadingStrategy extends AbstractAttributeReadingStrategy {
+    private static final Logger logger = LoggerFactory.getLogger(SimpleAttributeReadingStrategy.class);
+
 
     public SimpleAttributeReadingStrategy(String nullableDefault) {
         super(nullableDefault);
@@ -25,7 +29,13 @@ public class SimpleAttributeReadingStrategy extends AbstractAttributeReadingStra
         Preconditions.checkState(configNodes.size() == 1, "This element should be present only once " + xmlElement
                 + " but was " + configNodes.size());
 
-        String textContent = xmlElement.getTextContent();
+        String textContent = "";
+        try{
+            textContent = xmlElement.getTextContent();
+        }catch(IllegalStateException | NullPointerException e) {
+            // yuma sends <attribute /> for empty value instead of <attribute></attribute>
+            logger.warn("Ignoring exception caused by failure to read text element", e);
+        }
 
         Preconditions.checkNotNull(textContent, "This element should contain text %s", xmlElement);
         return AttributeConfigElement.create(postprocessNullableDefault(getNullableDefault()),