summaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorRika Brooks <rbrooks@codeaurora.org>2012-04-12 16:02:25 -0700
committerRika Brooks <rbrooks@codeaurora.org>2012-08-06 13:46:41 -0700
commit910825a2ed10bd5cc454b91380b7db0dac2e616e (patch)
tree3a58afc6c5dc5b00fee16efbf7886fe2731c0cc6 /src/java
parent801aa9f327730327132aafbae7e0c55bb6e7ea71 (diff)
downloadframeworks_opt_telephony-910825a2ed10bd5cc454b91380b7db0dac2e616e.zip
frameworks_opt_telephony-910825a2ed10bd5cc454b91380b7db0dac2e616e.tar.gz
frameworks_opt_telephony-910825a2ed10bd5cc454b91380b7db0dac2e616e.tar.bz2
Telephony: Fix SmsManager to throw IllegalArgumentException
IllegalArgumentException condition for: enableCellBroadcastRange() and disableCellBroadcastRange() is if endMessageId < startMessageId. IllegalArgumentException condition for divideMessage() is if input text is null, for copyMessageToIcc() it is if pdu is null. Change-Id: Id344e99728ac92cbfcf2d11b8ca3f920d140bbde
Diffstat (limited to 'src/java')
-rw-r--r--src/java/android/telephony/SmsManager.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/java/android/telephony/SmsManager.java b/src/java/android/telephony/SmsManager.java
index 44bdaeb..deffebc 100644
--- a/src/java/android/telephony/SmsManager.java
+++ b/src/java/android/telephony/SmsManager.java
@@ -98,8 +98,13 @@ public final class SmsManager {
* @param text the original message. Must not be null.
* @return an <code>ArrayList</code> of strings that, in order,
* comprise the original message
+ *
+ * @throws IllegalArgumentException if text is null
*/
public ArrayList<String> divideMessage(String text) {
+ if (null == text) {
+ throw new IllegalArgumentException("text is null");
+ }
return SmsMessage.fragmentText(text);
}
@@ -242,11 +247,15 @@ public final class SmsManager {
* STATUS_ON_ICC_SENT, STATUS_ON_ICC_UNSENT)
* @return true for success
*
+ * @throws IllegalArgumentException if pdu is NULL
* {@hide}
*/
public boolean copyMessageToIcc(byte[] smsc, byte[] pdu, int status) {
boolean success = false;
+ if (null == pdu) {
+ throw new IllegalArgumentException("pdu is NULL");
+ }
try {
ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
if (iccISms != null) {
@@ -414,11 +423,15 @@ public final class SmsManager {
* @return true if successful, false otherwise
* @see #disableCellBroadcastRange(int, int)
*
+ * @throws IllegalArgumentException if endMessageId < startMessageId
* {@hide}
*/
public boolean enableCellBroadcastRange(int startMessageId, int endMessageId) {
boolean success = false;
+ if (endMessageId < startMessageId) {
+ throw new IllegalArgumentException("endMessageId < startMessageId");
+ }
try {
ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
if (iccISms != null) {
@@ -445,11 +458,15 @@ public final class SmsManager {
*
* @see #enableCellBroadcastRange(int, int)
*
+ * @throws IllegalArgumentException if endMessageId < startMessageId
* {@hide}
*/
public boolean disableCellBroadcastRange(int startMessageId, int endMessageId) {
boolean success = false;
+ if (endMessageId < startMessageId) {
+ throw new IllegalArgumentException("endMessageId < startMessageId");
+ }
try {
ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
if (iccISms != null) {