JAL-3246 JAL-3247 Reworked JVL files as getdown.txt config with limitations
[jalview.git] / getdown / src / getdown / core / src / main / java / com / threerings / getdown / util / HostWhitelist.java
index c05992a..f2f7ef3 100644 (file)
@@ -25,6 +25,8 @@ public final class HostWhitelist
      */
     public static URL verify (URL url) throws MalformedURLException
     {
+        
+      
         return verify(Build.hostWhitelist(), url);
     }
 
@@ -41,6 +43,12 @@ public final class HostWhitelist
         }
 
         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)) {
@@ -51,4 +59,5 @@ public final class HostWhitelist
         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;
 }