From 402821c3cc970b446a6fba91d21c4561da9c3160 Mon Sep 17 00:00:00 2001 From: Tobias Kellner Date: Tue, 6 Nov 2012 17:03:58 +0100 Subject: Message strings update --- .../gui/composites/MobileBKUEnterTANComposite.java | 2 +- .../at/asit/pdfover/gui/composites/OutputComposite.java | 2 +- .../gui/composites/SimpleConfigurationComposite.java | 6 +++++- .../at/asit/pdfover/gui/exceptions/InvalidEmblemFile.java | 4 ++-- .../asit/pdfover/gui/exceptions/InvalidPortException.java | 15 ++++++++++++--- 5 files changed, 21 insertions(+), 8 deletions(-) (limited to 'trunk/pdf-over-gui/src/main/java/at/asit/pdfover') diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java index 833d2670..fcd7084f 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java @@ -101,7 +101,7 @@ public class MobileBKUEnterTANComposite extends StateComposite { * @param tries */ public void setTries(int tries) { - this.lbl_tries.setText(tries + Messages.getString("tanEnter.tries")); //$NON-NLS-1$ + this.lbl_tries.setText(String.format(Messages.getString("tanEnter.tries"), tries)); //$NON-NLS-1$ } /** diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java index 7f73d0c8..a9ea31d2 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java @@ -214,7 +214,7 @@ public class OutputComposite extends StateComposite { if (OutputComposite.this.outputFile != null) { if (OutputComposite.this.outputFile.exists()) { - // Desktop supported check allready done in constructor + // Desktop supported check already done in constructor if (Desktop.isDesktopSupported()) { Desktop.getDesktop().open( OutputComposite.this.outputFile); diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java index 5d32ec30..04b10d9c 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java @@ -854,7 +854,11 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { if (portString == null || portString.trim().equals("")) { //$NON-NLS-1$ port = -1; } else { - port = Integer.parseInt(portString); + try { + port = Integer.parseInt(portString); + } catch (NumberFormatException e) { + throw new InvalidPortException(portString, e); + } } this.configurationContainer.setProxyPort(port); } diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/InvalidEmblemFile.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/InvalidEmblemFile.java index 0657da7c..0d3306fa 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/InvalidEmblemFile.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/InvalidEmblemFile.java @@ -34,7 +34,7 @@ public class InvalidEmblemFile extends PDFOverGUIException { * @param file */ public InvalidEmblemFile(final File file) { - super(file.getAbsolutePath() + Messages.getString("exception.InvalidEmblemFile")); //$NON-NLS-1$ + super(String.format(Messages.getString("exception.InvalidEmblemFile"), file.getAbsolutePath())); //$NON-NLS-1$ } /** @@ -43,6 +43,6 @@ public class InvalidEmblemFile extends PDFOverGUIException { * @param reason */ public InvalidEmblemFile(final File file, Throwable reason) { - super(file.getAbsolutePath() + Messages.getString("exception.InvalidEmblemFile"), reason); //$NON-NLS-1$ + super(String.format(Messages.getString("exception.InvalidEmblemFile"), file.getAbsolutePath()), reason); //$NON-NLS-1$ } } diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/InvalidPortException.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/InvalidPortException.java index 3a37d3a0..98b05c79 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/InvalidPortException.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/InvalidPortException.java @@ -28,10 +28,19 @@ public class InvalidPortException extends PDFOverGUIException { /** - * Constructor - * @param port + * Constructor with an invalid port number + * @param port invalid port number */ public InvalidPortException(int port) { - super(port + Messages.getString("exception.InvalidPort") + 0xffff); //$NON-NLS-1$ + super(String.format(Messages.getString("exception.InvalidPort"), Integer.toString(port), 1, 0xffff)); //$NON-NLS-1$ + } + + /** + * Constructor with an invalid port string + * @param source InvalidNumberFormat exception + * @param portString invalid port string + */ + public InvalidPortException(String portString, Throwable source) { + super(String.format(Messages.getString("exception.InvalidPort"), portString, 1, 0xffff), source); //$NON-NLS-1$ } } -- cgit v1.2.3