JAL-2316 More unit testing and adjustments
[jalview.git] / src / jalview / urls / UrlProvider.java
index 7009e70..383c5d1 100644 (file)
@@ -57,12 +57,16 @@ public class UrlProvider implements UrlProviderI
     customProvider = findCustomProvider();
 
     // check that the defaultUrl still exists
-    if (!setDefaultUrl(defaultUrlString))
+    if (!contains(defaultUrlString))
     {
       // if the defaultUrl can't be found in any of the providers
       // set up a custom default url
       chooseDefaultUrl();
     }
+    else
+    {
+      setDefaultUrl(defaultUrlString);
+    }
   }
 
   /*
@@ -94,6 +98,24 @@ public class UrlProvider implements UrlProviderI
         outcome = true;
       }
     }
+    if (!outcome)
+    {
+      throw new IllegalArgumentException();
+    }
+    return outcome;
+  }
+
+  @Override
+  public boolean contains(String id)
+  {
+    boolean outcome = false;
+    for (UrlProviderI p : providers)
+    {
+      if (p.contains(id))
+      {
+        outcome = true;
+      }
+    }
     return outcome;
   }
   
@@ -151,7 +173,6 @@ public class UrlProvider implements UrlProviderI
   {
     for (UrlProviderI p : providers)
     {
-      p.setDefaultUrl(null);
       p.setUrlData(links);
     }
   }