From 8974a099084986706a14419fa3e2298541ee50e1 Mon Sep 17 00:00:00 2001 From: "A. Abram White" Date: Fri, 16 Feb 2007 16:02:05 +0000 Subject: [PATCH] Only substantive change is flipping the order of the args in an ImplHelper.isAssignable call in FetchConfigurationImpl. We want to test whether the type we're traversing to is derived from the type we're traversing from. git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@508459 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/openjpa/kernel/FetchConfigurationImpl.java | 2 +- .../src/main/java/org/apache/openjpa/util/ImplHelper.java | 6 +++--- .../src/main/java/org/apache/openjpa/util/OpenJPAId.java | 7 ++++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java index fb17730c2..fed646a71 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java @@ -558,7 +558,7 @@ public class FetchConfigurationImpl // see if there's a previous limit int avail = Integer.MIN_VALUE; for (FetchConfigurationImpl f = this; f != null; f = f._parent) { - if (ImplHelper.isAssignable(type, f._fromType)) { + if (ImplHelper.isAssignable(f._fromType, type)) { avail = f._availableRecursion; if (traverse) avail = reduce(avail); diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/util/ImplHelper.java b/openjpa-kernel/src/main/java/org/apache/openjpa/util/ImplHelper.java index 415c07bb9..a3c44bd35 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/util/ImplHelper.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/util/ImplHelper.java @@ -205,11 +205,11 @@ public class ImplHelper { * @return true if the "to" class is assignable to the "from" class */ public static boolean isAssignable(Class from, Class to) { - Boolean isAssignable = null; if (from == null || to == null) return false; - Map assignableTo = (Map) _assignableTypes.get(from); + Boolean isAssignable = null; + Map assignableTo = (Map) _assignableTypes.get(from); if (assignableTo == null) { // "to" cache doesn't exist, so create it... assignableTo = new ConcurrentHashMap(); _assignableTypes.put(from, assignableTo); @@ -218,7 +218,7 @@ public class ImplHelper { } if (isAssignable == null) {// we don't have a record of this pair... - isAssignable = new Boolean(from.isAssignableFrom(to)); + isAssignable = Boolean.valueOf(from.isAssignableFrom(to)); assignableTo.put(to, isAssignable); } diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/util/OpenJPAId.java b/openjpa-kernel/src/main/java/org/apache/openjpa/util/OpenJPAId.java index f2c081b20..92749f173 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/util/OpenJPAId.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/util/OpenJPAId.java @@ -28,15 +28,16 @@ import org.apache.openjpa.lib.util.concurrent.ConcurrentReferenceHashMap; public abstract class OpenJPAId implements Comparable, Serializable { + // cache the types' generated hashcodes + private static ConcurrentReferenceHashMap _typeCache = + new ConcurrentReferenceHashMap(ReferenceMap.WEAK, ReferenceMap.HARD); + protected Class type; protected boolean subs = true; // type has his based on the least-derived non-object class so that // user-given ids with non-exact types match ids with exact types private transient int _typeHash = 0; - // cache the types' generated hashcodes - private static ConcurrentReferenceHashMap _typeCache = - new ConcurrentReferenceHashMap(ReferenceMap.WEAK, ReferenceMap.HARD); protected OpenJPAId() { }