You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by "Guillaume Nodet (JIRA)" <ji...@apache.org> on 2006/08/23 23:09:23 UTC

[jira] Resolved: (SM-553) MessageExchangeImpl.toString() converts message content to DOMSource

     [ https://issues.apache.org/activemq/browse/SM-553?page=all ]

Guillaume Nodet resolved SM-553.
--------------------------------

    Fix Version/s: 3.0-M3
       Resolution: Fixed
         Assignee: Guillaume Nodet

Author: gnodet
Date: Wed Aug 23 12:46:18 2006
New Revision: 434140

URL: http://svn.apache.org/viewvc?rev=434140&view=rev
Log:
Log file in distribution should not log at DEBUG level by default

Modified:
    incubator/servicemix/trunk/apache-servicemix/src/main/release/conf/log4j.xml

... and ...

Author: gnodet
Date: Wed Aug 23 14:05:58 2006
New Revision: 434178

URL: http://svn.apache.org/viewvc?rev=434178&view=rev
Log:
Fix possible NPE, thx to Robert H. Pollack

Modified:
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/messaging/MessageExchangeImpl.java



> MessageExchangeImpl.toString() converts message content to DOMSource
> --------------------------------------------------------------------
>
>                 Key: SM-553
>                 URL: https://issues.apache.org/activemq/browse/SM-553
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-core
>    Affects Versions: 3.0-M2
>            Reporter: Robert H. Pollack
>         Assigned To: Guillaume Nodet
>             Fix For: 3.0-M3
>
>         Attachments: patches.zip
>
>
> The toString() method of MessageExchangeImpl, in an attempt to show the in, out, and fault messages of the exchange, converts their content to DOM.  If this conversion succeeds, the user may be surprised, because the message has changed from a stream source to a DOM source; this originally caused some ClassCastExceptions in our code.
> If the conversion fails, the situation is even worse.  Now the message content remains a stream source, but the stream has been consumed in the attempted conversion, so the message is now empty.
> The reason that this toString method is getting called, almost no matter what you do, is that ServiceMix is distributed with log levels set to DEBUG (oddly, you don't see any debug messages, probably because the log4j.xml file does not specify an appender for these messages).  This setting causes many invocations of the form
>     log.debug ("Now I'm doing something to " + myMessageExchange);
> which causes the toString method to be invoked whether or not anything is actually printed.
> This toString method also turns out to have another problem.  If it does get an exception, it returns null.  It turns out that an object's toString method should never do this, because it can cause NullPointerExceptions if the object is printed.
> I've created an alternate version of MessageExchangeImpl which corrects these problems.  To use it, unzip the enclosed file into your SERVICEMIX_HOME directory and run ant in the directory it creates.  This will create a new class and insert it into a place that will cause ServiceMix 3.0 to use it in preference to the original.  Be sure that you unzip this file into the right place, though, because the ant script contains specific references to "..".
> A bit more detail is in the comments in the enclosed code.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira