Merge branch 'develop' into spike/JAL-4047/JAL-4048_columns_in_sequenceID
[jalview.git] / src / jalview / io / IdentifyFile.java
index c21127e..ea87058 100755 (executable)
  */
 package jalview.io;
 
-import java.util.Locale;
-
 import java.io.File;
 import java.io.IOException;
+import java.util.Locale;
+
+import jalview.bin.Console;
 
 /**
  * DOCUMENT ME!
@@ -58,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)
@@ -94,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)
@@ -408,16 +407,15 @@ public class IdentifyFile
       }
     } catch (Exception ex)
     {
-      System.err.println("File Identification failed!\n" + ex);
+      Console.error("File Identification failed!\n" + ex);
       throw new FileFormatException(source.errormessage);
     }
     if (trimmedLength == 0)
     {
-      System.err.println(
-              "File Identification failed! - Empty file was read.");
+      Console.error("File Identification failed! - Empty file was read.");
       throw new FileFormatException("EMPTY DATA FILE");
     }
-    System.out.println("File format identified as " + reply.toString());
+    Console.debug("File format identified as " + reply.toString());
     return reply;
   }
 
@@ -485,15 +483,15 @@ public class IdentifyFile
         type = ider.identify(args[i], DataSourceType.FILE);
       } catch (FileFormatException e)
       {
-        System.err.println(
+        Console.error(
                 String.format("Error '%s' identifying file type for %s",
                         args[i], e.getMessage()));
       }
-      System.out.println("Type of " + args[i] + " is " + type);
+      Console.debug("Type of " + args[i] + " is " + type);
     }
     if (args == null || args.length == 0)
     {
-      System.err.println("Usage: <Filename> [<Filename> ...]");
+      Console.error("Usage: <Filename> [<Filename> ...]");
     }
   }