summaryrefslogtreecommitdiffstats
path: root/core/java/android/webkit
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android/webkit')
-rw-r--r--core/java/android/webkit/BrowserFrame.java11
-rw-r--r--core/java/android/webkit/FrameLoader.java9
2 files changed, 12 insertions, 8 deletions
diff --git a/core/java/android/webkit/BrowserFrame.java b/core/java/android/webkit/BrowserFrame.java
index cce7914..ed5663e 100644
--- a/core/java/android/webkit/BrowserFrame.java
+++ b/core/java/android/webkit/BrowserFrame.java
@@ -26,6 +26,7 @@ import android.graphics.Bitmap;
import android.net.ParseException;
import android.net.Uri;
import android.net.WebAddress;
+import android.net.http.ErrorStrings;
import android.net.http.SslCertificate;
import android.os.Handler;
import android.os.Message;
@@ -323,16 +324,20 @@ class BrowserFrame extends Handler {
* native callback
* Report an error to an activity.
* @param errorCode The HTTP error code.
- * @param description A String description.
+ * @param description Optional human-readable description. If no description
+ * is given, we'll use a standard localized error message.
+ * @param failingUrl The URL that was being loaded when the error occurred.
* TODO: Report all errors including resource errors but include some kind
* of domain identifier. Change errorCode to an enum for a cleaner
* interface.
*/
- private void reportError(final int errorCode, final String description,
- final String failingUrl) {
+ private void reportError(int errorCode, String description, String failingUrl) {
// As this is called for the main resource and loading will be stopped
// after, reset the state variables.
resetLoadingStates();
+ if (description == null || description.isEmpty()) {
+ description = ErrorStrings.getString(errorCode, mContext);
+ }
mCallbackProxy.onReceivedError(errorCode, description, failingUrl);
}
diff --git a/core/java/android/webkit/FrameLoader.java b/core/java/android/webkit/FrameLoader.java
index 021b53c..0f127d5 100644
--- a/core/java/android/webkit/FrameLoader.java
+++ b/core/java/android/webkit/FrameLoader.java
@@ -16,6 +16,7 @@
package android.webkit;
+import android.net.http.ErrorStrings;
import android.net.http.EventHandler;
import android.net.http.RequestHandle;
import android.os.Build;
@@ -247,8 +248,7 @@ class FrameLoader {
error = EventHandler.ERROR_BAD_URL;
}
if (!ret) {
- mListener.error(error, mListener.getContext().getText(
- EventHandler.errorStringResources[Math.abs(error)]).toString());
+ mListener.error(error, ErrorStrings.getString(error, mListener.getContext()));
return false;
}
return true;
@@ -303,9 +303,8 @@ class FrameLoader {
// it has gone.
// Generate a file not found error
int err = EventHandler.FILE_NOT_FOUND_ERROR;
- mListener.error(err, mListener.getContext().getText(
- EventHandler.errorStringResources[Math.abs(err)])
- .toString());
+ mListener.error(err,
+ ErrorStrings.getString(err, mListener.getContext()));
}
return true;
}