BUG 340: Resolved instance-identifier translation in JSON
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / main / java / org / opendaylight / controller / sal / rest / impl / JsonMapper.java
index ca318e4f3692d28da298810d0b4ff7272bc4f615..226eff44e133a7ad311253740d6d77ea28a1d411 100644 (file)
@@ -252,14 +252,18 @@ class JsonMapper {
             result.append("/");
 
             writeModuleNameAndIdentifier(result, identityValue);
-            if (identityValue.getPredicates() != null) {
+            if (identityValue.getPredicates() != null && !identityValue.getPredicates().isEmpty()) {
                 for (Predicate predicate : identityValue.getPredicates()) {
                     IdentityValue identityValuePredicate = predicate.getName();
                     result.append("[");
-                    writeModuleNameAndIdentifier(result, identityValuePredicate);
-                    result.append("=\"");
+                    if (identityValuePredicate == null) {
+                        result.append(".");
+                    } else {
+                        writeModuleNameAndIdentifier(result, identityValuePredicate);
+                    }
+                    result.append("='");
                     result.append(predicate.getValue());
-                    result.append("\"");
+                    result.append("'");
                     result.append("]");
                 }
             }