ensure id string doesn't get set to the empty string
authorjprocter <Jim Procter>
Mon, 12 Oct 2009 12:45:03 +0000 (12:45 +0000)
committerjprocter <Jim Procter>
Mon, 12 Oct 2009 12:45:03 +0000 (12:45 +0000)
src/MCview/PDBfile.java

index 87a965b..8585c4b 100755 (executable)
@@ -55,7 +55,7 @@ public class PDBfile extends jalview.io.AlignFile
   public void parse() throws IOException
   {
     // TODO set the filename sensibly
-    id = (inFile == null) ? "PDBFILE" : inFile.getName();
+    id = (inFile == null || inFile.getName().length()==0) ? "PDBFILE" : inFile.getName();
     try
     {
       chains = new Vector();
@@ -70,7 +70,12 @@ public class PDBfile extends jalview.io.AlignFile
       {
         if (line.indexOf("HEADER") == 0)
         {
-          id = line.substring(62, 67).trim();
+          // make sure we don't get zero length ID strings
+          String tid = line.substring(62, 67).trim();
+          if (tid.length()>0)
+          {
+            id = tid;
+          }
           continue;
         }
         // Were we to do anything with SEQRES - we start it here