JAL-1503 update version in GPL header
[jalview.git] / src / jalview / ws / dbsources / das / datamodel / DasSourceRegistry.java
index 9d044bc..04a1b60 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
- * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.1)
+ * Copyright (C) 2014 The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
@@ -14,6 +14,7 @@
  * PURPOSE.  See the GNU General Public License for more details.
  * 
  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
  */
 package jalview.ws.dbsources.das.datamodel;
 
@@ -178,13 +179,21 @@ public class DasSourceRegistry implements DasSourceRegistryI,
     {
       // get local sources from properties and initialise the local source list
       String local = jalview.bin.Cache.getProperty("DAS_LOCAL_SOURCE");
+
       if (local != null)
       {
+        int n = 1;
         StringTokenizer st = new StringTokenizer(local, "\t");
         while (st.hasMoreTokens())
         {
           String token = st.nextToken();
           int bar = token.indexOf("|");
+          if (bar == -1)
+          {
+            System.err
+                    .println("Warning: DAS user local source appears to have no nickname (expected a '|' followed by nickname)\nOffending definition: '"
+                            + token + "'");
+          }
           String url = token.substring(bar + 1);
           boolean features = true, sequence = false;
           if (url.startsWith("sequence:"))
@@ -193,8 +202,25 @@ public class DasSourceRegistry implements DasSourceRegistryI,
             // this source also serves sequences as well as features
             sequence = true;
           }
-          createLocalSource(url, token.substring(0, bar), sequence,
-                  features);
+          try
+          {
+            if (bar > -1)
+            {
+              createLocalSource(url, token.substring(0, bar), sequence,
+                      features);
+            }
+            else
+            {
+              createLocalSource(url, "User Source" + n, sequence, features);
+            }
+          } catch (Exception q)
+          {
+            System.err
+                    .println("Unexpected exception when creating local source from '"
+                            + token + "'");
+            q.printStackTrace();
+          }
+          n++;
         }
       }
     }