From 434ad00d88ce24785b9d9edbcd03ffa562fd8a4e Mon Sep 17 00:00:00 2001 From: Jakob Heher Date: Thu, 6 Oct 2022 10:11:35 +0200 Subject: sanitizing NULLable config values --- .../src/main/java/at/asit/pdfover/commons/Messages.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'pdf-over-commons') diff --git a/pdf-over-commons/src/main/java/at/asit/pdfover/commons/Messages.java b/pdf-over-commons/src/main/java/at/asit/pdfover/commons/Messages.java index 6ed52d5b..04c8583a 100644 --- a/pdf-over-commons/src/main/java/at/asit/pdfover/commons/Messages.java +++ b/pdf-over-commons/src/main/java/at/asit/pdfover/commons/Messages.java @@ -22,6 +22,8 @@ import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; +import javax.annotation.Nonnull; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -49,13 +51,13 @@ public class Messages { * Get the closest match to the system default Locale out of the supported locales * @return the default locale */ - public static Locale getDefaultLocale() { + public static @Nonnull Locale getDefaultLocale() { Locale ld = Locale.getDefault(); for (Locale l : Constants.SUPPORTED_LOCALES) { if (l.equals(ld) || l.getLanguage().equals(ld.getLanguage())) return l; } - return Constants.SUPPORTED_LOCALES[0]; + return Constants.ISNOTNULL(Constants.SUPPORTED_LOCALES[0]); } /** -- cgit v1.2.3