Renamed MTranslationFileParsingTextException to MTranslationFileParsingException.
authorMarco Zanon <info@marcozanon.com>
Thu, 22 Oct 2015 13:20:45 +0000 (13:20 +0000)
committerMarco Zanon <info@marcozanon.com>
Thu, 22 Oct 2015 13:20:45 +0000 (13:20 +0000)
4.x/src/java/com/marcozanon/macaco/text/MTranslationFileParsingException.java [new file with mode: 0644]
4.x/src/java/com/marcozanon/macaco/text/MTranslationFileParsingTextException.java [deleted file]
4.x/src/java/com/marcozanon/macaco/text/MTranslator.java

diff --git a/4.x/src/java/com/marcozanon/macaco/text/MTranslationFileParsingException.java b/4.x/src/java/com/marcozanon/macaco/text/MTranslationFileParsingException.java
new file mode 100644 (file)
index 0000000..a0734fe
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2015 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.text;
+
+@SuppressWarnings("serial")
+public class MTranslationFileParsingException extends MTranslationException {
+
+    /* */
+
+    public MTranslationFileParsingException() {
+        super();
+    }
+
+    public MTranslationFileParsingException(String message) {
+        super(message);
+    }
+
+    public MTranslationFileParsingException(Throwable error) {
+        super(error);
+    }
+
+    public MTranslationFileParsingException(String message, Throwable error) {
+        super(message, error);
+    }
+
+}
diff --git a/4.x/src/java/com/marcozanon/macaco/text/MTranslationFileParsingTextException.java b/4.x/src/java/com/marcozanon/macaco/text/MTranslationFileParsingTextException.java
deleted file mode 100644 (file)
index 2149ed2..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Macaco
- * Copyright (c) 2009-2015 Marco Zanon <info@marcozanon.com>.
- * Released under MIT license (see LICENSE for details).
- */
-
-package com.marcozanon.macaco.text;
-
-@SuppressWarnings("serial")
-public class MTranslationFileParsingTextException extends MTranslationException {
-
-    /* */
-
-    public MTranslationFileParsingTextException() {
-        super();
-    }
-
-    public MTranslationFileParsingTextException(String message) {
-        super(message);
-    }
-
-    public MTranslationFileParsingTextException(Throwable error) {
-        super(error);
-    }
-
-    public MTranslationFileParsingTextException(String message, Throwable error) {
-        super(message, error);
-    }
-
-}
index b8618373d00c89567798fa3a782095c09b03bdad..f7247145d98e73a7998bfcc3c0c5e16ec584c5e0 100644 (file)
@@ -26,7 +26,7 @@ public class MTranslator extends MObject {
 
     /* */
 
-    public MTranslator(String file, Locale basicLocale) throws MTranslationFileParsingTextException {
+    public MTranslator(String file, Locale basicLocale) throws MTranslationFileParsingException {
         super();
         //
         if (null == basicLocale) {
@@ -44,7 +44,7 @@ public class MTranslator extends MObject {
         try {
             tmpMTranslator = new MTranslator(this.getFile(), this.getBasicLocale());
         }
-        catch (MTranslationFileParsingTextException exception) { // should not happen
+        catch (MTranslationFileParsingException exception) { // should not happen
         }
         return tmpMTranslator;
     }
@@ -67,7 +67,7 @@ public class MTranslator extends MObject {
         return this.messages;
     }
 
-    public void parseFile(String file) throws MTranslationFileParsingTextException {
+    public void parseFile(String file) throws MTranslationFileParsingException {
         if (MText.isBlank(file)) {
             throw new IllegalArgumentException("Invalid 'file': null or empty.");
         }
@@ -77,7 +77,7 @@ public class MTranslator extends MObject {
             buffer = new LineNumberReader(new InputStreamReader(new FileInputStream(file), MInformation.TEXT_ENCODING));
         }
         catch (FileNotFoundException exception) {
-            throw new MTranslationFileParsingTextException("Could not open file.", exception);
+            throw new MTranslationFileParsingException("Could not open file.", exception);
         }
         catch (UnsupportedEncodingException exception) { // cannot happen
         }
@@ -89,7 +89,7 @@ public class MTranslator extends MObject {
                     line = buffer.readLine();
                 }
                 catch (IOException exception) {
-                    throw new MTranslationFileParsingTextException("Could not read file.", exception);
+                    throw new MTranslationFileParsingException("Could not read file.", exception);
                 }
                 if (null == line) {
                     break;
@@ -105,19 +105,19 @@ public class MTranslator extends MObject {
                 else if (null == message) {
                     message = line;
                     if (this.getMessagesReference().containsKey(message)) {
-                        throw new MTranslationFileParsingTextException(String.format("Invalid line: %s: duplicated message: %s.", buffer.getLineNumber(), message));
+                        throw new MTranslationFileParsingException(String.format("Invalid line: %s: duplicated message: %s.", buffer.getLineNumber(), message));
                     }
                     this.getMessagesReference().put(message, new LinkedHashMap<String, String>());
                 }
                 else {
                     int a = line.indexOf("=");
                     if (-1 == a) {
-                        throw new MTranslationFileParsingTextException(String.format("Invalid line: %s: string malformed: %s.", buffer.getLineNumber(), line));
+                        throw new MTranslationFileParsingException(String.format("Invalid line: %s: string malformed: %s.", buffer.getLineNumber(), line));
                     }
                     String localeRepresentation = line.substring(0, a).trim();
                     String translation = line.substring(a + 1).trim();
                     if (this.getMessagesReference().get(message).containsKey(localeRepresentation)) {
-                        throw new MTranslationFileParsingTextException(String.format("Invalid line: %s: duplicated translation for locale: %s.", buffer.getLineNumber(), message));
+                        throw new MTranslationFileParsingException(String.format("Invalid line: %s: duplicated translation for locale: %s.", buffer.getLineNumber(), message));
                     }
                     this.getMessagesReference().get(message).put(localeRepresentation, translation);
                 }
@@ -127,7 +127,7 @@ public class MTranslator extends MObject {
             buffer.close();
         }
         catch (IOException exception) {
-            throw new MTranslationFileParsingTextException("Could not close file.", exception);
+            throw new MTranslationFileParsingException("Could not close file.", exception);
         }
     }