diff --git a/bundles/org.openhab.core.voice/src/main/java/org/eclipse/smarthome/core/voice/text/AbstractRuleBasedInterpreter.java b/bundles/org.openhab.core.voice/src/main/java/org/eclipse/smarthome/core/voice/text/AbstractRuleBasedInterpreter.java index 5001d07d1e..1acc27e325 100644 --- a/bundles/org.openhab.core.voice/src/main/java/org/eclipse/smarthome/core/voice/text/AbstractRuleBasedInterpreter.java +++ b/bundles/org.openhab.core.voice/src/main/java/org/eclipse/smarthome/core/voice/text/AbstractRuleBasedInterpreter.java @@ -585,16 +585,17 @@ public abstract class AbstractRuleBasedInterpreter implements HumanLanguageInter * @return resulting tokens */ protected ArrayList tokenize(Locale locale, String text) { + final Locale localeSafe = locale != null ? locale : Locale.getDefault(); ArrayList parts = new ArrayList(); if (text == null) { return parts; } String[] split; - if ((locale != null) && locale.getLanguage().equalsIgnoreCase(Locale.FRENCH.getLanguage())) { - split = text.toLowerCase(locale).replaceAll("[\\']", " ").replaceAll("[^\\w\\sàâäçéèêëîïôùûü]", " ") + if (localeSafe.getLanguage().equalsIgnoreCase(Locale.FRENCH.getLanguage())) { + split = text.toLowerCase(localeSafe).replaceAll("[\\']", " ").replaceAll("[^\\w\\sàâäçéèêëîïôùûü]", " ") .split("\\s"); } else { - split = text.toLowerCase(locale).replaceAll("[\\']", "").replaceAll("[^\\w\\s]", " ").split("\\s"); + split = text.toLowerCase(localeSafe).replaceAll("[\\']", "").replaceAll("[^\\w\\s]", " ").split("\\s"); } for (int i = 0; i < split.length; i++) { String part = split[i].trim();