Mandiax / soi-toolkit

Automatically exported from code.google.com/p/soi-toolkit
0 stars 0 forks source link

Don't use MiscUtil.readFileAsString in integration tests #297

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
This mainly applies for integrations that uses SFTP on inbound endpoints. It 
could apply to other integrations as well.

Using MiscUtil.readFileAsString requires two unnecessary conversions that 
involves encoding (file -> convert -> String -> convert -> file). If the 
content of the file is read into a bytearray instead there is no need for any 
conversion that takes encoding into account. 

Currently there is a bug in mule sftp connector that has to be worked around 
due to the encoding dependent conversion:

http://www.mulesoft.org/jira/browse/MULE-6055

So use:

byte [] input = IOUtils.toByteArray(new FileInputStream(inputFile));

instead of

String input = MiscUtil.readFileAsString(inputFile);

Where IOUtils is from commons-io (org.apache.commons.io.IOUtils)

I think that both methods readFileAsString can be dropped since they are 
available in IOUtils.

Original issue reported on code.google.com by par.wena...@gmail.com on 11 Sep 2012 at 1:55

GoogleCodeExporter commented 8 years ago

Original comment by hakan.d...@gmail.com on 12 Jun 2013 at 8:28

GoogleCodeExporter commented 8 years ago
Related to issue 297 and issue 341.

Original comment by hakan.d...@gmail.com on 12 Jun 2013 at 8:29