diff options
author | Brian S. O'Neill <bronee@gmail.com> | 2008-12-26 20:09:59 +0000 |
---|---|---|
committer | Brian S. O'Neill <bronee@gmail.com> | 2008-12-26 20:09:59 +0000 |
commit | 13fc667eeb9cd108f9d0e8d5019cdbd949d3cab9 (patch) | |
tree | 0989b771683071c0da6c99c717c372abf23cfb4d /src/main/java/com/amazon/carbonado/info | |
parent | 0d3c1f9f58f52355a38c363554f0c05430078bef (diff) |
Less rigorous join checks if joined storable is malformed.
Diffstat (limited to 'src/main/java/com/amazon/carbonado/info')
-rw-r--r-- | src/main/java/com/amazon/carbonado/info/StorableIntrospector.java | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/main/java/com/amazon/carbonado/info/StorableIntrospector.java b/src/main/java/com/amazon/carbonado/info/StorableIntrospector.java index ce3a24e..2b9b1fc 100644 --- a/src/main/java/com/amazon/carbonado/info/StorableIntrospector.java +++ b/src/main/java/com/amazon/carbonado/info/StorableIntrospector.java @@ -2569,9 +2569,14 @@ public class StorableIntrospector { Set<StorableProperty> primaryKey =
new HashSet<StorableProperty>(joinedInfo.getPrimaryKeyProperties().values());
- // Remove external properties from the primary key set.
- for (int i=0; i<mInternal.length; i++) {
- primaryKey.remove(getExternalJoinElement(i));
+ if (primaryKey.size() == 0) {
+ // Assume another error prevented primary key from being defined.
+ primaryKey = null;
+ } else {
+ // Remove external properties from the primary key set.
+ for (int i=0; i<mInternal.length; i++) {
+ primaryKey.remove(getExternalJoinElement(i));
+ }
}
// Do similar test for alternate keys.
@@ -2593,18 +2598,20 @@ public class StorableIntrospector { altKey.add(chained.getPrimeProperty());
}
- altKeys.add(altKey);
+ if (altKey.size() > 0) {
+ altKeys.add(altKey);
- // Remove external properties from the alternate key set.
- for (int j=0; j<mInternal.length; j++) {
- altKey.remove(getExternalJoinElement(j));
+ // Remove external properties from the alternate key set.
+ for (int j=0; j<mInternal.length; j++) {
+ altKey.remove(getExternalJoinElement(j));
+ }
}
}
if (isQuery()) {
// Key of joined object must not be completely specified.
- if (primaryKey.size() <= 0) {
+ if (primaryKey != null && primaryKey.size() <= 0) {
errorMessages.add
("Join property \"" + getName() +
"\" completely specifies primary key of joined object; " +
@@ -2627,7 +2634,7 @@ public class StorableIntrospector { fullKeyCheck:
{
- if (primaryKey.size() <= 0) {
+ if (primaryKey == null || primaryKey.size() <= 0) {
break fullKeyCheck;
}
|