diff options
author | Jon Marius Venstad <jonmv@users.noreply.github.com> | 2022-11-01 10:22:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-01 10:22:14 +0100 |
commit | cfb5e8320b1c75b3b2da0f8bf1d845b536796b82 (patch) | |
tree | e47e6ff7514bef565cc91834f1c3d97df187e4f8 /container-core | |
parent | 83f41448b3a87b322c8fa8f065afecd1d92cf837 (diff) | |
parent | 7385bf58448a9e006486cd07bfb8701b201d82a5 (diff) |
Merge pull request #24586 from vespa-engine/jonmv/use-classes-as-keys
Jonmv/use classes as keys
Diffstat (limited to 'container-core')
-rw-r--r-- | container-core/src/main/java/com/yahoo/osgi/OsgiImpl.java | 2 | ||||
-rw-r--r-- | container-core/src/main/java/com/yahoo/processing/request/CloneHelper.java | 16 |
2 files changed, 3 insertions, 15 deletions
diff --git a/container-core/src/main/java/com/yahoo/osgi/OsgiImpl.java b/container-core/src/main/java/com/yahoo/osgi/OsgiImpl.java index 1e171a19b05..2c7a0c2b86b 100644 --- a/container-core/src/main/java/com/yahoo/osgi/OsgiImpl.java +++ b/container-core/src/main/java/com/yahoo/osgi/OsgiImpl.java @@ -57,7 +57,7 @@ public class OsgiImpl implements Osgi { return jdiscOsgi.getBundles(alwaysCurrentBundle); } - public Class<Object> resolveClass(BundleInstantiationSpecification spec) { + public Class<?> resolveClass(BundleInstantiationSpecification spec) { Bundle bundle = getBundle(spec.bundle); if (bundle != null) { return resolveFromBundle(spec, bundle); diff --git a/container-core/src/main/java/com/yahoo/processing/request/CloneHelper.java b/container-core/src/main/java/com/yahoo/processing/request/CloneHelper.java index 4ee8df0c249..d758aff0501 100644 --- a/container-core/src/main/java/com/yahoo/processing/request/CloneHelper.java +++ b/container-core/src/main/java/com/yahoo/processing/request/CloneHelper.java @@ -96,20 +96,8 @@ public class CloneHelper { return ((HashMap<?, ?>) object).clone(); else if (object instanceof HashSet) return ((HashSet<?>) object).clone(); - try { - return cloneByReflection(object); - } catch (IllegalArgumentException e) { - if ( ! ( e.getCause() instanceof ClassCastException - || Objects.requireNonNullElse(e.getMessage(), "").startsWith("java.lang.ClassCastException"))) - throw e; - - // When changing bundles you might end up having cached the old method pointing to old bundle, - // That might then lead to a class cast exception when invoking the wrong clone method. - // So we will give dropping the cache a try, and retry the clone. - cloneMethodCache.clear(); - return cloneByReflection(object); - } - + + return cloneByReflection(object); } private Object cloneByReflection(Object object) { |