Merge commit 'alpha/update_2_12_for_2_11_2_series_merge^2' into HEAD
[jalview.git] / src / jalview / ws / dbsources / EmblXmlSource.java
index 97d7c9f..7bb1977 100644 (file)
@@ -20,6 +20,8 @@
  */
 package jalview.ws.dbsources;
 
+import java.util.Locale;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.InputStream;
@@ -39,8 +41,6 @@ import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
-import com.stevesoft.pat.Regex;
-
 import jalview.analysis.SequenceIdMatcher;
 import jalview.bin.Cache;
 import jalview.datamodel.Alignment;
@@ -56,6 +56,7 @@ import jalview.util.DBRefUtils;
 import jalview.util.DnaUtils;
 import jalview.util.MapList;
 import jalview.util.MappingUtils;
+import jalview.util.MessageManager;
 import jalview.ws.ebi.EBIFetchClient;
 import jalview.xml.binding.embl.EntryType;
 import jalview.xml.binding.embl.EntryType.Feature;
@@ -69,10 +70,11 @@ import jalview.xml.binding.embl.XrefType;
  * 
  * @deprecated endpoint withdrawn August 2020 (JAL-3692), use EmblFlatfileSource
  */
+
 public abstract class EmblXmlSource extends EbiFileRetrievedProxy
 {
+  // TODO: delete class or update tyhis validator for 2.12 style Platform.regex
   private static final Regex ACCESSION_REGEX = new Regex("^[A-Z]+[0-9]+");
-
   /*
    * JAL-1856 Embl returns this text for query not found
    */
@@ -102,14 +104,14 @@ public abstract class EmblXmlSource extends EbiFileRetrievedProxy
     try
     {
       reply = dbFetch.fetchDataAsFile(
-              emprefx.toLowerCase() + ":" + query.trim(), "display=xml",
+              emprefx.toLowerCase(Locale.ROOT) + ":" + query.trim(), "display=xml",
               "xml");
     } catch (Exception e)
     {
       stopQuery();
       throw new Exception(
               String.format("EBI EMBL XML retrieval failed for %s:%s",
-                      emprefx.toLowerCase(), query.trim()),
+                      emprefx.toLowerCase(Locale.ROOT), query.trim()),
               e);
     }
     return getEmblSequenceRecords(emprefx, query, reply);
@@ -657,7 +659,6 @@ public abstract class EmblXmlSource extends EbiFileRetrievedProxy
     {
       return new int[] {};
     }
-
     try
     {
       List<int[]> ranges = DnaUtils.parseLocation(location);
@@ -754,7 +755,6 @@ public abstract class EmblXmlSource extends EbiFileRetrievedProxy
     }
     return getAccessionValidator().search(accession);
   }
-
   /**
    * Truncates (if necessary) the exon intervals to match 3 times the length of
    * the protein; also accepts 3 bases longer (for stop codon not included in
@@ -773,7 +773,6 @@ public abstract class EmblXmlSource extends EbiFileRetrievedProxy
     }
     int expectedCdsLength = proteinLength * 3;
     int exonLength = MappingUtils.getLength(Arrays.asList(exon));
-
     /*
      * if exon length matches protein, or is shorter, or longer by the 
      * length of a stop codon (3 bases), then leave it unchanged
@@ -783,7 +782,6 @@ public abstract class EmblXmlSource extends EbiFileRetrievedProxy
     {
       return exon;
     }
-
     int origxon[];
     int sxpos = -1;
     int endxon = 0;
@@ -803,7 +801,6 @@ public abstract class EmblXmlSource extends EbiFileRetrievedProxy
           // .println("Truncating final exon interval on region by "
           // + (cdspos - cdslength));
         }
-
         /*
          * shrink the final exon - reduce end position if forward
          * strand, increase it if reverse
@@ -819,7 +816,6 @@ public abstract class EmblXmlSource extends EbiFileRetrievedProxy
         break;
       }
     }
-
     if (sxpos != -1)
     {
       // and trim the exon interval set if necessary