File tree Expand file tree Collapse file tree
main/java/org/z3950/zing/cql
test/java/org/z3950/zing/cql Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -242,6 +242,10 @@ static String toCQLTerm(String str) {
242242 escaped = ch == '\\' && !escaped;
243243 sb.append(ch);
244244 }
245+ if (escaped) {
246+ // trailing backslash - escape it
247+ sb.append('\\');
248+ }
245249 if (quote) {
246250 return "\"" + sb.toString() + "\"";
247251 } else {
Original file line number Diff line number Diff line change @@ -50,8 +50,13 @@ public void TestTCQLTermQuoteQuote4() {
5050 }
5151
5252 @Test
53- public void TestTCQLTermQuoteBackSlashTrail() {
54- assertEquals("a\\", CQLTermNode.toCQLTerm("a\\"));
53+ public void TestTCQLTermQuoteBackSlashTrail1() {
54+ assertEquals("a\\\\", CQLTermNode.toCQLTerm("a\\"));
55+ }
56+
57+ @Test
58+ public void TestTCQLTermQuoteBackSlashTrail2() {
59+ assertEquals("\"a \\\\\"", CQLTermNode.toCQLTerm("a \\"));
5560 }
5661
5762}
You can’t perform that action at this time.
0 commit comments