Loading core/java/android/net/http/Connection.java +56 −1 Original line number Diff line number Diff line Loading @@ -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(); Loading @@ -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; } Loading core/java/android/net/http/ErrorStrings.java→core/java/android/webkit/LegacyErrorStrings.java +6 −5 Original line number Diff line number Diff line Loading @@ -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; /** Loading @@ -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"; Loading @@ -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(); } Loading @@ -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; Loading core/java/android/webkit/WebViewDelegate.java +1 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); } /** Loading Loading
core/java/android/net/http/Connection.java +56 −1 Original line number Diff line number Diff line Loading @@ -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(); Loading @@ -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; } Loading
core/java/android/net/http/ErrorStrings.java→core/java/android/webkit/LegacyErrorStrings.java +6 −5 Original line number Diff line number Diff line Loading @@ -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; /** Loading @@ -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"; Loading @@ -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(); } Loading @@ -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; Loading
core/java/android/webkit/WebViewDelegate.java +1 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); } /** Loading