Skip to content

Commit 07d2b5a

Browse files
committed
fix: use DOTALL modifier to pattern matcher #3807
1 parent f319a1b commit 07d2b5a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

opal-spi-r/src/main/java/org/obiba/opal/spi/r/datasource/magma/RVariableHelper.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -314,15 +314,17 @@ private List<Attribute> extractLocalizedAttributes(String namespace, String name
314314
if (Strings.isNullOrEmpty(value)) return attributes;
315315

316316
String[] strValues = value.split("\\|");
317-
Pattern pattern = Pattern.compile("^\\(([a-z]{2})\\) (.+)");
317+
Pattern pattern = Pattern.compile("^\\(([a-z]{2})\\) (.+)", Pattern.DOTALL);
318318
for (String strValue : strValues) {
319319
Matcher matcher = pattern.matcher(strValue.trim());
320320
if (matcher.find()) {
321321
String localeStr = matcher.group(1);
322322
if (!RUtils.isLocaleValid(localeStr))
323323
localeStr = defaultLocale;
324+
int count = matcher.groupCount();
325+
String attrValue = matcher.group(2);
324326
attributes.add(Attribute.Builder.newAttribute(name).withNamespace(namespace)
325-
.withLocale(localeStr).withValue(matcher.group(2)).build());
327+
.withLocale(localeStr).withValue(attrValue).build());
326328
} else if (Strings.isNullOrEmpty(namespace) && ("label".equals(name) || "description".equals(name)))
327329
attributes.add(Attribute.Builder.newAttribute(name).withLocale(defaultLocale).withValue(strValue).build());
328330
else

0 commit comments

Comments
 (0)