From 47c8c6b377fe51ee60cdad518946613a262792cf Mon Sep 17 00:00:00 2001 From: tkellner Date: Wed, 10 Apr 2013 19:28:41 +0000 Subject: More null guards in config git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@341 174cde9d-5d70-4d2a-aa98-46368bc2aaf7 --- .../pdfover/gui/composites/ConfigurationComposite.java | 2 +- .../java/at/asit/pdfover/gui/workflow/ConfigProvider.java | 2 +- .../at/asit/pdfover/gui/workflow/ConfigProviderImpl.java | 14 ++++++++++---- .../pdfover/gui/workflow/PersistentConfigProvider.java | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-) (limited to 'pdf-over-gui/src/main/java/at') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java index 88fcfc0d..73e36074 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java @@ -290,7 +290,7 @@ public class ConfigurationComposite extends StateComposite { this.configurationContainer.setSignatureNote( this.configProvider.getSignatureNote()); - this.configurationContainer.setLocale(this.configProvider.getConfigLocale()); + this.configurationContainer.setLocale(this.configProvider.getLocale()); this.configurationContainer.setSignLocale(this.configProvider.getSignLocale()); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProvider.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProvider.java index 9d337b6d..7807079b 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProvider.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProvider.java @@ -116,7 +116,7 @@ public interface ConfigProvider { * Gets the configured locale * @return the configured locale */ - public Locale getConfigLocale(); + public Locale getLocale(); /** * Gets the configured locale diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java index 12b60c0f..45a834ab 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java @@ -275,7 +275,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, Point size = this.configuration.getMainWindowSize(); props.setProperty(Constants.CFG_MAINWINDOW_SIZE, size.x + "," + size.y); //$NON-NLS-1$ - Locale configLocale = this.getConfigLocale(); + Locale configLocale = this.getLocale(); if(configLocale != null) { props.setProperty(Constants.CFG_LOCALE, LocaleSerializer.getParsableString(configLocale)); } @@ -822,8 +822,11 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, * @see at.asit.pdfover.gui.workflow.ConfigProvider#getConfigLocale() */ @Override - public Locale getConfigLocale() { - return this.configuration.getLocale(); + public Locale getLocale() { + Locale locale = this.configuration.getLocale(); + if (locale == null) + locale = Messages.getDefaultLocale(); + return locale; } /* (non-Javadoc) @@ -843,7 +846,10 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, */ @Override public Locale getSignLocale() { - return this.configuration.getSignLocale(); + Locale locale = this.configuration.getSignLocale(); + if (locale == null) + locale = Messages.getDefaultLocale(); + return locale; } /* (non-Javadoc) diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/PersistentConfigProvider.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/PersistentConfigProvider.java index c9c02b63..764265fb 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/PersistentConfigProvider.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/PersistentConfigProvider.java @@ -100,7 +100,7 @@ public interface PersistentConfigProvider { * Gets the configured locale * @return the configured locale */ - public Locale getConfigLocale(); + public Locale getLocale(); /** * Gets the configured locale -- cgit v1.2.3