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 09:05:52 UTC

[2/2] 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/27923edf
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/27923edf
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/27923edf

Branch: refs/heads/STABLE-4.0
Commit: 27923edf88394ca4a0d51a8a3cb8b1357c1f934c
Parents: 3ef87c2
Author: Nikita Timofeev <st...@gmail.com>
Authored: Mon Jan 29 12:05:39 2018 +0300
Committer: Nikita Timofeev <st...@gmail.com>
Committed: Mon Jan 29 12:05:39 2018 +0300

----------------------------------------------------------------------
 .../dbsync/merge/context/EntityMergeSupport.java   | 17 +++++++++++++++++
 docs/doc/src/main/resources/RELEASE-NOTES.txt      |  1 +
 2 files changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/27923edf/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;
             }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/27923edf/docs/doc/src/main/resources/RELEASE-NOTES.txt
----------------------------------------------------------------------
diff --git a/docs/doc/src/main/resources/RELEASE-NOTES.txt b/docs/doc/src/main/resources/RELEASE-NOTES.txt
index 1524b5e..1212a99 100644
--- a/docs/doc/src/main/resources/RELEASE-NOTES.txt
+++ b/docs/doc/src/main/resources/RELEASE-NOTES.txt
@@ -25,6 +25,7 @@ CAY-2387 Can't select byte[] property with ColumnSelect
 CAY-2388 Modeler: Visualization issues with undo/redo actions for attributes and relationships
 CAY-2389 DbEntity qualifier with DbPath expression translates into wrong SQL
 CAY-2392 Modeler: Unable to remove DataNode
+CAY-2401 Modeler: NPE in ObjEntity sync action
 
 ----------------------------------
 Release: 4.0.B2