Refactor shutdown-impl: add parameter to RPC, remove secret validation and masking.
[controller.git] / opendaylight / netconf / netconf-util / src / main / java / org / opendaylight / controller / netconf / util / xml / XmlElement.java
index c37b4abc6215906f1a1a98f5b088e63633f81e16..18a94c6d07ff7cf74289bfb5d3e057967a61e86c 100644 (file)
@@ -272,7 +272,9 @@ public class XmlElement {
 
     public String getTextContent() {
         Node textChild = element.getFirstChild();
-        Preconditions.checkState(textChild instanceof Text, getName() + " should contain text");
+        Preconditions.checkNotNull(textChild, "Child node expected, got null for " + getName() + " : " + element);
+        Preconditions.checkState(textChild instanceof Text, getName() + " should contain text." +
+                Text.class.getName() + " expected, got " + textChild);
         String content = textChild.getTextContent();
         // Trim needed
         return content.trim();
@@ -326,7 +328,7 @@ public class XmlElement {
             prefix = "";
         }
         if (namespaces.containsKey(prefix) == false) {
-            throw new IllegalArgumentException("Cannot find namespace for " + element + ". Prefix from content is "
+            throw new IllegalArgumentException("Cannot find namespace for " + XmlUtil.toString(element) + ". Prefix from content is "
                     + prefix + ". Found namespaces " + namespaces);
         }
         return Maps.immutableEntry(prefix, namespaces.get(prefix));