Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dbed921b authored by Par-Gunnar Hjalmdahl's avatar Par-Gunnar Hjalmdahl Committed by christian bejram
Browse files

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: default avatarchristian bejram <christian.bejram@stericsson.com>
parent e13bf79c
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -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;