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

Commit 2b2c5736 authored by James Dong's avatar James Dong Committed by Android (Google) Code Review
Browse files

Merge "Added checks for illegal arguments"

parents f65934a7 6c95d4ff
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -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();
        }
    }

    /**
+5 −0
Original line number Diff line number Diff line
@@ -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);
        }
    }

    /**
+4 −0
Original line number Diff line number Diff line
@@ -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;
+17 −4
Original line number Diff line number Diff line
@@ -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);
        }
    }

    /**