summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPar-Gunnar Hjalmdahl <par-gunnar.p.hjalmdahl@stericsson.com>2011-04-05 13:29:49 +0200
committerchristian bejram <christian.bejram@stericsson.com>2011-04-28 14:08:29 +0200
commit174a747944b553c654d149140d034612924d3ece (patch)
treea206639c8886a042c063dff9195afa419d23bf1e
parent16fc087dc9dea43c436b0f98995ba0afb75119fb (diff)
downloadandroid_packages_apps_Bluetooth-174a747944b553c654d149140d034612924d3ece.tar.gz
android_packages_apps_Bluetooth-174a747944b553c654d149140d034612924d3ece.tar.bz2
android_packages_apps_Bluetooth-174a747944b553c654d149140d034612924d3ece.zip
BT: Fix for vCard Listing error
This patch fixes listing of the incomplete vCard xml file, which contains special characters which are larger than one byte. Change-Id: Ice5a056004aa30255a06f8742428d4bcfa5813c8 Signed-off-by: christian bejram <christian.bejram@stericsson.com>
-rwxr-xr-xsrc/com/android/bluetooth/pbap/BluetoothPbapObexServer.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/com/android/bluetooth/pbap/BluetoothPbapObexServer.java b/src/com/android/bluetooth/pbap/BluetoothPbapObexServer.java
index fa645ff05..42c078d48 100755
--- a/src/com/android/bluetooth/pbap/BluetoothPbapObexServer.java
+++ b/src/com/android/bluetooth/pbap/BluetoothPbapObexServer.java
@@ -670,7 +670,8 @@ public class BluetoothPbapObexServer extends ServerRequestHandler {
return ResponseCodes.OBEX_HTTP_OK;
}
- int vcardStringLen = vcardString.length();
+ byte[] vcardBytes = vcardString.getBytes();
+ int vcardStringLen = vcardBytes.length;
if (D) Log.d(TAG, "Send Data: len=" + vcardStringLen);
OutputStream outputStream = null;
@@ -697,9 +698,9 @@ public class BluetoothPbapObexServer extends ServerRequestHandler {
if (vcardStringLen - position < outputBufferSize) {
readLength = vcardStringLen - position;
}
- String subStr = vcardString.substring(position, position + readLength);
+ byte[] subByteArray = Arrays.copyOfRange(vcardBytes, position, position + readLength);
try {
- outputStream.write(subStr.getBytes(), 0, readLength);
+ outputStream.write(subByteArray, 0, readLength);
} catch (IOException e) {
Log.e(TAG, "write outputstrem failed" + e.toString());
pushResult = ResponseCodes.OBEX_HTTP_INTERNAL_ERROR;