Bug 3151: Fix Not a Proxy Instance Exception 11/19811/1
authorThomas Bachman <tbachman@yahoo.com>
Thu, 7 May 2015 14:55:03 +0000 (10:55 -0400)
committerThomas Bachman <tbachman@yahoo.com>
Thu, 7 May 2015 14:56:21 +0000 (10:56 -0400)
This fixes a bug where a "Not a Proxy Instance"
exception (also IllegalArgumentException) is thrown
when hashCode is invoked in a yangtools generated
builder.

Change-Id: Iddc7ca6e4785e5ce11e41900a438dbb49baeaf6d
Signed-off-by: Thomas Bachman <tbachman@yahoo.com>
code-generator/binding-data-codec/src/main/java/org/opendaylight/yangtools/binding/data/codec/impl/LazyDataObject.java

index f1b578b9e873bcc38cf27aab456c945cfcba0dea..38884816a13c01d049f2edb40e6234eecb083e53 100644 (file)
@@ -107,10 +107,10 @@ class LazyDataObject<D extends DataObject> implements InvocationHandler, Augment
         int result = 1;
         for (final Method m : context.getHashCodeAndEqualsMethods()) {
             final Object value = getBindingData(m);
-            result += prime * result + ((value == null) ? 0 : value.hashCode());
+            result = prime * result + ((value == null) ? 0 : value.hashCode());
         }
         if (Augmentation.class.isAssignableFrom(context.getBindingClass())) {
-            result += prime * result + (getAugmentations(this).hashCode());
+            result = prime * result + (getAugmentations(this).hashCode());
         }
         cachedHashcode = result;
         return result;