servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r781836 - in /servicemix/smx4/nmr/trunk/jbi/deployer/src: main/java/org/apache/servicemix/jbi/deployer/artifacts/AssemblyReferencesListener.java test/java/org/apache/servicemix/jbi/deployer/artifacts/AssemblyReferencesListenerTest.java
Date Thu, 04 Jun 2009 19:30:41 GMT
Author: gertv
Date: Thu Jun  4 19:30:41 2009
New Revision: 781836

URL: http://svn.apache.org/viewvc?rev=781836&view=rev
Log:
SMX4NMR-136: Avoid NPE in AssemblyReferencesListener when sending from Endpoint with unknown
SA

Modified:
    servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/artifacts/AssemblyReferencesListener.java
    servicemix/smx4/nmr/trunk/jbi/deployer/src/test/java/org/apache/servicemix/jbi/deployer/artifacts/AssemblyReferencesListenerTest.java

Modified: servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/artifacts/AssemblyReferencesListener.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/artifacts/AssemblyReferencesListener.java?rev=781836&r1=781835&r2=781836&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/artifacts/AssemblyReferencesListener.java
(original)
+++ servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/artifacts/AssemblyReferencesListener.java
Thu Jun  4 19:30:41 2009
@@ -107,7 +107,9 @@
 
     private void pending(InternalExchange exchange) {
         ServiceAssembly assembly = endpoints.get(exchange.getSource());
-        pending.put(exchange, assembly);
+        if (assembly != null) {
+          pending.put(exchange, assembly);
+        }
     }
 
     public void exchangeDelivered(Exchange exchange) {

Modified: servicemix/smx4/nmr/trunk/jbi/deployer/src/test/java/org/apache/servicemix/jbi/deployer/artifacts/AssemblyReferencesListenerTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/test/java/org/apache/servicemix/jbi/deployer/artifacts/AssemblyReferencesListenerTest.java?rev=781836&r1=781835&r2=781836&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/deployer/src/test/java/org/apache/servicemix/jbi/deployer/artifacts/AssemblyReferencesListenerTest.java
(original)
+++ servicemix/smx4/nmr/trunk/jbi/deployer/src/test/java/org/apache/servicemix/jbi/deployer/artifacts/AssemblyReferencesListenerTest.java
Thu Jun  4 19:30:41 2009
@@ -115,6 +115,20 @@
         assertEquals(Status.Error, exchange.getStatus());
     }
 
+    public void testNoExceptionsOnUnknownExchange() throws Exception {
+        AssemblyReferencesListener listener = new AssemblyReferencesListener();
+        InternalEndpoint endpoint = new InternalEndpointWrapper(new EndpointImpl(ServiceHelper.createMap(Endpoint.ENDPOINT_NAME,
"endpoint")),
+                                                                ServiceHelper.createMap(Endpoint.ENDPOINT_NAME,
"internal-endpoint"));
+        
+        InternalExchange exchange = new ExchangeImpl(Pattern.InOnly);
+        exchange.setSource(endpoint);
+        exchange.setProperty(DeliveryChannelImpl.SEND_SYNC, Boolean.TRUE);
+        exchange.getConsumerLock(true);
+        
+        // this should not throw an exception
+        listener.exchangeSent(exchange);
+    }
+
     private ServiceAssemblyImpl createServiceAssembly() {
         ServiceAssemblyDesc descriptor = DescriptorFactory.buildDescriptor(DescriptorFactory.class.getResource("serviceAssembly.xml")).getServiceAssembly();
         final Preferences prefs = createMock(Preferences.class);



Mime
View raw message