You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2006/03/23 13:29:47 UTC

svn commit: r388154 - /incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/components/util/PojoSupport.java

Author: gnodet
Date: Thu Mar 23 04:29:44 2006
New Revision: 388154

URL: http://svn.apache.org/viewcvs?rev=388154&view=rev
Log:
Keep the reference to the DeliveryChannel so that meaningful exceptions are thrown when the channel is closed (instead of NPE)

Modified:
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/components/util/PojoSupport.java

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/components/util/PojoSupport.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/components/util/PojoSupport.java?rev=388154&r1=388153&r2=388154&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/components/util/PojoSupport.java (original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/components/util/PojoSupport.java Thu Mar 23 04:29:44 2006
@@ -54,6 +54,7 @@
     private MessageExchangeFactory exchangeFactory;
     private String description = "POJO Component";
     private ServiceEndpoint serviceEndpoint;
+    private DeliveryChannel channel;
     
     protected PojoSupport() {
     }
@@ -80,6 +81,7 @@
      */
     public void init(ComponentContext cc) throws JBIException {
         this.context = cc;
+        this.channel = this.context.getDeliveryChannel();
         init();
         if (service != null && endpoint != null) {
             serviceEndpoint = context.activateEndpoint(service, endpoint);
@@ -187,10 +189,10 @@
     }
 
     public DeliveryChannel getDeliveryChannel() throws MessagingException {
-        if (context == null) {
+        if (channel == null) {
             throw new NotInitialisedYetException();
         }
-        return context.getDeliveryChannel();
+        return channel;
     }
 
     /**