From 0e85f251296d493cb62989aca117ba9bd34430ad Mon Sep 17 00:00:00 2001 From: Alex Wenckus Date: Thu, 15 Feb 2007 17:33:44 +0000 Subject: [PATCH] Outputstream may not have been properly closed in case of error. SMACK-198 git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@7144 b35dd754-fafc-0310-a699-88a17e54d16e --- .../filetransfer/IncomingFileTransfer.java | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/source/org/jivesoftware/smackx/filetransfer/IncomingFileTransfer.java b/source/org/jivesoftware/smackx/filetransfer/IncomingFileTransfer.java index c6136057b..085a99327 100644 --- a/source/org/jivesoftware/smackx/filetransfer/IncomingFileTransfer.java +++ b/source/org/jivesoftware/smackx/filetransfer/IncomingFileTransfer.java @@ -94,7 +94,7 @@ public class IncomingFileTransfer extends FileTransfer { * * * @param file The location to save the file. - * @throws XMPPException + * @throws XMPPException when the file transfer fails * @throws IllegalArgumentException This exception is thrown when the the provided file is * either null, or cannot be written to. */ @@ -144,18 +144,24 @@ public class IncomingFileTransfer extends FileTransfer { setException(e); } - if (getStatus().equals(Status.in_progress)) + if (getStatus().equals(Status.in_progress)) { setStatus(Status.complete); - try { - if (inputStream != null) { + } + if (inputStream != null) { + try { inputStream.close(); } - if (outputStream != null) { - outputStream.close(); + catch(Throwable io) { + /* Ignore */ } } - catch (IOException e) { - /** We need to do something here **/ + if (outputStream != null) { + try { + outputStream.close(); + } + catch (Throwable io) { + /* Ignore */ + } } } }, "File Transfer " + streamID);