Merge "Bug 1003: Restconf - remove whitespace on input"
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / main / java / org / opendaylight / controller / sal / rest / impl / XmlReader.java
index d6f8a9874b963a90fa62e595e5bb7e6a9fcad8b0..5b95f0de1ada80408f24670c310dce35a306ab5d 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
 package org.opendaylight.controller.sal.rest.impl;
 
 import static com.google.common.base.Preconditions.checkArgument;
@@ -158,7 +165,7 @@ public class XmlReader {
                 }
             }
         }
-        return data;
+        return data == null ? null : data.trim();
     }
 
     private String getAdditionalData(XMLEvent event) throws XMLStreamException {
@@ -198,7 +205,7 @@ public class XmlReader {
         if (namespaceAndValue.length == 2) {
             String namespace = startElement.getNamespaceContext().getNamespaceURI(namespaceAndValue[0]);
             if (namespace != null && !namespace.isEmpty()) {
-                return new IdentityValuesDTO(namespace, namespaceAndValue[1], namespaceAndValue[0]);
+                return new IdentityValuesDTO(namespace, namespaceAndValue[1], namespaceAndValue[0],value);
             }
         }
         // it is not "prefix:value" but just "value"