Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Handle exceptions thrown by java.net.URI #1918

Merged
merged 1 commit into from
Oct 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -793,11 +793,14 @@ public int getUaMode() {
private static final String MOBILE_PREFIX = "mobile.";

private String checkForMobileSite(String aUri) {
if (aUri == null) {
return null;
}
String result = null;
URI uri;
try {
uri = new URI(aUri);
} catch (URISyntaxException e) {
} catch (URISyntaxException | NullPointerException e) {
Log.d(LOGTAG, "Error parsing URL: " + aUri + " " + e.getMessage());
return null;
}
Expand All @@ -816,7 +819,7 @@ private String checkForMobileSite(String aUri) {
try {
uri = new URI(uri.getScheme(), authority.substring(foundPrefix.length()), uri.getPath(), uri.getQuery(), uri.getFragment());
result = uri.toString();
} catch (URISyntaxException e) {
} catch (URISyntaxException | NullPointerException e) {
Log.d(LOGTAG, "Error dropping mobile prefix from: " + aUri + " " + e.getMessage());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,9 @@ public void setURL(String aURL) {
try {
aURL = URLDecoder.decode(aURL, "UTF-8");

} catch (UnsupportedEncodingException e) {
} catch (UnsupportedEncodingException | IllegalArgumentException e) {
e.printStackTrace();
aURL = "";
}
if (aURL.startsWith("jar:")) {
return;
Expand Down