polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paulmer...@apache.org
Subject [1/2] polygene-java git commit: Fix NPE in AssociationInstance.set(T)
Date Sun, 21 May 2017 15:44:07 GMT
Repository: polygene-java
Updated Branches:
  refs/heads/develop 84a794d29 -> ea8b7092f


Fix NPE in AssociationInstance.set(T)


Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/7c6bc1b8
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/7c6bc1b8
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/7c6bc1b8

Branch: refs/heads/develop
Commit: 7c6bc1b8326aafcbeb5feac13da70153e9cd78f5
Parents: 84a794d
Author: Paul Merlin <paulmerlin@apache.org>
Authored: Sun May 21 17:40:33 2017 +0200
Committer: Paul Merlin <paulmerlin@apache.org>
Committed: Sun May 21 17:40:33 2017 +0200

----------------------------------------------------------------------
 .../polygene/runtime/association/AssociationInstance.java      | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/7c6bc1b8/core/runtime/src/main/java/org/apache/polygene/runtime/association/AssociationInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/association/AssociationInstance.java
b/core/runtime/src/main/java/org/apache/polygene/runtime/association/AssociationInstance.java
index 6d5f6fe..551bce7 100644
--- a/core/runtime/src/main/java/org/apache/polygene/runtime/association/AssociationInstance.java
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/association/AssociationInstance.java
@@ -27,6 +27,7 @@ import org.apache.polygene.api.association.AssociationDescriptor;
 import org.apache.polygene.api.association.AssociationWrapper;
 import org.apache.polygene.api.entity.EntityReference;
 import org.apache.polygene.api.identity.HasIdentity;
+import org.apache.polygene.api.identity.Identity;
 import org.apache.polygene.api.property.Property;
 
 /**
@@ -64,7 +65,10 @@ public final class AssociationInstance<T>
         associationInfo.checkConstraints( newValue );
 
         // Change association
-        associationState.set( EntityReference.create( ((HasIdentity) newValue ).identity().get()));
+        Identity identity = newValue != null
+                            ? ( (HasIdentity) newValue ).identity().get()
+                            : null;
+        associationState.set( EntityReference.create( identity ) );
     }
 
     @Override


Mime
View raw message