Skip to content

Commit 36933bb

Browse files
committed
Fix alert-174
1 parent f3180e7 commit 36933bb

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

  • roda-core/roda-core/src/main/java/org/roda/core/common

roda-core/roda-core/src/main/java/org/roda/core/common/Messages.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* The contents of this file are subject to the license and copyright
33
* detailed in the LICENSE file at the root of the source
44
* tree and available online at
5-
*
5+
* <p>
66
* https://github.com/keeps/roda
77
*/
88
package org.roda.core.common;
@@ -20,6 +20,7 @@
2020
import java.util.MissingResourceException;
2121
import java.util.ResourceBundle;
2222
import java.util.ResourceBundle.Control;
23+
import java.util.regex.Pattern;
2324

2425
import org.apache.commons.configuration2.CombinedConfiguration;
2526
import org.apache.commons.configuration2.PropertiesConfiguration;
@@ -88,13 +89,13 @@ public <T extends Object> Map<String, T> getTranslations(String prefix, Class<T>
8889
while (keys.hasMoreElements()) {
8990
String key = keys.nextElement();
9091
if (key.startsWith(fullPrefix)) {
91-
map.put(replacePrefixFromKey ? key.replaceFirst(fullPrefix, "i18n.") : key,
92+
map.put(replacePrefixFromKey ? key.replaceFirst(Pattern.quote(fullPrefix), "i18n.") : key,
9293
valueClass.cast(resourceBundle.getString(key)));
9394
}
9495
}
9596

9697
// cache it
97-
translationsCache.put(prefix, (Map<String, ?>) map);
98+
translationsCache.put(prefix, map);
9899
return map;
99100
}
100101

0 commit comments

Comments
 (0)