Merge branch 'Release_2_8_2_Branch' into JAL-429_phylip-file-support
[jalview.git] / src / jalview / io / FileParse.java
index e8e9f2e..8e9a49c 100755 (executable)
@@ -20,6 +20,8 @@
  */
 package jalview.io;
 
+import jalview.util.MessageManager;
+
 import java.io.*;
 import java.net.*;
 import java.util.zip.GZIPInputStream;
@@ -94,8 +96,7 @@ public class FileParse
   {
     if (from == null)
     {
-      throw new Error(
-              "Implementation error. Null FileParse in copy constructor");
+      throw new Error(MessageManager.getString("error.implementation_error_null_fileparse"));
     }
     if (from == this)
       return;
@@ -208,7 +209,7 @@ public class FileParse
     {
       if (e != null)
       {
-        throw new IOException("Failed to resolve GZIP stream", e);
+        throw new IOException(MessageManager.getString("exception.failed_to_resolve_gzip_stream"), e);
       }
       throw q;
     }
@@ -263,14 +264,12 @@ public class FileParse
         {
           if (checkFileSource(suffixLess))
           {
-            throw new IOException("Problem opening " + inFile
-                    + " (also tried " + suffixLess + ") : " + errormessage);
+            throw new IOException(MessageManager.formatMessage("exception.problem_opening_file_also_tried", new String[]{inFile.getName(),suffixLess,errormessage}));
           }
         }
         else
         {
-          throw new IOException("Problem opening " + inFile + " : "
-                  + errormessage);
+          throw new IOException(MessageManager.formatMessage("exception.problem_opening_file", new String[]{inFile.getName(),errormessage}));
         }
       }
     }
@@ -345,8 +344,7 @@ public class FileParse
     if (dataIn == null || error)
     {
       // pass up the reason why we have no source to read from
-      throw new IOException("Failed to read data from source:\n"
-              + errormessage);
+      throw new IOException(MessageManager.formatMessage("exception.failed_to_read_data_from_source", new String[]{errormessage}));
     }
     error = false;
     dataIn.mark(READAHEAD_LIMIT);
@@ -366,7 +364,7 @@ public class FileParse
     }
     else
     {
-      throw new IOException("Unitialised Source Stream");
+      throw new IOException(MessageManager.getString("exception.no_init_source_stream"));
     }
   }
 
@@ -374,7 +372,7 @@ public class FileParse
   {
     if (!error)
       return dataIn.readLine();
-    throw new IOException("Invalid Source Stream:" + errormessage);
+    throw new IOException(MessageManager.formatMessage("exception.invalid_source_stream", new String[]{errormessage}));
   }
 
   public boolean isValid()
@@ -406,8 +404,7 @@ public class FileParse
     }
     else
     {
-      throw new IOException(
-              "Implementation Error: Reset called for invalid source.");
+      throw new IOException(MessageManager.getString("error.implementation_error_reset_called_for_invalid_source"));
     }
   }