summaryrefslogtreecommitdiffstats
path: root/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java
diff options
context:
space:
mode:
authorLixin Yue <L.X.YUE@motorola.com>2009-12-10 13:52:53 +0800
committerJaikumar Ganesh <jaikumar@google.com>2009-12-22 10:01:23 -0800
commita4508589f298c67fda54c344760ae39f0f375c11 (patch)
treeba9b4545b9e0363a50f472720769a0578e3c128c /src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java
parent6ef730f85e90a8246d06c7a58bb21eee5074945c (diff)
downloadandroid_packages_apps_Bluetooth-a4508589f298c67fda54c344760ae39f0f375c11.tar.gz
android_packages_apps_Bluetooth-a4508589f298c67fda54c344760ae39f0f375c11.tar.bz2
android_packages_apps_Bluetooth-a4508589f298c67fda54c344760ae39f0f375c11.zip
Update the error codes to be compatible with PBAP spec.
Catch IndexOutOfBoundsException and NullPointerException in Opp sendFile().
Diffstat (limited to 'src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java')
-rw-r--r--src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java b/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java
index 0b240f1c5..6efac93de 100644
--- a/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java
+++ b/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java
@@ -483,10 +483,11 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession {
}
}
} catch (IOException e) {
- status = BluetoothShare.STATUS_OBEX_DATA_ERROR;
- Log.e(TAG, "Error when sending file");
- Constants.updateShareStatus(mContext1, mInfo.mId, status);
- mCallback.removeMessages(BluetoothOppObexSession.MSG_CONNECT_TIMEOUT);
+ handleSendException(e.toString());
+ } catch (NullPointerException e) {
+ handleSendException(e.toString());
+ } catch (IndexOutOfBoundsException e) {
+ handleSendException(e.toString());
} finally {
try {
fileInfo.mInputStream.close();
@@ -526,6 +527,13 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession {
return status;
}
+ private void handleSendException(String exception) {
+ Log.e(TAG, "Error when sending file: " + exception);
+ int status = BluetoothShare.STATUS_OBEX_DATA_ERROR;
+ Constants.updateShareStatus(mContext1, mInfo.mId, status);
+ mCallback.removeMessages(BluetoothOppObexSession.MSG_CONNECT_TIMEOUT);
+ }
+
@Override
public void interrupt() {
super.interrupt();