You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by st...@apache.org on 2023/11/08 12:36:22 UTC
(openwebbeans) 03/03: OWB-1432 prevent ClassCastException
This is an automated email from the ASF dual-hosted git repository.
struberg pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/openwebbeans.git
commit 53aa4ef5abbda9747d577b392afb9d5c7a1a0803
Author: Mark Struberg <st...@apache.org>
AuthorDate: Wed Nov 8 13:35:32 2023 +0100
OWB-1432 prevent ClassCastException
if a custon InjectionTarget is set, then it has to do all interceptor stuff itself
as per the spec.
---
.../webbeans/container/ValidatingInjectionTargetFactory.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/webbeans-impl/src/main/java/org/apache/webbeans/container/ValidatingInjectionTargetFactory.java b/webbeans-impl/src/main/java/org/apache/webbeans/container/ValidatingInjectionTargetFactory.java
index 3a51cb5d9..eb0e5cc3b 100644
--- a/webbeans-impl/src/main/java/org/apache/webbeans/container/ValidatingInjectionTargetFactory.java
+++ b/webbeans-impl/src/main/java/org/apache/webbeans/container/ValidatingInjectionTargetFactory.java
@@ -46,7 +46,7 @@ public class ValidatingInjectionTargetFactory<T> extends InjectionTargetFactoryI
public InjectionTarget<T> createInjectionTarget(Bean<T> bean)
{
final AnnotatedType<T> annotatedType = getAnnotatedType();
- final InjectionTargetImpl<T> injectionTarget = (InjectionTargetImpl<T>) super.createInjectionTarget(bean);
+ final InjectionTarget<T> injectionTarget = super.createInjectionTarget(bean);
final Set<InjectionPoint> injectionPoints = injectionTarget.getInjectionPoints();
try
{
@@ -72,7 +72,10 @@ public class ValidatingInjectionTargetFactory<T> extends InjectionTargetFactoryI
});
}
- injectionTarget.defineInterceptorStack(bean, annotatedType, getWebBeansContext());
+ if (injectionTarget instanceof InjectionTargetImpl)
+ {
+ ((InjectionTargetImpl) injectionTarget).defineInterceptorStack(bean, annotatedType, getWebBeansContext());
+ }
}
return injectionTarget;