JAL-3725 restrict mapped virtual feature location to mapped region
[jalview.git] / src / jalview / io / FeaturesFile.java
index 92473ec..71fc659 100755 (executable)
@@ -20,6 +20,8 @@
  */
 package jalview.io;
 
+import java.util.Locale;
+
 import java.awt.Color;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -108,11 +110,11 @@ public class FeaturesFile extends AlignFile implements FeaturesSourceI
   /**
    * Constructor which does not parse the file immediately
    * 
-   * @param file
+   * @param file File or String filename
    * @param paste
    * @throws IOException
    */
-  public FeaturesFile(String file, DataSourceType paste)
+  public FeaturesFile(Object file, DataSourceType paste)
           throws IOException
   {
     super(false, file, paste);
@@ -135,7 +137,7 @@ public class FeaturesFile extends AlignFile implements FeaturesSourceI
    * @param type
    * @throws IOException
    */
-  public FeaturesFile(boolean parseImmediately, String file,
+  public FeaturesFile(boolean parseImmediately, Object file,
           DataSourceType type) throws IOException
   {
     super(parseImmediately, file, type);
@@ -234,7 +236,7 @@ public class FeaturesFile extends AlignFile implements FeaturesSourceI
         // skip comments/process pragmas
         if (line.length() == 0 || line.startsWith("#"))
         {
-          if (line.toLowerCase().startsWith("##"))
+          if (line.toLowerCase(Locale.ROOT).startsWith("##"))
           {
             processGffPragma(line, gffProps, align, newseqs);
           }
@@ -346,7 +348,7 @@ public class FeaturesFile extends AlignFile implements FeaturesSourceI
     String line;
     while ((line = nextLine()) != null)
     {
-      if (line.toUpperCase().startsWith(ENDFILTERS))
+      if (line.toUpperCase(Locale.ROOT).startsWith(ENDFILTERS))
       {
         return;
       }
@@ -1391,7 +1393,9 @@ public class FeaturesFile extends AlignFile implements FeaturesSourceI
     } catch (IOException q)
     {
     }
-    FastaFile parser = new FastaFile(this);
+    // Opening a FastaFile object with the remainder of this object's dataIn.
+    // Tell the constructor to NOT close the dataIn when finished.
+    FastaFile parser = new FastaFile(this, false);
     List<SequenceI> includedseqs = parser.getSeqs();
 
     SequenceIdMatcher smatcher = new SequenceIdMatcher(newseqs);