Affects Version/s: 2.2.1
Windows XP SP2, Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
<file:inbound-endpoint path="input" pollingFrequency="1000"/>
org.mule.transport.jms.transformers.ObjectToJMSMessage class does not close the InputStream passed as an input argument. This can be a root of many unexpected behaviors, take the example service below. This example service processes the same file indefinitely, because standard ObjectToJMSMessage does not close the file input stream and org.mule.transport.file.ReceiverFileInputStream#close is the place where processed file is deleted/moved. If this method is not called, file:inbound-endpoint keeps opening and processing the same file over and over.
If you uncomment the log-component, everything seems to work just fine. This is due to the org.mule.api.MuleEventContext#getMessageAsString invocation, which uses org.mule.transformer.simple.ObjectToString#doTransform behind the scenes. This transformer closes the InputStream properly causing the file to be removed. ObjectToJMSMessage then gets the String instead of InputStream.
The bug is located in org.mule.transport.jms.JmsMessageUtils#toMessage method, patch for 2.2.1 is attached. BTW this class (and many other transformers) does a while loop for reading and buffering InputStream. This can be replaced by org.apache.commons.io.IOUtils#copy.