openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1682375 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable: BaseProducerProducer.java BeanMetadataProducer.java EventProducer.java
Date Fri, 29 May 2015 07:05:50 GMT
Author: struberg
Date: Fri May 29 07:05:50 2015
New Revision: 1682375

URL: http://svn.apache.org/r1682375
Log:
OWB-989 fix potential NPE and dead code

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/BaseProducerProducer.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/BeanMetadataProducer.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/EventProducer.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/BaseProducerProducer.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/BaseProducerProducer.java?rev=1682375&r1=1682374&r2=1682375&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/BaseProducerProducer.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/BaseProducerProducer.java
Fri May 29 07:05:50 2015
@@ -127,7 +127,10 @@ public abstract class BaseProducerProduc
             }
             finally
             {
-                parentCreationalContext.release();
+                if (parentCreationalContext != null)
+                {
+                    parentCreationalContext.release();
+                }
             }
         }
     }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/BeanMetadataProducer.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/BeanMetadataProducer.java?rev=1682375&r1=1682374&r2=1682375&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/BeanMetadataProducer.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/BeanMetadataProducer.java
Fri May 29 07:05:50 2015
@@ -31,11 +31,6 @@ public class BeanMetadataProducer<T> ext
     @Override
     protected Contextual<T> produce(Map<Interceptor<?>, ?> interceptors,
CreationalContextImpl<Contextual<T>> creationalContext)
     {
-        if (!(creationalContext instanceof CreationalContextImpl))
-        {
-            // TODO What to do here?
-            throw new IllegalStateException("MetadataProducer does work only with CreationalContextImpl");
-        }
         CreationalContextImpl<T> contextImpl = (CreationalContextImpl<T>)creationalContext;
         return contextImpl.getBean();
     }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/EventProducer.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/EventProducer.java?rev=1682375&r1=1682374&r2=1682375&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/EventProducer.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/EventProducer.java
Fri May 29 07:05:50 2015
@@ -79,15 +79,9 @@ public class EventProducer<T> extends Ab
     protected Event<T> produce(Map<Interceptor<?>, ?> interceptors, CreationalContextImpl<Event<T>>
creationalContext)
     {
         Event<T> instance = null;
-        InjectionPoint injectionPoint = null;
-        //TODO What should we do here if creationalContext is not instanceof CreationalContextImpl?
-        if (creationalContext instanceof CreationalContextImpl)
-        {
-            injectionPoint = ((CreationalContextImpl<Event<T>>)creationalContext).getInjectionPoint();
-        }
-
         Type eventType;
-        
+
+        InjectionPoint injectionPoint = creationalContext.getInjectionPoint();
         if(injectionPoint != null)
         {
             Type[] eventActualTypeArgs;
@@ -114,12 +108,8 @@ public class EventProducer<T> extends Ab
             }           
             finally
             {
-                if (creationalContext instanceof CreationalContextImpl)
-                {
-                    ((CreationalContextImpl<Event<T>>)creationalContext).removeInjectionPoint();
-                }
+                creationalContext.removeInjectionPoint();
             }
-            
         }
                         
         return instance;



Mime
View raw message