diff options
author | James Dong <jdong@google.com> | 2012-02-14 16:27:38 -0800 |
---|---|---|
committer | James Dong <jdong@google.com> | 2012-02-15 11:30:51 -0800 |
commit | 6c95d4ff1656007ab5cbf0a6406d80a33bf8b109 (patch) | |
tree | f241ed246cfe2bf55fd97f0edb2bd592355c14f2 /drm | |
parent | a9daa164a58fc70d08702787e69a56212f5ad8c9 (diff) | |
download | frameworks_base-6c95d4ff1656007ab5cbf0a6406d80a33bf8b109.zip frameworks_base-6c95d4ff1656007ab5cbf0a6406d80a33bf8b109.tar.gz frameworks_base-6c95d4ff1656007ab5cbf0a6406d80a33bf8b109.tar.bz2 |
Added checks for illegal arguments
Change-Id: Ib386c33b7e2cab12cabbb9dc023d54df05472960
Diffstat (limited to 'drm')
-rwxr-xr-x | drm/java/android/drm/DrmInfo.java | 14 | ||||
-rwxr-xr-x | drm/java/android/drm/DrmInfoRequest.java | 5 | ||||
-rwxr-xr-x | drm/java/android/drm/DrmInfoStatus.java | 4 | ||||
-rwxr-xr-x | drm/java/android/drm/DrmRights.java | 21 |
4 files changed, 40 insertions, 4 deletions
diff --git a/drm/java/android/drm/DrmInfo.java b/drm/java/android/drm/DrmInfo.java index 8812bfe..22d06c7 100755 --- a/drm/java/android/drm/DrmInfo.java +++ b/drm/java/android/drm/DrmInfo.java @@ -49,6 +49,13 @@ public class DrmInfo { mInfoType = infoType; mMimeType = mimeType; mData = data; + if (!isValid()) { + final String msg = "infoType: " + infoType + "," + + "mimeType: " + mimeType + "," + + "data: " + data; + + throw new IllegalArgumentException(msg); + } } /** @@ -69,6 +76,13 @@ public class DrmInfo { // call would fail with IllegalArgumentException because of mData = null mData = null; } + if (!isValid()) { + final String msg = "infoType: " + infoType + "," + + "mimeType: " + mimeType + "," + + "data: " + mData; + + throw new IllegalArgumentException(); + } } /** diff --git a/drm/java/android/drm/DrmInfoRequest.java b/drm/java/android/drm/DrmInfoRequest.java index 1429fa5..621da41 100755 --- a/drm/java/android/drm/DrmInfoRequest.java +++ b/drm/java/android/drm/DrmInfoRequest.java @@ -67,6 +67,11 @@ public class DrmInfoRequest { public DrmInfoRequest(int infoType, String mimeType) { mInfoType = infoType; mMimeType = mimeType; + if (!isValid()) { + final String msg = "infoType: " + infoType + "," + + "mimeType: " + mimeType; + throw new IllegalArgumentException(msg); + } } /** diff --git a/drm/java/android/drm/DrmInfoStatus.java b/drm/java/android/drm/DrmInfoStatus.java index 5c12ae3..2fe0a78 100755 --- a/drm/java/android/drm/DrmInfoStatus.java +++ b/drm/java/android/drm/DrmInfoStatus.java @@ -56,6 +56,10 @@ public class DrmInfoStatus { * @param _mimeType The MIME type. */ public DrmInfoStatus(int _statusCode, int _infoType, ProcessedData _data, String _mimeType) { + if (!DrmInfoRequest.isValidType(_infoType)) { + throw new IllegalArgumentException("infoType: " + _infoType); + } + statusCode = _statusCode; infoType = _infoType; data = _data; diff --git a/drm/java/android/drm/DrmRights.java b/drm/java/android/drm/DrmRights.java index ef9c21d..d4afed1 100755 --- a/drm/java/android/drm/DrmRights.java +++ b/drm/java/android/drm/DrmRights.java @@ -103,6 +103,11 @@ public class DrmRights { } mMimeType = mimeType; + if (!isValid()) { + final String msg = "mimeType: " + mMimeType + "," + + "data: " + mData; + throw new IllegalArgumentException(msg); + } } /** @@ -117,17 +122,25 @@ public class DrmRights { mData = data.getData(); String accountId = data.getAccountId(); - if (null != accountId && !accountId.equals("")) { - mAccountId = accountId; + if (null == accountId || !accountId.equals("")) { + throw new IllegalArgumentException("accountId: " + accountId); } + mAccountId = accountId; String subscriptionId = data.getSubscriptionId(); - if (null != subscriptionId && !subscriptionId.equals("")) { - mSubscriptionId = subscriptionId; + if (null == subscriptionId || !subscriptionId.equals("")) { + throw new IllegalArgumentException( + "subscriptionId: " + subscriptionId); } + mSubscriptionId = subscriptionId; } mMimeType = mimeType; + if (!isValid()) { + final String msg = "mimeType: " + mMimeType + "," + + "data: " + mData; + throw new IllegalArgumentException(msg); + } } /** |