openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1798870 - /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerImpl.java
Date Thu, 15 Jun 2017 19:45:23 GMT
Author: struberg
Date: Thu Jun 15 19:45:23 2017
New Revision: 1798870

URL: http://svn.apache.org/viewvc?rev=1798870&view=rev
Log:
OWB-1182 only one of configureProducer and setProducer must be invoked on an event

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerImpl.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerImpl.java?rev=1798870&r1=1798869&r2=1798870&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerImpl.java
Thu Jun 15 19:45:23 2017
@@ -43,6 +43,8 @@ public class ProcessProducerImpl<X,T> ex
     private Producer<T> producer = null;
 
     private ProducerConfiguratorImpl<T> producerConfigurator = null;
+
+    private boolean customProducerSet = false;
     
     public ProcessProducerImpl(Producer<T> producer,AnnotatedMember<X> annotateMember)
     {
@@ -64,6 +66,11 @@ public class ProcessProducerImpl<X,T> ex
     public ProducerConfigurator<T> configureProducer()
     {
         checkState();
+        if (customProducerSet)
+        {
+            throw new IllegalStateException("Only one of setProducer() and configureProducer()
must be used!");
+        }
+
         this.producerConfigurator = new ProducerConfiguratorImpl<>();
         this.producer = null;
         return producerConfigurator;
@@ -100,7 +107,11 @@ public class ProcessProducerImpl<X,T> ex
     public void setProducer(Producer<T> producer)
     {
         checkState();
+        if (this.producerConfigurator != null)
+        {
+            throw new IllegalStateException("Only one of setProducer() and configureProducer()
must be used!");
+        }
         this.producer = producer;
-        this.producerConfigurator = null;
+        customProducerSet = true;
     }
 }



Mime
View raw message