commit | a80e9e5df884206b43314ff88294a703caf0781a | [log] [tgz] |
---|---|---|
author | Tore Halset <torehalset@apache.org> | Sat Jan 26 00:47:38 2008 +0000 |
committer | Tore Halset <torehalset@apache.org> | Sat Jan 26 00:47:38 2008 +0000 |
tree | b47eb39eb7adc55649c2a9f1042603cb393da138 | |
parent | 3fb2abf357007c6e471e3469e919a8ebd1bc50a5 [diff] |
merge: backport junit fixes from trunk. * fix NPE in objEntity.getDbEntity() * fix psql case issue git-svn-id: https://svn.apache.org/repos/asf/cayenne/main/tags/3.0M3@615415 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/cayenne/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/AbstractToModelToken.java b/cayenne/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/AbstractToModelToken.java index 2c97ec1..9546e20 100644 --- a/cayenne/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/AbstractToModelToken.java +++ b/cayenne/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/AbstractToModelToken.java
@@ -50,6 +50,9 @@ Set<ObjEntity> objEntities = new HashSet<ObjEntity>(); MappingNamespace mns = entity.getDataMap().getNamespace(); for (ObjEntity objEntity : mns.getObjEntities()) { + if (objEntity.getDbEntity() == null) { + continue; + } if (objEntity.getDbEntity().equals(entity)) { objEntities.add(objEntity); }
diff --git a/cayenne/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/CreateTableToModelTest.java b/cayenne/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/CreateTableToModelTest.java index 3ffba7d..4ad9ff1 100644 --- a/cayenne/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/CreateTableToModelTest.java +++ b/cayenne/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/CreateTableToModelTest.java
@@ -60,6 +60,9 @@ ObjEntity objEntity = null; for (ObjEntity candiate : map.getObjEntities()) { + if (candiate.getDbEntity() == null) { + continue; + } if (candiate.getDbEntity().getName().equalsIgnoreCase(dbEntity.getName())) { objEntity = candiate; break; @@ -79,6 +82,8 @@ // clear up map.removeObjEntity(objEntity.getName(), true); map.removeDbEntity(dbEntity.getName(), true); + // fix psql case issue + map.removeDbEntity(objEntity.getDbEntity().getName(), true); ctxt.getEntityResolver().clearCache(); assertNull(map.getObjEntity(objEntity.getName())); assertNull(map.getDbEntity(dbEntity.getName()));