Skip to content

Commit 32bf255

Browse files
Fix some regex dialect compatibility issues
RES-609 DEVSIX-6329
1 parent 75b2364 commit 32bf255

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

commons/src/main/java/com/itextpdf/commons/actions/producer/ProducerBuilder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ public final class ProducerBuilder extends AbstractITextConfigurationEvent {
6262
* <code>${</code> and ended with <code>}</code> without <code>}</code> character inside.
6363
* These substrings are interpreted as placeholders and the first group is the content of the
6464
* placeholder.
65+
* Note: The escape on '}' is necessary for regex dialect compatibility reasons.
6566
*/
66-
private static final String PATTERN_STRING = "\\$\\{([^}]*)}";
67+
private static final String PATTERN_STRING = "\\$\\{([^}]*)\\}";
6768
private static final Pattern PATTERN = Pattern.compile(PATTERN_STRING);
6869

6970
private static final Map<String, IPlaceholderPopulator> PLACEHOLDER_POPULATORS;

pdftest/src/main/java/com/itextpdf/test/LoggerHelper.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ static void failWrongTotalCount(int expected, int actual, Description descriptio
8686
* */
8787
static boolean equalsMessageByTemplate(String message, String template) {
8888
if (template.contains("{") && template.contains("}")) {
89-
String templateWithoutParameters = Pattern.quote(template).replace("''", "'").replaceAll("\\{[0-9]+?}", "\\\\E(.)*?\\\\Q");
89+
// Note: The escape on '}' is necessary for regex dialect compatibility reasons.
90+
String templateWithoutParameters = Pattern.quote(template).replace("''", "'").replaceAll("\\{[0-9]+?\\}", "\\\\E(.)*?\\\\Q");
9091
Pattern p = Pattern.compile(templateWithoutParameters, Pattern.DOTALL);
9192
return p.matcher(message).matches();
9293
} else {

0 commit comments

Comments
 (0)