Commit 14384755 authored by Thomas Guilbert's avatar Thomas Guilbert Committed by Commit Bot

Catch URISyntaxError in MediaUrlResolver

Certain platform implementation of HttpUrlConnection sometimes throw a
URISyntaxError, despite HttpUrlConnection not defining it as a throwable
exception, as part of its interface.

This CL fixes the issue.

Bug: 820130
Change-Id: I86602cf4a93fa8fccf19fbb4470e2cde48ba14b5
Reviewed-on: https://chromium-review.googlesource.com/957585Reviewed-by: default avatarAnthony Berent <aberent@chromium.org>
Commit-Queue: Thomas Guilbert <tguilbert@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543123}
parent 1989515c
...@@ -14,6 +14,7 @@ import org.chromium.base.metrics.RecordHistogram; ...@@ -14,6 +14,7 @@ import org.chromium.base.metrics.RecordHistogram;
import java.io.IOException; import java.io.IOException;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URISyntaxException;
import java.net.URL; import java.net.URL;
import java.net.URLStreamHandler; import java.net.URLStreamHandler;
import java.util.Arrays; import java.util.Arrays;
...@@ -190,6 +191,13 @@ public class MediaUrlResolver extends AsyncTask<Void, Void, MediaUrlResolver.Res ...@@ -190,6 +191,13 @@ public class MediaUrlResolver extends AsyncTask<Void, Void, MediaUrlResolver.Res
recordResultHistogram(RESOLVE_RESULT_HUC_EXCEPTION); recordResultHistogram(RESOLVE_RESULT_HUC_EXCEPTION);
Log.e(TAG, "Threading issue with HUC, see https://crbug.com/754480", e); Log.e(TAG, "Threading issue with HUC, see https://crbug.com/754480", e);
uri = Uri.EMPTY; uri = Uri.EMPTY;
} catch (RuntimeException e) {
if (e.getCause() instanceof URISyntaxException) {
Log.e(TAG, "Invalid URL format", e);
uri = Uri.EMPTY;
} else {
throw e;
}
} finally { } finally {
if (urlConnection != null) urlConnection.disconnect(); if (urlConnection != null) urlConnection.disconnect();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment