feature locations are retrieved by associated accession string
[jalview.git] / src / jalview / io / FileParse.java
index e234c98..eb10375 100755 (executable)
@@ -27,6 +27,7 @@ import java.net.*;
 public class FileParse
 {
   public File inFile=null;
+  protected char suffixSeparator = '#';
   /**
    * '#' separated string tagged on to end of filename 
    * or url that was clipped off to resolve to valid filename
@@ -50,6 +51,7 @@ public class FileParse
    * @return this.error (true if the source was invalid)
    */
   private boolean checkFileSource(String fileStr) throws IOException {
+    error=false;
     this.inFile = new File(fileStr);
     // check to see if it's a Jar file in disguise.
     if (!inFile.exists()) {
@@ -84,7 +86,7 @@ public class FileParse
    */
   private String extractSuffix(String fileStr) {
     // first check that there wasn't a suffix string tagged on.
-    int sfpos = fileStr.lastIndexOf('#');
+    int sfpos = fileStr.lastIndexOf(suffixSeparator);
     if (sfpos>-1 && sfpos<fileStr.length()-1) {
       suffix = fileStr.substring(sfpos+1);
       // System.err.println("DEBUG: Found Suffix:"+suffix);
@@ -110,20 +112,24 @@ public class FileParse
     {
       if (checkFileSource(fileStr)) {  
         String suffixLess = extractSuffix(fileStr);
-        if (suffixLess!=null && checkFileSource(suffixLess))
+        if (suffixLess!=null)
+        {
+          if (checkFileSource(suffixLess))
+          {
+            throw new IOException("Problem opening "+inFile+" (also tried "+suffixLess+") : "+errormessage);
+          }
+        } else
         {
-          throw new IOException("Problem opening "+inFile+" (also tried "+fileStr+") : "+errormessage);
-        }
-          // returns normally.
-      } else {
           throw new IOException("Problem opening "+inFile+" : "+errormessage);
+        }
       }
     }
     else if (type.equals(AppletFormatAdapter.URL))
     {
       try {
         checkURLSource(fileStr);
-        String suffixLess = extractSuffix(fileStr); // URL lref is stored for later reference.
+        if (suffixSeparator=='#')
+          extractSuffix(fileStr); // URL lref is stored for later reference.
       } catch (IOException e) {
         String suffixLess = extractSuffix(fileStr);
         if (suffixLess==null)