You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by nt...@apache.org on 2018/01/29 14:02:01 UTC
[3/3] cayenne git commit: CAY-2401 Modeler: NPE in ObjEntity sync
action
CAY-2401 Modeler: NPE in ObjEntity sync action
Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/5cbb4f08
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/5cbb4f08
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/5cbb4f08
Branch: refs/heads/master
Commit: 5cbb4f0891a55a9c48206582e8142d90d6f72b5b
Parents: 29ef71c
Author: Nikita Timofeev <st...@gmail.com>
Authored: Mon Jan 29 17:01:34 2018 +0300
Committer: Nikita Timofeev <st...@gmail.com>
Committed: Mon Jan 29 17:01:34 2018 +0300
----------------------------------------------------------------------
RELEASE-NOTES.txt | 1 +
.../dbsync/merge/context/EntityMergeSupport.java | 17 +++++++++++++++++
2 files changed, 18 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cayenne/blob/5cbb4f08/RELEASE-NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 4f15920..a41b221 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -32,6 +32,7 @@ CAY-2388 Modeler: Visualization issues with undo/redo actions for attributes and
CAY-2389 DbEntity qualifier with DbPath expression translates into wrong SQL
CAY-2392 Modeler: Unable to remove DataNode
CAY-2397 Modeler: Unable to set enum:value as Entity qualifier
+CAY-2401 Modeler: NPE in ObjEntity sync action
----------------------------------
Release: 4.1.M1
http://git-wip-us.apache.org/repos/asf/cayenne/blob/5cbb4f08/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/context/EntityMergeSupport.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/context/EntityMergeSupport.java b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/context/EntityMergeSupport.java
index 09bdae3..0b405d1 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/context/EntityMergeSupport.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/context/EntityMergeSupport.java
@@ -429,6 +429,23 @@ public class EntityMergeSupport {
for(int i=0; i<collection1.size(); i++) {
DbAttribute attr1 = iterator1.next();
DbAttribute attr2 = iterator2.next();
+ // attribute can be null, see DbJoin.getSource() and DbJoin.getTarget()
+ if(attr1 == null) {
+ if(attr2 != null) {
+ return false;
+ }
+ continue;
+ }
+ if(attr2 == null) {
+ return false;
+ }
+ // name is unlikely to be null, but we don't want NPE anyway
+ if(attr1.getName() == null) {
+ if(attr2.getName() != null) {
+ return false;
+ }
+ continue;
+ }
if(!attr1.getName().equals(attr2.getName())) {
return false;
}