summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAshwini Munigala <AshwiniM@codeaurora.org>2014-11-19 10:12:13 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2014-11-19 07:59:46 -0800
commit3f534c27706a15c5b6c80ffd6ee44d169a529fd7 (patch)
tree428b0dd169f3090ef64b0af53c1fc22aea7eaf4c
parentcb37db0af281016d3a4d83bc64b378178d7f65cc (diff)
downloadandroid_packages_apps_BluetoothExt-3f534c27706a15c5b6c80ffd6ee44d169a529fd7.tar.gz
android_packages_apps_BluetoothExt-3f534c27706a15c5b6c80ffd6ee44d169a529fd7.tar.bz2
android_packages_apps_BluetoothExt-3f534c27706a15c5b6c80ffd6ee44d169a529fd7.zip
FTP: Fix klockwork reported issues.
Fix NPE and RLK issues reported from klockwork. CRs-fixed: 758708 Change-Id: I017b1e8b954239cff377ca3e68d6737e32d53b2c
-rw-r--r--src/org/codeaurora/bluetooth/ftp/BluetoothFtpObexServer.java8
-rw-r--r--src/org/codeaurora/bluetooth/ftp/BluetoothFtpService.java2
-rw-r--r--src/org/codeaurora/bluetooth/ftp/FileUtils.java3
3 files changed, 7 insertions, 6 deletions
diff --git a/src/org/codeaurora/bluetooth/ftp/BluetoothFtpObexServer.java b/src/org/codeaurora/bluetooth/ftp/BluetoothFtpObexServer.java
index 78a7483..b602eec 100644
--- a/src/org/codeaurora/bluetooth/ftp/BluetoothFtpObexServer.java
+++ b/src/org/codeaurora/bluetooth/ftp/BluetoothFtpObexServer.java
@@ -767,7 +767,7 @@ public class BluetoothFtpObexServer extends ServerRequestHandler {
*
* Else call the routine to send the requested file names contents
*/
- if(type.equals(TYPE_LISTING)){
+ if(type.equals(TYPE_LISTING)) {
if(!validName || ( mCurrentPath!= null && ( mCurrentPath.equals(rootPrimaryStoragePath) ||
mCurrentPath.equals(rootSecondaryStoragePath)) ) ) {
if (D) Log.d(TAG,"Not having a name ");
@@ -790,7 +790,7 @@ public class BluetoothFtpObexServer extends ServerRequestHandler {
}
} else {
if (D) Log.d(TAG,"Non Root Folder");
- if(type.equals(TYPE_LISTING)){
+ if(type.equals(TYPE_LISTING) && mCurrentPath != null) {
File currentfolder = new File(mCurrentPath);
if (D) Log.d(TAG,"Current folder name = " +
currentfolder.getName() +
@@ -876,6 +876,10 @@ public class BluetoothFtpObexServer extends ServerRequestHandler {
outputStream = op.openOutputStream();
} catch(IOException e) {
Log.e(TAG,"SendFilecontents open stream "+ e.toString());
+ if(outputStream != null ) {
+ closeStream(outputStream, op);
+ outputStream = null;
+ }
return ResponseCodes.OBEX_HTTP_INTERNAL_ERROR;
} finally {
if (fileInputStream != null && outputStream == null) {
diff --git a/src/org/codeaurora/bluetooth/ftp/BluetoothFtpService.java b/src/org/codeaurora/bluetooth/ftp/BluetoothFtpService.java
index cd2f583..5daa67e 100644
--- a/src/org/codeaurora/bluetooth/ftp/BluetoothFtpService.java
+++ b/src/org/codeaurora/bluetooth/ftp/BluetoothFtpService.java
@@ -366,7 +366,7 @@ public class BluetoothFtpService extends Service {
removeTimeoutMsg = false;
}
- if (removeTimeoutMsg) {
+ if (removeTimeoutMsg && mSessionStatusHandler != null) {
mSessionStatusHandler.removeMessages(MSG_INTERNAL_USER_TIMEOUT);
}
}
diff --git a/src/org/codeaurora/bluetooth/ftp/FileUtils.java b/src/org/codeaurora/bluetooth/ftp/FileUtils.java
index 03b5b31..fb598d2 100644
--- a/src/org/codeaurora/bluetooth/ftp/FileUtils.java
+++ b/src/org/codeaurora/bluetooth/ftp/FileUtils.java
@@ -159,9 +159,6 @@ public class FileUtils {
} catch(FileNotFoundException e) {
Log.e(TAG,"copyFile file not found "+ e.toString());
return ResponseCodes.OBEX_HTTP_INTERNAL_ERROR;
- } catch(IOException e) {
- Log.e(TAG,"copyFile open stream failed "+ e.toString());
- return ResponseCodes.OBEX_HTTP_INTERNAL_ERROR;
} finally {
if (null != reader && null == writer) {
try {