Fix CDS serialization failures due to YangInstanceIdentifier change 94/20794/1
authorTom Pantelis <tpanteli@brocade.com>
Sat, 16 May 2015 19:13:41 +0000 (15:13 -0400)
committerTom Pantelis <tpanteli@brocade.com>
Wed, 20 May 2015 10:59:19 +0000 (10:59 +0000)
YangInstanceIdentifier was recently made an abstract class with 2
implementations which broke CDS serialization as it was looking for
an exact match for the YangInstanceIdentifier class.

Change-Id: Iba94dda9584f65f5c8d76a1514d3f9f09d2f0483
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
(cherry picked from commit bc42ccb9b9bef46de08370e9d958e0e2fe3dda5a)

opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/serialization/ValueType.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/ValueTypes.java

index 9eec8a300a81f2fc304beb7d9978ec7aef26b331..0015a06149ffe84f6a180f8971ed3bd461d30248 100644 (file)
@@ -109,7 +109,6 @@ public enum ValueType {
         b.put(Long.class, LONG_TYPE);
         b.put(Boolean.class, BOOL_TYPE);
         b.put(QName.class, QNAME_TYPE);
         b.put(Long.class, LONG_TYPE);
         b.put(Boolean.class, BOOL_TYPE);
         b.put(QName.class, QNAME_TYPE);
-        b.put(YangInstanceIdentifier.class, YANG_IDENTIFIER_TYPE);
         b.put(Short.class,SHORT_TYPE);
         b.put(BigInteger.class, BIG_INTEGER_TYPE);
         b.put(BigDecimal.class, BIG_DECIMAL_TYPE);
         b.put(Short.class,SHORT_TYPE);
         b.put(BigInteger.class, BIG_INTEGER_TYPE);
         b.put(BigDecimal.class, BIG_DECIMAL_TYPE);
@@ -133,6 +132,10 @@ public enum ValueType {
             return BITS_TYPE;
         }
 
             return BITS_TYPE;
         }
 
+        if (node instanceof YangInstanceIdentifier) {
+            return YANG_IDENTIFIER_TYPE;
+        }
+
         throw new IllegalArgumentException("Unknown value type " + node.getClass().getSimpleName());
     }
 }
         throw new IllegalArgumentException("Unknown value type " + node.getClass().getSimpleName());
     }
 }
index 83099f8a5bd656b9c776d60108fd9b3e000e359b..f107ce75a708f87d3e0e5ab620bb218551e8490a 100644 (file)
@@ -43,7 +43,6 @@ final class ValueTypes {
         b.put(Long.class, Byte.valueOf(LONG_TYPE));
         b.put(Boolean.class, Byte.valueOf(BOOL_TYPE));
         b.put(QName.class, Byte.valueOf(QNAME_TYPE));
         b.put(Long.class, Byte.valueOf(LONG_TYPE));
         b.put(Boolean.class, Byte.valueOf(BOOL_TYPE));
         b.put(QName.class, Byte.valueOf(QNAME_TYPE));
-        b.put(YangInstanceIdentifier.class, Byte.valueOf(YANG_IDENTIFIER_TYPE));
         b.put(Short.class, Byte.valueOf(SHORT_TYPE));
         b.put(BigInteger.class, Byte.valueOf(BIG_INTEGER_TYPE));
         b.put(BigDecimal.class, Byte.valueOf(BIG_DECIMAL_TYPE));
         b.put(Short.class, Byte.valueOf(SHORT_TYPE));
         b.put(BigInteger.class, Byte.valueOf(BIG_INTEGER_TYPE));
         b.put(BigDecimal.class, Byte.valueOf(BIG_DECIMAL_TYPE));
@@ -65,10 +64,15 @@ final class ValueTypes {
         if (type != null) {
             return type;
         }
         if (type != null) {
             return type;
         }
+
         if (node instanceof Set) {
             return BITS_TYPE;
         }
 
         if (node instanceof Set) {
             return BITS_TYPE;
         }
 
+        if (node instanceof YangInstanceIdentifier) {
+            return YANG_IDENTIFIER_TYPE;
+        }
+
         throw new IllegalArgumentException("Unknown value type " + node.getClass().getSimpleName());
     }
 }
         throw new IllegalArgumentException("Unknown value type " + node.getClass().getSimpleName());
     }
 }