You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by st...@apache.org on 2012/08/08 12:09:18 UTC
git commit: DELTASPIKE-254 could now be boolean even
Updated Branches:
refs/heads/master 7101eac54 -> 2b038d4d0
DELTASPIKE-254 could now be boolean even
Project: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/commit/2b038d4d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/tree/2b038d4d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/diff/2b038d4d
Branch: refs/heads/master
Commit: 2b038d4d0ce84426396ea995230e6474633c0b42
Parents: 7101eac
Author: Mark Struberg <st...@apache.org>
Authored: Wed Aug 8 12:08:21 2012 +0200
Committer: Mark Struberg <st...@apache.org>
Committed: Wed Aug 8 12:08:21 2012 +0200
----------------------------------------------------------------------
.../impl/exclude/extension/ExcludeExtension.java | 32 ++++++--------
1 files changed, 14 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/2b038d4d/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exclude/extension/ExcludeExtension.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exclude/extension/ExcludeExtension.java b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exclude/extension/ExcludeExtension.java
index fcf834e..49c17d2 100644
--- a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exclude/extension/ExcludeExtension.java
+++ b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exclude/extension/ExcludeExtension.java
@@ -59,11 +59,11 @@ public class ExcludeExtension implements Extension, Deactivatable
{
private static final Logger LOG = Logger.getLogger(ExcludeExtension.class.getName());
- private static Boolean isOwbDetected = null;
+ private static Boolean isOwbDetected = false;
- private Boolean isActivated = true;
- private Boolean isGlobalAlternativeActivated = true;
- private Boolean isCustomProjectStageBeanFilterActivated = true;
+ private boolean isActivated = true;
+ private boolean isGlobalAlternativeActivated = true;
+ private boolean isCustomProjectStageBeanFilterActivated = true;
@SuppressWarnings("UnusedDeclaration")
protected void init(@Observes BeforeBeanDiscovery beforeBeanDiscovery)
@@ -76,6 +76,8 @@ public class ExcludeExtension implements Extension, Deactivatable
isCustomProjectStageBeanFilterActivated =
ClassDeactivationUtils.isActivated(CustomProjectStageBeanFilter.class);
+
+ isOwbDetected = isOpenWebBeans();
}
/**
@@ -98,8 +100,6 @@ public class ExcludeExtension implements Extension, Deactivatable
//we need to do it before the exclude logic to keep the @Exclude support for global alternatives
if (isGlobalAlternativeActivated)
{
- detectCdiImplementation();
-
if (isOwbDetected)
{
activateGlobalAlternativesOwb(processAnnotatedType, beanManager);
@@ -522,22 +522,18 @@ public class ExcludeExtension implements Extension, Deactivatable
processAnnotatedType.getAnnotatedType().getJavaClass());
}
- private void detectCdiImplementation()
+ private boolean isOpenWebBeans()
{
- if (isOwbDetected == null)
- {
- isOwbDetected = false;
+ IllegalStateException runtimeException = new IllegalStateException();
- IllegalStateException runtimeException = new IllegalStateException();
-
- for (StackTraceElement element : runtimeException.getStackTrace())
+ for (StackTraceElement element : runtimeException.getStackTrace())
+ {
+ if (element.toString().contains("org.apache.webbeans."))
{
- if (element.toString().contains("org.apache.webbeans."))
- {
- isOwbDetected = true;
- break;
- }
+ return true;
}
}
+
+ return false;
}
}