FTP: Handle Abort exception in onPut Request.
Perform both close file stream and delete current file
on Abort Exception for onPut FTP Request.
Change-Id: Ie0b1eb80b9706a79285b6021cf5c304ce29b7399
CRs-fixed: 523330
diff --git a/src/org/codeaurora/bluetooth/ftp/BluetoothFtpObexServer.java b/src/org/codeaurora/bluetooth/ftp/BluetoothFtpObexServer.java
index f4e561b..b8f273c 100644
--- a/src/org/codeaurora/bluetooth/ftp/BluetoothFtpObexServer.java
+++ b/src/org/codeaurora/bluetooth/ftp/BluetoothFtpObexServer.java
@@ -441,12 +441,7 @@
Log.e(TAG, "onPut File receive"+ e1.toString());
if (D) Log.d(TAG, "Error when receiving file");
((ServerOperation)op).isAborted = true;
- /* If the transfer completed due to a
- * abort from Ftp client, clean up the
- * file in the Server
- */
- fileinfo.delete();
- return ResponseCodes.OBEX_HTTP_BAD_REQUEST;
+ sIsAborted = true;
}
long finishtimestamp = System.currentTimeMillis();
@@ -462,6 +457,16 @@
}
}
if(D) Log.d(TAG,"close Stream >");
+ if(sIsAborted == true){
+ sIsAborted = false;
+ /* If the transfer completed due to a
+ * abort from Ftp client, clean up the
+ * file in the Server
+ */
+ fileinfo.delete();
+ Log.e(TAG, " SET isAborted on excepton");
+ return ResponseCodes.OBEX_HTTP_BAD_REQUEST;
+ }
if (!closeStream(in_stream, op)) {
if (D) Log.d(TAG,"Failed to close Input stream");
return ResponseCodes.OBEX_HTTP_INTERNAL_ERROR;