X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FIdentifyFile.java;h=ea870582e3f3f5eef6c3e8a3a39e1f90b20b6791;hb=cadabddd959db11250cdf19b28606106540b3268;hp=e7ee711989df0c4de8228147e5f57f0f37b4c493;hpb=f42cec3b999bbed0ce85045760b55701c527da32;p=jalview.git diff --git a/src/jalview/io/IdentifyFile.java b/src/jalview/io/IdentifyFile.java index e7ee711..ea87058 100755 --- a/src/jalview/io/IdentifyFile.java +++ b/src/jalview/io/IdentifyFile.java @@ -22,6 +22,9 @@ package jalview.io; import java.io.File; import java.io.IOException; +import java.util.Locale; + +import jalview.bin.Console; /** * DOCUMENT ME! @@ -31,12 +34,14 @@ import java.io.IOException; */ public class IdentifyFile { - - public FileFormatI identify(Object file, DataSourceType protocol) throws FileFormatException + + public FileFormatI identify(Object file, DataSourceType protocol) + throws FileFormatException { // BH 2018 - return (file instanceof File ? identify((File) file, protocol) : identify((String) file, protocol)); - + return (file instanceof File ? identify((File) file, protocol) + : identify((String) file, protocol)); + } public FileFormatI identify(File file, DataSourceType sourceType) @@ -54,8 +59,7 @@ public class IdentifyFile } } catch (Exception e) { - System.err.println("Error whilst identifying " + file); - e.printStackTrace(System.err); + Console.error("Error whilst identifying " + file, e); emessage = e.getMessage(); } if (parser != null) @@ -90,8 +94,7 @@ public class IdentifyFile } } catch (Exception e) { - System.err.println("Error whilst identifying " + file); - e.printStackTrace(System.err); + Console.error("Error whilst identifying " + file, e); emessage = e.getMessage(); } if (parser != null) @@ -165,8 +168,8 @@ public class IdentifyFile if (source.inFile != null) { String fileStr = source.inFile.getName(); - if (fileStr.contains(".jar") - || fileStr.contains(".zip") || fileStr.contains(".jvp")) + if (fileStr.contains(".jar") || fileStr.contains(".zip") + || fileStr.contains(".jvp")) { // possibly a Jalview archive (but check further) reply = FileFormat.Jalview; @@ -178,7 +181,7 @@ public class IdentifyFile break; } } - data = data.toUpperCase(); + data = data.toUpperCase(Locale.ROOT); if (data.startsWith(ScoreMatrixFile.SCOREMATRIX)) { @@ -332,7 +335,7 @@ public class IdentifyFile if ((lessThan > -1)) // possible Markup Language data i.e HTML, // RNAML, XML { - String upper = data.toUpperCase(); + String upper = data.toUpperCase(Locale.ROOT); if (upper.substring(lessThan).startsWith(" [ ...]"); + Console.error("Usage: [ ...]"); } } - }