/*
 * Copyright (C) 2014-2015 Hippo Seven
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.hippo.network;

public class ResponseCodeException extends Exception {
}

@@ -558,16 +558,50 @@
 twork;%0A%0A
+import android.util.SparseArray;%0A%0A
 public c
@@ -647,10 +647,2278 @@
 ption %7B%0A
+%0A    private static final SparseArray%3CString%3E ERROR_MESSAGE_ARRAY;%0A    private static final String DEFAULT_ERROR_MESSAGE = %22Error response code%22;%0A%0A    private final int mResponseCode;%0A    private final String mMessage;%0A%0A    static %7B%0A        ERROR_MESSAGE_ARRAY = new SparseArray%3C%3E(24);%0A%0A        ERROR_MESSAGE_ARRAY.append(400, %22Bad Request%22);%0A        ERROR_MESSAGE_ARRAY.append(401, %22Unauthorized%22);%0A        ERROR_MESSAGE_ARRAY.append(402, %22Payment Required%22);%0A        ERROR_MESSAGE_ARRAY.append(403, %22Forbidden%22);%0A        ERROR_MESSAGE_ARRAY.append(404, %22Not Found%22);%0A        ERROR_MESSAGE_ARRAY.append(405, %22Method Not Allowed%22);%0A        ERROR_MESSAGE_ARRAY.append(406, %22Not Acceptable%22);%0A        ERROR_MESSAGE_ARRAY.append(407, %22Proxy Authentication Required%22);%0A        ERROR_MESSAGE_ARRAY.append(408, %22Request Timeout%22);%0A        ERROR_MESSAGE_ARRAY.append(409, %22Conflict%22);%0A        ERROR_MESSAGE_ARRAY.append(410, %22Gone%22);%0A        ERROR_MESSAGE_ARRAY.append(411, %22Length Required%22);%0A        ERROR_MESSAGE_ARRAY.append(412, %22Precondition Failed%22);%0A        ERROR_MESSAGE_ARRAY.append(413, %22Request Entity Too Large%22);%0A        ERROR_MESSAGE_ARRAY.append(414, %22Request-URI Too Long%22);%0A        ERROR_MESSAGE_ARRAY.append(415, %22Unsupported Media Type%22);%0A        ERROR_MESSAGE_ARRAY.append(416, %22Requested Range Not Satisfiable%22);%0A        ERROR_MESSAGE_ARRAY.append(417, %22Expectation Failed%22);%0A%0A        ERROR_MESSAGE_ARRAY.append(500, %22Internal Server Error%22);%0A        ERROR_MESSAGE_ARRAY.append(501, %22Not Implemented%22);%0A        ERROR_MESSAGE_ARRAY.append(502, %22Bad Gateway%22);%0A        ERROR_MESSAGE_ARRAY.append(503, %22Service Unavailable%22);%0A        ERROR_MESSAGE_ARRAY.append(504, %22Gateway Timeout%22);%0A        ERROR_MESSAGE_ARRAY.append(505, %22HTTP Version Not Supported%22);%0A    %7D%0A%0A    public ResponseCodeException(int responseCode) %7B%0A        mResponseCode = responseCode;%0A        mMessage = ERROR_MESSAGE_ARRAY.get(responseCode, DEFAULT_ERROR_MESSAGE);%0A    %7D%0A%0A    public ResponseCodeException(int responseCode, String message) %7B%0A        mResponseCode = responseCode;%0A        mMessage = message;%0A    %7D%0A%0A    @Override%0A    public String getMessage() %7B%0A        return mMessage;%0A    %7D%0A%0A    @Override%0A    public String getLocalizedMessage() %7B%0A        return getMessage();%0A    %7D%0A%0A
 %7D%0A

Add ResponseCodeException