am 10a36fb7: Merge "Stop using ErrorStrings for apache."
* commit '10a36fb749d05bd90fc8ef3114562cacb631c07c': Stop using ErrorStrings for apache.
This commit is contained in:
@@ -436,7 +436,7 @@ abstract class Connection {
|
||||
ret = false;
|
||||
String error;
|
||||
if (errorId < 0) {
|
||||
error = ErrorStrings.getString(errorId, mContext);
|
||||
error = getEventHandlerErrorString(errorId);
|
||||
} else {
|
||||
Throwable cause = e.getCause();
|
||||
error = cause != null ? cause.toString() : e.getMessage();
|
||||
@@ -451,6 +451,61 @@ abstract class Connection {
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static String getEventHandlerErrorString(int errorId) {
|
||||
switch (errorId) {
|
||||
case EventHandler.OK:
|
||||
return "OK";
|
||||
|
||||
case EventHandler.ERROR:
|
||||
return "ERROR";
|
||||
|
||||
case EventHandler.ERROR_LOOKUP:
|
||||
return "ERROR_LOOKUP";
|
||||
|
||||
case EventHandler.ERROR_UNSUPPORTED_AUTH_SCHEME:
|
||||
return "ERROR_UNSUPPORTED_AUTH_SCHEME";
|
||||
|
||||
case EventHandler.ERROR_AUTH:
|
||||
return "ERROR_AUTH";
|
||||
|
||||
case EventHandler.ERROR_PROXYAUTH:
|
||||
return "ERROR_PROXYAUTH";
|
||||
|
||||
case EventHandler.ERROR_CONNECT:
|
||||
return "ERROR_CONNECT";
|
||||
|
||||
case EventHandler.ERROR_IO:
|
||||
return "ERROR_IO";
|
||||
|
||||
case EventHandler.ERROR_TIMEOUT:
|
||||
return "ERROR_TIMEOUT";
|
||||
|
||||
case EventHandler.ERROR_REDIRECT_LOOP:
|
||||
return "ERROR_REDIRECT_LOOP";
|
||||
|
||||
case EventHandler.ERROR_UNSUPPORTED_SCHEME:
|
||||
return "ERROR_UNSUPPORTED_SCHEME";
|
||||
|
||||
case EventHandler.ERROR_FAILED_SSL_HANDSHAKE:
|
||||
return "ERROR_FAILED_SSL_HANDSHAKE";
|
||||
|
||||
case EventHandler.ERROR_BAD_URL:
|
||||
return "ERROR_BAD_URL";
|
||||
|
||||
case EventHandler.FILE_ERROR:
|
||||
return "FILE_ERROR";
|
||||
|
||||
case EventHandler.FILE_NOT_FOUND_ERROR:
|
||||
return "FILE_NOT_FOUND_ERROR";
|
||||
|
||||
case EventHandler.TOO_MANY_REQUESTS_ERROR:
|
||||
return "TOO_MANY_REQUESTS_ERROR";
|
||||
|
||||
default:
|
||||
return "UNKNOWN_ERROR";
|
||||
}
|
||||
}
|
||||
|
||||
HttpContext getHttpContext() {
|
||||
return mHttpContext;
|
||||
}
|
||||
|
||||
@@ -14,9 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.net.http;
|
||||
package android.webkit;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.http.EventHandler;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
@@ -24,8 +25,8 @@ import android.util.Log;
|
||||
*
|
||||
* {@hide}
|
||||
*/
|
||||
public class ErrorStrings {
|
||||
private ErrorStrings() { /* Utility class, don't instantiate. */ }
|
||||
class LegacyErrorStrings {
|
||||
private LegacyErrorStrings() { /* Utility class, don't instantiate. */ }
|
||||
|
||||
private static final String LOGTAG = "Http";
|
||||
|
||||
@@ -33,7 +34,7 @@ public class ErrorStrings {
|
||||
* Get the localized error message resource for the given error code.
|
||||
* If the code is unknown, we'll return a generic error message.
|
||||
*/
|
||||
public static String getString(int errorCode, Context context) {
|
||||
static String getString(int errorCode, Context context) {
|
||||
return context.getText(getResource(errorCode)).toString();
|
||||
}
|
||||
|
||||
@@ -41,7 +42,7 @@ public class ErrorStrings {
|
||||
* Get the localized error message resource for the given error code.
|
||||
* If the code is unknown, we'll return a generic error message.
|
||||
*/
|
||||
public static int getResource(int errorCode) {
|
||||
private static int getResource(int errorCode) {
|
||||
switch(errorCode) {
|
||||
case EventHandler.OK:
|
||||
return com.android.internal.R.string.httpErrorOk;
|
||||
@@ -22,7 +22,6 @@ import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Canvas;
|
||||
import android.net.http.ErrorStrings;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.Trace;
|
||||
import android.util.SparseArray;
|
||||
@@ -150,7 +149,7 @@ public final class WebViewDelegate {
|
||||
* Returns the error string for the given {@code errorCode}.
|
||||
*/
|
||||
public String getErrorString(Context context, int errorCode) {
|
||||
return ErrorStrings.getString(errorCode, context);
|
||||
return LegacyErrorStrings.getString(errorCode, context);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user