cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject cayenne git commit: Fixed NullPointerException in validator + Cleanup inheritance-vertical.map.xml
Date Thu, 20 Apr 2017 13:08:11 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master 0e6f0df17 -> 72889dbbc


Fixed NullPointerException in validator
 + Cleanup inheritance-vertical.map.xml


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/72889dbb
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/72889dbb
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/72889dbb

Branch: refs/heads/master
Commit: 72889dbbc4191bef2dce7cb405ab41345c578eb4
Parents: 0e6f0df
Author: Nikita Timofeev <stariy95@gmail.com>
Authored: Thu Apr 20 16:07:47 2017 +0300
Committer: Nikita Timofeev <stariy95@gmail.com>
Committed: Thu Apr 20 16:07:47 2017 +0300

----------------------------------------------------------------------
 .../project/validation/DbRelationshipValidator.java |  3 ++-
 .../testdo/inheritance_vertical/auto/_IvImpl.java   |  1 +
 .../testdo/inheritance_vertical/auto/_IvOther.java  | 16 ----------------
 .../src/test/resources/inheritance-vertical.map.xml |  6 +-----
 4 files changed, 4 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/72889dbb/cayenne-project/src/main/java/org/apache/cayenne/project/validation/DbRelationshipValidator.java
----------------------------------------------------------------------
diff --git a/cayenne-project/src/main/java/org/apache/cayenne/project/validation/DbRelationshipValidator.java
b/cayenne-project/src/main/java/org/apache/cayenne/project/validation/DbRelationshipValidator.java
index 5b84cfc..51d868c 100644
--- a/cayenne-project/src/main/java/org/apache/cayenne/project/validation/DbRelationshipValidator.java
+++ b/cayenne-project/src/main/java/org/apache/cayenne/project/validation/DbRelationshipValidator.java
@@ -113,7 +113,8 @@ class DbRelationshipValidator extends ConfigurationNodeValidator {
 
     private void checkTypesOfAttributesInRelationship(DbRelationship relationship, ValidationResult
validationResult) {
         for (DbJoin join: relationship.getJoins()) {
-            if (join.getSource().getType() != join.getTarget().getType()) {
+            if (join.getSource() != null && join.getTarget() != null
+                    && join.getSource().getType() != join.getTarget().getType())
{
                 addFailure(
                         validationResult,
                         relationship,

http://git-wip-us.apache.org/repos/asf/cayenne/blob/72889dbb/cayenne-server/src/test/java/org/apache/cayenne/testdo/inheritance_vertical/auto/_IvImpl.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/inheritance_vertical/auto/_IvImpl.java
b/cayenne-server/src/test/java/org/apache/cayenne/testdo/inheritance_vertical/auto/_IvImpl.java
index 421bae9..a6aee01 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/inheritance_vertical/auto/_IvImpl.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/inheritance_vertical/auto/_IvImpl.java
@@ -43,6 +43,7 @@ public abstract class _IvImpl extends IvBase {
         return (IvOther)readProperty("other1");
     }
 
+
     public void setOther2(IvOther other2) {
         setToOneTarget("other2", other2, true);
     }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/72889dbb/cayenne-server/src/test/java/org/apache/cayenne/testdo/inheritance_vertical/auto/_IvOther.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/inheritance_vertical/auto/_IvOther.java
b/cayenne-server/src/test/java/org/apache/cayenne/testdo/inheritance_vertical/auto/_IvOther.java
index 00508b9..d26c639 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/inheritance_vertical/auto/_IvOther.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/inheritance_vertical/auto/_IvOther.java
@@ -1,10 +1,7 @@
 package org.apache.cayenne.testdo.inheritance_vertical.auto;
 
-import java.util.List;
-
 import org.apache.cayenne.CayenneDataObject;
 import org.apache.cayenne.exp.Property;
-import org.apache.cayenne.testdo.inheritance_vertical.IvImpl;
 
 /**
  * Class _IvOther was generated by Cayenne.
@@ -19,7 +16,6 @@ public abstract class _IvOther extends CayenneDataObject {
     public static final String ID_PK_COLUMN = "ID";
 
     public static final Property<String> NAME = Property.create("name", String.class);
-    public static final Property<List<IvImpl>> IMPLS = Property.create("impls",
List.class);
 
     public void setName(String name) {
         writeProperty("name", name);
@@ -28,16 +24,4 @@ public abstract class _IvOther extends CayenneDataObject {
         return (String)readProperty("name");
     }
 
-    public void addToImpls(IvImpl obj) {
-        addToManyTarget("impls", obj, true);
-    }
-    public void removeFromImpls(IvImpl obj) {
-        removeToManyTarget("impls", obj, true);
-    }
-    @SuppressWarnings("unchecked")
-    public List<IvImpl> getImpls() {
-        return (List<IvImpl>)readProperty("impls");
-    }
-
-
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/72889dbb/cayenne-server/src/test/resources/inheritance-vertical.map.xml
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/resources/inheritance-vertical.map.xml b/cayenne-server/src/test/resources/inheritance-vertical.map.xml
index 89e41ac..14047a2 100644
--- a/cayenne-server/src/test/resources/inheritance-vertical.map.xml
+++ b/cayenne-server/src/test/resources/inheritance-vertical.map.xml
@@ -68,7 +68,7 @@
 		<db-attribute name="SUB2_NAME" type="VARCHAR" length="100"/>
 	</db-entity>
 	<db-entity name="IV_SUB3">
-		<db-attribute name="ID" type="BIGINT" isPrimaryKey="true" isMandatory="true"/>
+		<db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
 		<db-attribute name="IV_ROOT_ID" type="INTEGER" isMandatory="true"/>
 	</db-entity>
 	<obj-entity name="Iv1Root" className="org.apache.cayenne.testdo.inheritance_vertical.Iv1Root"
dbEntityName="IV1_ROOT">
@@ -174,9 +174,6 @@
 	<db-relationship name="other2" source="IV_IMPL" target="IV_OTHER" toMany="false">
 		<db-attribute-pair source="OTHER2_ID" target="ID"/>
 	</db-relationship>
-	<db-relationship name="impls" source="IV_OTHER" target="IV_IMPL" toMany="true">
-		<db-attribute-pair source="ID" target="OTHER_ID"/>
-	</db-relationship>
 	<db-relationship name="ivSub3s" source="IV_ROOT" target="IV_SUB3" toMany="true">
 		<db-attribute-pair source="ID" target="IV_ROOT_ID"/>
 	</db-relationship>
@@ -209,6 +206,5 @@
 	<obj-relationship name="parent" source="IvConcrete" target="IvConcrete" deleteRule="Nullify"
db-relationship-path="parent"/>
 	<obj-relationship name="other1" source="IvImpl" target="IvOther" deleteRule="Nullify"
db-relationship-path="impl.other1"/>
 	<obj-relationship name="other2" source="IvImpl" target="IvOther" deleteRule="Nullify"
db-relationship-path="impl.other2"/>
-	<obj-relationship name="impls" source="IvOther" target="IvImpl" deleteRule="Deny" db-relationship-path="impls.base"/>
 	<obj-relationship name="ivRoot" source="IvSub3" target="IvRoot" deleteRule="Nullify"
db-relationship-path="sub3.ivRoot1"/>
 </data-map>


Mime
View raw message