From 2aa15ba1f9803bd2f431b8b44de04bbd5d4cd10b Mon Sep 17 00:00:00 2001 From: Marco Zanon Date: Thu, 22 Oct 2015 13:20:45 +0000 Subject: [PATCH] Renamed MTranslationFileParsingTextException to MTranslationFileParsingException. --- .../MTranslationFileParsingException.java | 30 +++++++++++++++++++ .../MTranslationFileParsingTextException.java | 30 ------------------- .../marcozanon/macaco/text/MTranslator.java | 18 +++++------ 3 files changed, 39 insertions(+), 39 deletions(-) create mode 100644 src/java/com/marcozanon/macaco/text/MTranslationFileParsingException.java delete mode 100644 src/java/com/marcozanon/macaco/text/MTranslationFileParsingTextException.java diff --git a/src/java/com/marcozanon/macaco/text/MTranslationFileParsingException.java b/src/java/com/marcozanon/macaco/text/MTranslationFileParsingException.java new file mode 100644 index 0000000..a0734fe --- /dev/null +++ b/src/java/com/marcozanon/macaco/text/MTranslationFileParsingException.java @@ -0,0 +1,30 @@ +/** + * Macaco + * Copyright (c) 2009-2015 Marco Zanon . + * 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/src/java/com/marcozanon/macaco/text/MTranslationFileParsingTextException.java b/src/java/com/marcozanon/macaco/text/MTranslationFileParsingTextException.java deleted file mode 100644 index 2149ed2..0000000 --- a/src/java/com/marcozanon/macaco/text/MTranslationFileParsingTextException.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Macaco - * Copyright (c) 2009-2015 Marco Zanon . - * 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); - } - -} diff --git a/src/java/com/marcozanon/macaco/text/MTranslator.java b/src/java/com/marcozanon/macaco/text/MTranslator.java index b861837..f724714 100644 --- a/src/java/com/marcozanon/macaco/text/MTranslator.java +++ b/src/java/com/marcozanon/macaco/text/MTranslator.java @@ -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()); } 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); } } -- 2.30.2