From a770f8d4bd583e9a719af6ce314838db12003b33 Mon Sep 17 00:00:00 2001 From: Selim Gurun Date: Wed, 13 Jun 2012 14:51:23 -0700 Subject: Encode characters that java.net.URI rejects Bug: 5952386 Our java.net.URI implementation conforms to an old obsolete RFC and it is very restrictive. Since in our download path, we use download manager and so java.net.URI, this causes an odd bug (i.e. URIs that are fetched fine by chromium http stack fails when download manager is used). Also there is a second bug that when URI parsing fails and an exception is thrown, we fail to catch it and crash. This CL fixes both. Change-Id: I62ac289566efae97dd2161b8041b06a0a87211cb --- src/com/android/browser/DownloadHandler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/com/android/browser/DownloadHandler.java') diff --git a/src/com/android/browser/DownloadHandler.java b/src/com/android/browser/DownloadHandler.java index 6e2c786d3..219114e11 100644 --- a/src/com/android/browser/DownloadHandler.java +++ b/src/com/android/browser/DownloadHandler.java @@ -107,7 +107,7 @@ public class DownloadHandler { boolean needed = false; for (char c : chars) { - if (c == '[' || c == ']') { + if (c == '[' || c == ']' || c == '|') { needed = true; break; } @@ -118,7 +118,7 @@ public class DownloadHandler { StringBuilder sb = new StringBuilder(""); for (char c : chars) { - if (c == '[' || c == ']') { + if (c == '[' || c == ']' || c == '|') { sb.append('%'); sb.append(Integer.toHexString(c)); } else { -- cgit v1.2.3