diff options
author | Ashwini Munigala <AshwiniM@codeaurora.org> | 2014-10-07 19:54:20 +0530 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2014-11-04 08:45:07 -0700 |
commit | 8b4c6b1d4a4f7d4beb742870449ff67a81452a55 (patch) | |
tree | 3ed724bf20515c02e1fd1b782df4c0af4bf8423b | |
parent | f147d52eb8c2940e3ef17eed1a505f7bf7ea224c (diff) | |
download | android_frameworks_opt_bluetooth-8b4c6b1d4a4f7d4beb742870449ff67a81452a55.tar.gz android_frameworks_opt_bluetooth-8b4c6b1d4a4f7d4beb742870449ff67a81452a55.tar.bz2 android_frameworks_opt_bluetooth-8b4c6b1d4a4f7d4beb742870449ff67a81452a55.zip |
MAPC: Fix NullPointerException for ObexTime and dateTimeformat.staging/cm-12.0-caf
Handle possible NullPointerException while accessing map client
ObexTime constructor utility.
Change-Id: If2bb6c078258f9538d6aeac9f5dc5ff58fa71863
CRs-fixed: 735064
3 files changed, 12 insertions, 6 deletions
diff --git a/src/android/bluetooth/client/map/BluetoothMapMessage.java b/src/android/bluetooth/client/map/BluetoothMapMessage.java index 6c76bbe..2b72d81 100644 --- a/src/android/bluetooth/client/map/BluetoothMapMessage.java +++ b/src/android/bluetooth/client/map/BluetoothMapMessage.java @@ -91,8 +91,13 @@ public class BluetoothMapMessage { } mSubject = attrs.get("subject"); + String dateTime = attrs.get("dateTime"); + if(dateTime != null){ + mDateTime = (new ObexTime(dateTime)).getTime(); + } else { + mDateTime = null; + } - mDateTime = (new ObexTime(attrs.get("datetime"))).getTime(); mSenderName = attrs.get("sender_name"); diff --git a/src/android/bluetooth/client/map/BluetoothMasClient.java b/src/android/bluetooth/client/map/BluetoothMasClient.java index 7d50e5b..70e49ef 100644 --- a/src/android/bluetooth/client/map/BluetoothMasClient.java +++ b/src/android/bluetooth/client/map/BluetoothMasClient.java @@ -544,8 +544,10 @@ public class BluetoothMasClient { } public void setPeriod(Date filterBegin, Date filterEnd) { - periodBegin = (new ObexTime(filterBegin)).toString(); - periodEnd = (new ObexTime(filterEnd)).toString(); + if(filterBegin != null ) + periodBegin = (new ObexTime(filterBegin)).toString(); + if(filterEnd != null) + periodEnd = (new ObexTime(filterEnd)).toString(); } public void setReadStatus(byte readfilter) { diff --git a/src/android/bluetooth/client/map/BluetoothMasRequestGetMessagesListing.java b/src/android/bluetooth/client/map/BluetoothMasRequestGetMessagesListing.java index 47af51c..e3ecc93 100644 --- a/src/android/bluetooth/client/map/BluetoothMasRequestGetMessagesListing.java +++ b/src/android/bluetooth/client/map/BluetoothMasRequestGetMessagesListing.java @@ -41,7 +41,6 @@ final class BluetoothMasRequestGetMessagesListing extends BluetoothMasRequest { public BluetoothMasRequestGetMessagesListing(String folderName, int parameters, BluetoothMasClient.MessagesFilter filter, int subjectLength, int maxListCount, int listStartOffset) { - if (subjectLength < 0 || subjectLength > 255) { throw new IllegalArgumentException("subjectLength should be [0..255]"); } @@ -124,8 +123,8 @@ final class BluetoothMasRequestGetMessagesListing extends BluetoothMasRequest { if (oap.exists(OAP_TAGID_MSE_TIME)) { String mseTime = oap.getString(OAP_TAGID_MSE_TIME); - - mServerTime = (new ObexTime(mseTime)).getTime(); + if(mseTime != null ) + mServerTime = (new ObexTime(mseTime)).getTime(); } } |