From 961d720adf23c1206d8110f6b2d00f072872155a Mon Sep 17 00:00:00 2001 From: jprocter Date: Fri, 31 Aug 2012 11:16:58 +0100 Subject: [PATCH] JAL-1064 patch for NPE when registerd database names do not resolve to one or more proxies --- src/jalview/ws/DBRefFetcher.java | 5 ++++- src/jalview/ws/seqfetcher/ASequenceFetcher.java | 10 +++++----- 2 files changed, 9 insertions(+), 6 deletions(-) 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; } -- 1.7.10.2