*/
public static URL verify (URL url) throws MalformedURLException
{
+
+
return verify(Build.hostWhitelist(), url);
}
}
String urlHost = url.getHost();
+ String protocol = url.getProtocol();
+
+ if (ALLOW_LOCATOR_FILE_PROTOCOL && protocol.equals("file") && urlHost.equals("")) {
+ return url;
+ }
+
for (String host : hosts) {
String regex = host.replace(".", "\\.").replace("*", ".*");
if (urlHost.matches(regex)) {
throw new MalformedURLException(
"The host for the specified URL (" + url + ") is not in the host whitelist: " + hosts);
}
+ private static boolean ALLOW_LOCATOR_FILE_PROTOCOL = true;
}