mirror of
https://github.com/moparisthebest/davmail
synced 2025-02-28 09:21:49 -05:00
Fix regression in stream handling : do not close quoteOs, this would close the underlying stream
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@53 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
8ab4d39cc6
commit
8ba3b3ac8b
@ -928,11 +928,13 @@ public class ExchangeSession {
|
||||
}
|
||||
|
||||
protected void writeAttachment(OutputStream os, MimeHeader mimeHeader, Attachment attachment) throws IOException {
|
||||
OutputStream quotedOs = null;
|
||||
try {
|
||||
// quotedOs must not be closed : this would close the underlying outputstream
|
||||
OutputStream quotedOs;
|
||||
try {
|
||||
// try another base64Encoder implementation
|
||||
if ("base64".equalsIgnoreCase(mimeHeader.contentTransferEncoding)) {
|
||||
//noinspection IOResourceOpenedButNotSafelyClosed
|
||||
quotedOs = new BASE64EncoderStream(os);
|
||||
} else {
|
||||
quotedOs = (MimeUtility.encode(os, mimeHeader.contentTransferEncoding));
|
||||
@ -989,7 +991,6 @@ public class ExchangeSession {
|
||||
}
|
||||
}
|
||||
}
|
||||
bis.close();
|
||||
quotedOs.flush();
|
||||
os.write('\r');
|
||||
os.write('\n');
|
||||
@ -997,14 +998,6 @@ public class ExchangeSession {
|
||||
|
||||
} catch (HttpException e) {
|
||||
throw new IOException(e + " " + e.getMessage());
|
||||
} finally {
|
||||
if (quotedOs != null) {
|
||||
try {
|
||||
quotedOs.close();
|
||||
} catch (IOException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ public class TestExchangeSession {
|
||||
ExchangeSession session = new ExchangeSession();
|
||||
// test auth
|
||||
try {
|
||||
session.checkConfig();
|
||||
ExchangeSession.checkConfig();
|
||||
session.login(argv[1], argv[2]);
|
||||
|
||||
ExchangeSession.Folder folder = session.selectFolder(argv[3]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user