1 /*
2  * Copyright (C) 2018 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.mediapc.cts;
18 
19 /*
20  * KeyRequesterException is used to hold data received from the license server response when a key
21  * request fails. This data is used by the ExpectException criteria to validate certain responses
22  * from the license server when invalid Policy configurations are requested in the license request.
23  */
24 public class KeyRequesterException extends Exception {
25     private final int mResponseCode;
26     private final String mResponseMessage;
27     private final byte[] mResponseBody;
28 
KeyRequesterException(int responseCode, String responseMessage, byte[] responseBody)29     public KeyRequesterException(int responseCode, String responseMessage, byte[] responseBody) {
30         mResponseCode = responseCode;
31         mResponseMessage = responseMessage;
32         mResponseBody = responseBody;
33     }
34 
getResponseCode()35     public int getResponseCode() {
36         return mResponseCode;
37     }
38 
getResponseMessage()39     public String getResponseMessage() {
40         return mResponseMessage;
41     }
42 
getResponseBody()43     public byte[] getResponseBody() {
44         return mResponseBody;
45     }
46 
47     @Override
getMessage()48     public String getMessage() {
49         return getResponseMessage();
50     }
51 }
52