Merge "PBAP: Add change to return properly on PullvCardEntry fail"
diff --git a/src/org/codeaurora/bluetooth/pbapclient/BluetoothPbapRequest.java b/src/org/codeaurora/bluetooth/pbapclient/BluetoothPbapRequest.java
index 5f73ffc..5483272 100644
--- a/src/org/codeaurora/bluetooth/pbapclient/BluetoothPbapRequest.java
+++ b/src/org/codeaurora/bluetooth/pbapclient/BluetoothPbapRequest.java
@@ -101,6 +101,8 @@
mResponseCode = mOp.getResponseCode();
Log.d(TAG, "mResponseCode=" + mResponseCode);
+
+ checkResponseCode(mResponseCode);
} catch (IOException e) {
Log.e(TAG, "IOException occured when processing request", e);
mResponseCode = ResponseCodes.OBEX_HTTP_INTERNAL_ERROR;
@@ -132,4 +134,10 @@
/* nothing here by dafault */
}
+
+ protected void checkResponseCode(int responseCode) throws IOException {
+ Log.v(TAG, "checkResponseCode");
+
+ /* nothing here by dafault */
+ }
}
diff --git a/src/org/codeaurora/bluetooth/pbapclient/BluetoothPbapRequestPullVcardEntry.java b/src/org/codeaurora/bluetooth/pbapclient/BluetoothPbapRequestPullVcardEntry.java
index 1bbe359..8499e08 100644
--- a/src/org/codeaurora/bluetooth/pbapclient/BluetoothPbapRequestPullVcardEntry.java
+++ b/src/org/codeaurora/bluetooth/pbapclient/BluetoothPbapRequestPullVcardEntry.java
@@ -37,6 +37,7 @@
import java.io.InputStream;
import javax.obex.HeaderSet;
+import javax.obex.ResponseCodes;
final class BluetoothPbapRequestPullVcardEntry extends BluetoothPbapRequest {
@@ -76,9 +77,17 @@
Log.v(TAG, "readResponse");
mResponse = new BluetoothPbapVcardList(stream, mFormat);
+ }
+ @Override
+ protected void checkResponseCode(int responseCode) throws IOException {
+ Log.v(TAG, "checkResponseCode");
if (mResponse.getCount() == 0) {
- throw new IOException("Invalid response received");
+ if (responseCode != ResponseCodes.OBEX_HTTP_NOT_FOUND) {
+ throw new IOException("Invalid response received");
+ } else {
+ Log.v(TAG, "Vcard Entry not found");
+ }
}
}