From 499a95418220f4723349c57e5a6a5a1916de7562 Mon Sep 17 00:00:00 2001 From: Grace Kloba Date: Fri, 2 Oct 2009 12:07:21 -0700 Subject: [PATCH] setupRedirect() can throw. Catch it and signal the error. Fix http://b/issue?id=2163139 --- core/java/android/webkit/LoadListener.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/core/java/android/webkit/LoadListener.java b/core/java/android/webkit/LoadListener.java index 5995121bb955f..5145e032d03ed 100644 --- a/core/java/android/webkit/LoadListener.java +++ b/core/java/android/webkit/LoadListener.java @@ -1211,8 +1211,17 @@ class LoadListener extends Handler implements EventHandler { // mRequestHandle can be null when the request was satisfied // by the cache, and the cache returned a redirect if (mRequestHandle != null) { - mRequestHandle.setupRedirect(mUrl, mStatusCode, - mRequestHeaders); + try { + mRequestHandle.setupRedirect(mUrl, mStatusCode, + mRequestHeaders); + } catch(RuntimeException e) { + Log.e(LOGTAG, e.getMessage()); + // Signal a bad url error if we could not load the + // redirection. + handleError(EventHandler.ERROR_BAD_URL, + mContext.getString(R.string.httpErrorBadUrl)); + return; + } } else { // If the original request came from the cache, there is no // RequestHandle, we have to create a new one through