Skip to content

Instantly share code, notes, and snippets.

@stevengonsalvez
Created November 11, 2015 14:39
Show Gist options
  • Save stevengonsalvez/cff13c24009b62bc4de6 to your computer and use it in GitHub Desktop.
Save stevengonsalvez/cff13c24009b62bc4de6 to your computer and use it in GitHub Desktop.
File input bug : file input stream does not close - hack to close the input stream
import java.io.FileInputStream;
import org.mule.api.MuleEventContext;
import org.mule.api.lifecycle.Callable;
public class CloseStreamWorkaround implements Callable {
@Override
public Object onCall(MuleEventContext eventContext) throws Exception {
FileInputStream fileInput = (FileInputStream) eventContext.getMessage().getPayload();
fileInput.close();
MuleEventContext newContext = eventContext;
newContext.getMessage().setPayload(new String("Success"));
return newContext.getMessage().getPayload();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment