From ff513732821cba597d07b4fc19a1f7805b3412c1 Mon Sep 17 00:00:00 2001 From: kiramt Date: Mon, 12 Dec 2016 13:43:16 +0000 Subject: [PATCH] JAL-2316 Missed change from previous checkin --- src/jalview/urls/CustomUrlProvider.java | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/jalview/urls/CustomUrlProvider.java b/src/jalview/urls/CustomUrlProvider.java index f4dcc0c..dae9ccd 100644 --- a/src/jalview/urls/CustomUrlProvider.java +++ b/src/jalview/urls/CustomUrlProvider.java @@ -76,7 +76,8 @@ public class CustomUrlProvider extends UrlProviderImpl nonselectedUrls = parseUrlStrings(storedUrlList); } catch (Exception ex) { - System.out.println(ex + "\nError parsing sequence links"); + System.out + .println(ex.getMessage() + "\nError parsing sequence links"); } } @@ -98,7 +99,8 @@ public class CustomUrlProvider extends UrlProviderImpl nonselectedUrls = parseUrlList(storedUrlList); } catch (Exception ex) { - System.out.println(ex + "\nError parsing sequence links"); + System.out + .println(ex.getMessage() + "\nError parsing sequence links"); } } @@ -138,6 +140,11 @@ public class CustomUrlProvider extends UrlProviderImpl private HashMap parseUrlList(Map urlList) { HashMap urls = new HashMap(); + if (urlList == null) + { + return urls; + } + Iterator> it = urlList.entrySet().iterator(); while (it.hasNext()) { @@ -194,10 +201,6 @@ public class CustomUrlProvider extends UrlProviderImpl @Override public boolean setDefaultUrl(String id) { - /*if (id == null) - { - defaultUrl = null; - }*/ if (selectedUrls.containsKey(id)) { defaultUrl = id; @@ -315,14 +318,8 @@ public class CustomUrlProvider extends UrlProviderImpl public String chooseDefaultUrl() { // unilaterally set the default id to the EMBL_EBI link - - if (nonselectedUrls.containsKey(UrlConstants.DEFAULT_LABEL)) - { - // default key must be selected so remove from nonselected list - nonselectedUrls.remove(UrlConstants.DEFAULT_LABEL); - } - - if (!selectedUrls.containsKey(UrlConstants.DEFAULT_LABEL)) + if ((!nonselectedUrls.containsKey(UrlConstants.DEFAULT_LABEL)) + && (!selectedUrls.containsKey(UrlConstants.DEFAULT_LABEL))) { selectedUrls.put(UrlConstants.DEFAULT_LABEL, new UrlLink( UrlConstants.DEFAULT_STRING)); @@ -331,4 +328,10 @@ public class CustomUrlProvider extends UrlProviderImpl return UrlConstants.DEFAULT_LABEL; } + @Override + public boolean contains(String id) + { + return (selectedUrls.containsKey(id) || nonselectedUrls.containsKey(id)); + } + } -- 1.7.10.2