mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 19:52:17 -05:00
Remove the try-finally stream close. Add comment as to why this pattern doesn't work here.
This commit is contained in:
parent
c44b19cda6
commit
2ef8cda13c
@ -1059,16 +1059,15 @@ public class MimeUtility {
|
|||||||
/*
|
/*
|
||||||
* Now we read the part into a buffer for further processing. Because
|
* Now we read the part into a buffer for further processing. Because
|
||||||
* the stream is now wrapped we'll remove any transfer encoding at this point.
|
* the stream is now wrapped we'll remove any transfer encoding at this point.
|
||||||
|
*
|
||||||
|
* We can't wrap this in a try-finally to close the InputStream. It looks like
|
||||||
|
* we depend on the underlying temp file to exist across calls, and closing it
|
||||||
|
* deletes the file, which isn't what we want. We should figure out if this
|
||||||
|
* is really the right way to be doing things, since it's triggering strict
|
||||||
|
* mode warnings.
|
||||||
*/
|
*/
|
||||||
InputStream in = null;
|
InputStream in = part.getBody().getInputStream();
|
||||||
try {
|
return readToString(in, charset);
|
||||||
in = part.getBody().getInputStream();
|
|
||||||
return readToString(in, charset);
|
|
||||||
} finally {
|
|
||||||
if (in != null) {
|
|
||||||
in.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user