[jboss-svn-commits] JBL Code SVN: r24371 - labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sun Dec 14 11:33:09 EST 2008


Author: mark.little at jboss.com
Date: 2008-12-14 11:33:08 -0500 (Sun, 14 Dec 2008)
New Revision: 24371

Modified:
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/SystemPrintln.java
Log:
https://jira.jboss.org/jira/browse/JBESB-2219

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/SystemPrintln.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/SystemPrintln.java	2008-12-13 14:37:50 UTC (rev 24370)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/SystemPrintln.java	2008-12-14 16:33:08 UTC (rev 24371)
@@ -19,11 +19,8 @@
  */
 package org.jboss.soa.esb.actions;
 
-import java.io.File;
-import java.io.FileOutputStream;
 import java.io.PrintStream;
 
-import org.apache.log4j.Logger;
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.message.Message;
 import org.jboss.soa.esb.message.MessagePayloadProxy;
@@ -79,61 +76,75 @@
 	 */
 	public Message process(Message message) throws ActionProcessingException
 	{
-        Object messageObject = null;
-        try {
-            messageObject = payloadProxy.getPayload(message);
-        } catch (MessageDeliverException e) {
-            throw new ActionProcessingException(e);
-        }
+	    Object messageObject = null;
+	    try {
+	        messageObject = payloadProxy.getPayload(message);
+	    } catch (MessageDeliverException e) {
+	        throw new ActionProcessingException(e);
+	    }
 
-		PrintStream stream = (useOutputStream ? System.out : System.err);
-		
-		stream.println(printlnMessage + ": ");
-        
-        String messageStr=null;
-		
-		if (printFullMessage && (message != null))
-		{
-			// the message should be responsible for converting itself to a string
-            messageStr = message.toString();
-			stream.println("[ "+messageStr+" ]");
-            
-		}
-		else
-		{
-			if (messageObject instanceof byte[])
-			{
-                messageStr = Util.format(new String((byte[]) messageObject));
-				stream.println("[" + messageStr + "].");
-			}
-			else
-			{
-				if (messageObject != null) {
-                    messageStr = Util.format(messageObject.toString());
-					stream.println("[" + messageStr + "].");
-                }
-				for (int i = 0; i < message.getAttachment().getUnnamedCount(); i++)
-				{
-					Message attachedMessage = (Message) message.getAttachment()
-							.itemAt(i);
-                    try {
-                        Object payload = payloadProxy.getPayload(attachedMessage);
-                        if(payload instanceof byte[]) {
-                            stream.println("attachment " + i + ": ["
-                                    + new String((byte[]) payload)
-                                    + "].");
-                        } else {
-                            stream.println("attachment " + i + ": ["
-                                    + payload
-                                    + "].");
-                        }
-                    } catch (MessageDeliverException e) {
-                        throw new ActionProcessingException(e);
-                    }
-                }
-			}
-		}
-		return message;
+	    PrintStream stream = (useOutputStream ? System.out : System.err);
+
+	    stream.println(printlnMessage + ": ");
+
+	    String messageStr=null;
+
+	    if (printFullMessage && (message != null))
+	    {
+	        // the message should be responsible for converting itself to a string
+	        messageStr = message.toString();
+	        stream.println("[ "+messageStr+" ]");
+
+	    }
+	    else
+	    {
+	        if (messageObject instanceof byte[])
+	        {
+	            messageStr = Util.format(new String((byte[]) messageObject));
+	            stream.println("[" + messageStr + "].");
+	        }
+	        else
+	        {
+	            if (messageObject != null) {
+	                messageStr = Util.format(messageObject.toString());
+	                stream.println("[" + messageStr + "].");
+	            }
+	            
+	            for (int i = 0; i < message.getAttachment().getUnnamedCount(); i++)
+	            {
+	                Object payload = message.getAttachment().itemAt(i);
+
+	                /*
+	                 * If the attachment is a message then get the contents from it.
+	                 * Otherwise treat the attachment as the payload we want to deal
+	                 * with.
+	                 */
+	                
+	                if (payload instanceof Message)
+	                {
+	                    Message attachedMessage = (Message) payload;
+	                    
+	                    try {
+	                        payload = payloadProxy.getPayload(attachedMessage);
+	                    } catch (MessageDeliverException e) {
+	                        throw new ActionProcessingException(e);
+	                    }
+	                }
+
+	                    if(payload instanceof byte[]) {
+	                        stream.println("attachment " + i + ": ["
+	                                + new String((byte[]) payload)
+	                        + "].");
+	                    } else {
+	                        stream.println("attachment " + i + ": ["
+	                                + payload
+	                                + "].");
+	                    }
+	                }
+	                }
+	            }
+
+	        return message;
 	}
 
 	private String printlnMessage;




More information about the jboss-svn-commits mailing list