You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by mb...@apache.org on 2013/01/31 23:00:12 UTC

git commit: slight rework of logic; don't check for null where impossible

Updated Branches:
  refs/heads/master 8f040adec -> 724545729


slight rework of logic; don't check for null where impossible


Project: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/commit/72454572
Tree: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/tree/72454572
Diff: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/diff/72454572

Branch: refs/heads/master
Commit: 7245457291be2c881d6734265bf14309ca4bd802
Parents: 8f040ad
Author: mbenson <gu...@gmail.com>
Authored: Thu Jan 31 15:59:47 2013 -0600
Committer: mbenson <gu...@gmail.com>
Committed: Thu Jan 31 15:59:47 2013 -0600

----------------------------------------------------------------------
 .../core/util/context/AbstractContext.java         |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/72454572/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/context/AbstractContext.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/context/AbstractContext.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/context/AbstractContext.java
index 79b66d3..f810daa 100644
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/context/AbstractContext.java
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/context/AbstractContext.java
@@ -100,16 +100,15 @@ public abstract class AbstractContext implements Context
         Map<Object, ContextualInstanceInfo<?>> contextMap = storage.getStorage();
         ContextualInstanceInfo<?> contextualInstanceInfo = contextMap.get(storage.getBeanKey(bean));
 
-        T instance = null;
-
         if (contextualInstanceInfo != null)
         {
-            instance =  (T) contextualInstanceInfo.getContextualInstance();
-        }
+            @SuppressWarnings("unchecked")
+            final T instance =  (T) contextualInstanceInfo.getContextualInstance();
 
-        if (instance != null)
-        {
-            return instance;
+            if (instance != null)
+            {
+                return instance;
+            }
         }
 
         return storage.createContextualInstance(bean, creationalContext);