Skip to content

Commit

Permalink
Revert #253
Browse files Browse the repository at this point in the history
  • Loading branch information
f-necas committed Jan 5, 2024
1 parent 9b2e374 commit b4c4d7a
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,17 +201,19 @@ protected static String escapeLikeLiteral(String text) {
protected static String convertLikePattern(PropertyIsLike filter) {
String result = filter.getLiteral();
if (!filter.getWildCard().equals("*")) {
final String wildcardRe = "(?<!" + Pattern.quote(filter.getEscape()) + ")" + Pattern.quote(filter.getWildCard());
final String wildcardRe =
StringUtils.isNotEmpty(filter.getEscape())
? Pattern.quote(filter.getEscape() + filter.getWildCard())
: filter.getWildCard();
result = result.replaceAll(wildcardRe, "*");
}
if (!filter.getSingleChar().equals("?")) {
final String singleCharRe = "(?<!" + Pattern.quote(filter.getEscape()) + ")" + Pattern.quote(filter.getSingleChar());
final String singleCharRe =
StringUtils.isNotEmpty(filter.getEscape())
? Pattern.quote(filter.getEscape() + filter.getSingleChar())
: filter.getSingleChar();
result = result.replaceAll(singleCharRe, "?");
}
if (!filter.getEscape().equals("\\")) {
final String escapeRe = Pattern.quote(filter.getEscape()) + "(.)";
result = result.replaceAll(escapeRe, "\\\\$1");
}
return result;
}

Expand Down Expand Up @@ -363,7 +365,7 @@ public Object visit(PropertyIsEqualTo filter, Object extraData) {
String dataPropertyValue = stack.pop();
String dataPropertyName = stack.pop();

final String filterEqualTo = String.format(templateMatch, dataPropertyName, dataPropertyValue.replaceAll("\\/", "\\\\\\\\/"));
final String filterEqualTo = String.format(templateMatch, dataPropertyName, dataPropertyValue);
stack.push(filterEqualTo);

return this;
Expand Down

0 comments on commit b4c4d7a

Please sign in to comment.