From e2df9a89dc7f88af774bad8761837ec50982d9df Mon Sep 17 00:00:00 2001 From: Carlos Amengual Date: Mon, 19 Aug 2024 18:59:48 +0200 Subject: [PATCH] i18n: throw an exception if an empty key was requested in `LocalizableSupport` Follow-up to 921d4b572693f. --- .../main/java/io/sf/carte/echosvg/i18n/LocalizableSupport.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/echosvg-i18n/src/main/java/io/sf/carte/echosvg/i18n/LocalizableSupport.java b/echosvg-i18n/src/main/java/io/sf/carte/echosvg/i18n/LocalizableSupport.java index b8758a0f3..9d38c43ea 100644 --- a/echosvg-i18n/src/main/java/io/sf/carte/echosvg/i18n/LocalizableSupport.java +++ b/echosvg-i18n/src/main/java/io/sf/carte/echosvg/i18n/LocalizableSupport.java @@ -326,6 +326,9 @@ public String getString(String key) throws MissingResourceException { } } String classStr = (cls != null) ? cls.toString() : bundleName; + if (key.isEmpty()) { + throw new MissingResourceException("Requested an empty resource key.", classStr, key); + } System.err.println("Unable to find resource: " + key + " in " + classStr); return key; }