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

Commit

Permalink
Catch unhandled URISyntaxException when parsing URLs for UA override. F…
Browse files Browse the repository at this point in the history
…ixes #848 (#857)
  • Loading branch information
bluemarvin authored Nov 27, 2018
1 parent 9e66e70 commit c5f1b17
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
Expand Down Expand Up @@ -42,8 +43,17 @@ public void loadOverridesFromAssets(Activity aActivity, String aFileName) {
}

public String lookupOverride(final String aUri) {
if (aUri == null) {
return null;
}
Log.d(LOGTAG, "lookupOverride for: " + aUri);
URI uri = URI.create(aUri);
URI uri;
try {
uri = new URI(aUri);
} catch (URISyntaxException e) {
Log.d(LOGTAG, "Error parsing URL: " + aUri + " " + e.getMessage());
return null;
}
String fullDomain = uri.getHost();
if (fullDomain == null) {
return null;
Expand Down

0 comments on commit c5f1b17

Please sign in to comment.