Hi Guys,
another problem with the new WebView in Jelly Bean (4.1.1): An app using
the WebView crashes, when opening an URL that separates its query
parameters not using the ampersand character ('&') but e.g. a semi colon
(';').
Reproduce:
1) Call the following URL in a WebView:
http://www.heise.de/newsticker/meldung/TomTom-baut-um-1643641.html
the German heise page will redirect you to
http://m.heise.de/newsticker/meldung/TomTom-baut-um-1643641.html?mrw_channel=ho;mrw_channel=ho;from-classic=1
The page will load, but as soon as loading has finished the app will crash
with the following stack trace:
java.lang.IllegalArgumentException: bad parameter
at
org.apache.http.client.utils.URLEncodedUtils.parse(URLEncodedUtils.java:139)
at
org.apache.http.client.utils.URLEncodedUtils.parse(URLEncodedUtils.java:76)
at
android.webkit.AccessibilityInjector.getAxsUrlParameterValue(AccessibilityInjector.java:406)
at
android.webkit.AccessibilityInjector.shouldInjectJavaScript(AccessibilityInjector.java:322)
at
android.webkit.AccessibilityInjector.onPageFinished(AccessibilityInjector.java:281)
at
android.webkit.WebViewClassic.onPageFinished(WebViewClassic.java:3943)
at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:325)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Taking a look into the code of URLEncodedUtils.parse() (which is indirectly
called by WebViewClassic.onPageFinished()) shows why: The code throws the shown
exception if a single query parameter contains more than one equals sign ('=').
As this class assumes query parameters to be separated by '&' the defect URL
shown above has effectively only one query parameter from the view point of the
URLEncodedUtils-class and thus this single query parameter has multiple equals
signs causing the crash.
The stack trace also shows, that the method is called indirectly in the event
handler, so that there isn't a valid way to catch the exception.
Though the shown URL is defect it occurs in reality and I think the WebView
should be a little more tolerant.
Best regards
Sven
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en