From: jprocter Date: Fri, 31 Aug 2012 10:16:58 +0000 (+0100) Subject: JAL-1064 patch for NPE when registerd database names do not resolve to one or more... X-Git-Tag: Jalview_2_9~370 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=961d720adf23c1206d8110f6b2d00f072872155a;p=jalview.git JAL-1064 patch for NPE when registerd database names do not resolve to one or more proxies --- diff --git a/src/jalview/ws/DBRefFetcher.java b/src/jalview/ws/DBRefFetcher.java index 1886172..5413a30 100644 --- a/src/jalview/ws/DBRefFetcher.java +++ b/src/jalview/ws/DBRefFetcher.java @@ -153,7 +153,10 @@ public class DBRefFetcher implements Runnable } List srces=new ArrayList(); for (String ddb:defdb) { - srces.addAll(sfetcher.getSourceProxy(ddb)); + List srcesfordb=sfetcher.getSourceProxy(ddb); + if (srcesfordb!=null) { + srces.addAll(srcesfordb); + } } // append the selected sequence sources to the default dbs diff --git a/src/jalview/ws/seqfetcher/ASequenceFetcher.java b/src/jalview/ws/seqfetcher/ASequenceFetcher.java index d4501d8..09a7a95 100644 --- a/src/jalview/ws/seqfetcher/ASequenceFetcher.java +++ b/src/jalview/ws/seqfetcher/ASequenceFetcher.java @@ -262,10 +262,10 @@ public class ASequenceFetcher public List getSourceProxy(String db) { List dbs; - Collection dblist = FETCHABLEDBS.get(db).values(); - if (dblist.size()>1) - { - DbSourceProxy[] l=dblist.toArray(new DbSourceProxy[0]); + Map dblist = FETCHABLEDBS.get(db); + if (dblist==null) {return new ArrayList();}; + if (dblist.size()>1) { + DbSourceProxy[] l=dblist.values().toArray(new DbSourceProxy[0]); int i=0; String[] nm=new String[l.length]; for (DbSourceProxy s:l) @@ -279,7 +279,7 @@ public class ASequenceFetcher dbs.add(l[i]); } } else { - dbs = new ArrayList(dblist); + dbs = new ArrayList(dblist.values()); } return dbs; }