Merge "bug 152"
authorEd Warnicke <eaw@cisco.com>
Tue, 19 Nov 2013 14:24:18 +0000 (14:24 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 19 Nov 2013 14:24:18 +0000 (14:24 +0000)
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/RuntimeCodeHelper.xtend

index fbd87d17beede977e4efa2b987f077352522481c..f0f92da18e5c3b2235eb77a9cf3d0e32b8df371c 100644 (file)
@@ -39,7 +39,7 @@ class RuntimeCodeHelper {
     public static def void setDelegate(RpcService proxy, RpcService delegate) {
         val field = proxy.class.getField(DELEGATE_FIELD)
         if (field == null) throw new UnsupportedOperationException("Unable to set delegate to proxy");
-        if (field.type.isAssignableFrom(delegate.class)) {
+        if (delegate == null || field.type.isAssignableFrom(delegate.class)) {
             field.set(proxy, delegate)
         } else
             throw new IllegalArgumentException("delegate class is not assignable to proxy");
@@ -55,7 +55,7 @@ class RuntimeCodeHelper {
     public static def void setDelegate(Object proxy, Object delegate) {
         val field = proxy.class.getField(DELEGATE_FIELD)
         if (field == null) throw new UnsupportedOperationException("Unable to set delegate to proxy");
-        if (field.type.isAssignableFrom(delegate.class)) {
+        if (delegate == null || field.type.isAssignableFrom(delegate.class)) {
             field.set(proxy, delegate)
         } else
             throw new IllegalArgumentException("delegate class is not assignable to proxy");