diff options
author | Hemant Gupta <hemantg@codeaurora.org> | 2013-11-27 18:37:45 +0530 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2013-11-28 22:14:11 -0800 |
commit | 7961caf7fc97916061fff12dac1f3b173f82cb42 (patch) | |
tree | ecd3d3388af8d376489d48c318e1e5d830a6d139 /src/org/codeaurora/bluetooth/ftp | |
parent | 5e1f6d32fec87d97824b3e93acb22e2f133a81a3 (diff) | |
download | android_packages_apps_BluetoothExt-7961caf7fc97916061fff12dac1f3b173f82cb42.tar.gz android_packages_apps_BluetoothExt-7961caf7fc97916061fff12dac1f3b173f82cb42.tar.bz2 android_packages_apps_BluetoothExt-7961caf7fc97916061fff12dac1f3b173f82cb42.zip |
Bluetooth: FTP: Fix issue in set path to root folder
This patch fixes issue in setting path to root folder. Without
this patch it was not possible to set path to root folder.
CRs-Fixed: 580279
Change-Id: I751a7058c214cbaac2320e48de11c6676a96c5b1
Diffstat (limited to 'src/org/codeaurora/bluetooth/ftp')
-rw-r--r-- | src/org/codeaurora/bluetooth/ftp/BluetoothFtpObexServer.java | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/src/org/codeaurora/bluetooth/ftp/BluetoothFtpObexServer.java b/src/org/codeaurora/bluetooth/ftp/BluetoothFtpObexServer.java index 6a6f531..a769ff3 100644 --- a/src/org/codeaurora/bluetooth/ftp/BluetoothFtpObexServer.java +++ b/src/org/codeaurora/bluetooth/ftp/BluetoothFtpObexServer.java @@ -583,7 +583,7 @@ public class BluetoothFtpObexServer extends ServerRequestHandler { return ResponseCodes.OBEX_HTTP_INTERNAL_ERROR; } if (D) Log.d(TAG, "backup=" + backup + " create=" + create + - " name=" + tmp_path +" mCurrentPath = " + mCurrentPath); + " name=" + tmp_path +" mCurrentPath = " + mCurrentPath); /* If the name is "." or ".." do not allow to create or set the directory */ if (TextUtils.equals(tmp_path, FOLDER_NAME_DOT) || @@ -601,17 +601,20 @@ public class BluetoothFtpObexServer extends ServerRequestHandler { * set the current path to ROOT Folder path */ if (backup) { - if (D) Log.d(TAG, "current_tmp_path: " + current_path_tmp); - if (current_path_tmp.length() != 0 && current_path_tmp.equals(rootPrimaryStoragePath) == false - && current_path_tmp.equals(rootSecondaryStoragePath) == false ) { - current_path_tmp = current_path_tmp.substring(0, - current_path_tmp.lastIndexOf("/")); - } else if (current_path_tmp.equals(rootPrimaryStoragePath ) || - current_path_tmp.equals(rootSecondaryStoragePath)){ - /* We have already reached the root folder but user tries to press the - * back button - */ - current_path_tmp = null; + if (current_path_tmp != null) { + if (D) Log.d(TAG, "current_tmp_path: " + current_path_tmp); + if (current_path_tmp.length() != 0 && + current_path_tmp.equals(rootPrimaryStoragePath) + == false && current_path_tmp.equals(rootSecondaryStoragePath) == false ) { + current_path_tmp = current_path_tmp.substring(0, + current_path_tmp.lastIndexOf("/")); + } else if (current_path_tmp.equals(rootPrimaryStoragePath ) || + current_path_tmp.equals(rootSecondaryStoragePath)){ + /* We have already reached the root folder but user tries to press the + * back button + */ + current_path_tmp = null; + } } } else { //SetPath here comes into picture only when tmp_path not null. @@ -651,9 +654,9 @@ public class BluetoothFtpObexServer extends ServerRequestHandler { // new folder requested at PRIMARY and SECONDARY FOlDEERs level, // so return ResponseCodes.OBEX_HTTP_NOT_ACCEPTABLE return ResponseCodes.OBEX_HTTP_NOT_ACCEPTABLE; - } else if(current_path_tmp == null && !backup ){ - // current_path_tmp cannot be null if not backup - return ResponseCodes.OBEX_HTTP_NOT_FOUND; + } else if(current_path_tmp == null && backup ){ + // current_path_tmp cannot be null if backup + return ResponseCodes.OBEX_HTTP_NOT_ACCEPTABLE; } |