[jboss-svn-commits] JBL Code SVN: r36454 - in labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta: tests/src/org/jboss/soa/esb/listeners/message and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Dec 17 10:38:33 EST 2010


Author: tfennelly
Date: 2010-12-17 10:38:32 -0500 (Fri, 17 Dec 2010)
New Revision: 36454

Modified:
   labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/soa/esb/listeners/message/BeanContainerAction.java
   labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/message/BeanContainerActionUnitTest.java
Log:
https://issues.jboss.org/browse/JBESB-3548
BeanContainerAction not returning null when process method returns null

Modified: labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/soa/esb/listeners/message/BeanContainerAction.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/soa/esb/listeners/message/BeanContainerAction.java	2010-12-17 14:42:13 UTC (rev 36453)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/src/org/jboss/soa/esb/listeners/message/BeanContainerAction.java	2010-12-17 15:38:32 UTC (rev 36454)
@@ -191,6 +191,11 @@
 			}
 		}
 		
+		if(processResult == null && processMethod.getReturnType() != void.class) {
+			// Terminate the pipeline...
+			return null;
+		}
+		
 		if(processResult instanceof Message) {
 			return (Message) processResult;
 		} else if(processResult != null) {

Modified: labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/message/BeanContainerActionUnitTest.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/message/BeanContainerActionUnitTest.java	2010-12-17 14:42:13 UTC (rev 36453)
+++ labs/jbossesb/branches/JBESB_4_9_CP/product/rosetta/tests/src/org/jboss/soa/esb/listeners/message/BeanContainerActionUnitTest.java	2010-12-17 15:38:32 UTC (rev 36454)
@@ -253,6 +253,28 @@
 		}
 	}
 	
+	public void test_JBESB_3548_null_return() throws ConfigurationException, ActionProcessingException {
+		ConfigTree configTree = new ConfigTree("conf");
+		NullReturnAction action = new NullReturnAction();
+		
+		BeanContainerAction containerAction = new BeanContainerAction(action, configTree);
+		Message message = MessageFactory.getInstance().getMessage();
+		
+		message.getBody().add("BodyString");
+		assertNull(containerAction.process(message));
+	}
+	
+	public void test_JBESB_3548_void_return() throws ConfigurationException, ActionProcessingException {
+		ConfigTree configTree = new ConfigTree("conf");
+		VoidReturnAction action = new VoidReturnAction();
+		
+		BeanContainerAction containerAction = new BeanContainerAction(action, configTree);
+		Message message = MessageFactory.getInstance().getMessage();
+		
+		message.getBody().add("BodyString");
+		assertTrue(message == containerAction.process(message));
+	}
+	
 	public class EmptyBean {		
 	}
 	
@@ -385,6 +407,21 @@
 		}
 	}	
 	
+	public class NullReturnAction {
+		
+		@Process
+		public String process(String bodyString) {
+			return null;
+		}
+	}	
+	
+	public class VoidReturnAction {
+		
+		@Process
+		public void process(String bodyString) {
+		}
+	}	
+	
 	public class PayloadObj implements Serializable {
 		
 		private String name;



More information about the jboss-svn-commits mailing list