sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From romb...@apache.org
Subject [sling-org-apache-sling-jcr-contentparser] 03/10: SLING-6916 JCR Content Parser: Tick parsing fails when string contains escaped escaped character
Date Tue, 07 Nov 2017 09:47:13 GMT
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.contentparser-1.2.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentparser.git

commit e5e5c5d2a551280879da131b0cdf234252866248
Author: Stefan Seifert <sseifert@apache.org>
AuthorDate: Mon May 29 15:24:44 2017 +0000

    SLING-6916 JCR Content Parser: Tick parsing fails when string contains escaped escaped
character
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/contentparser@1796649
13f79535-47bb-0310-9956-ffa450edef68
---
 .../org/apache/sling/jcr/contentparser/impl/JsonTicksConverter.java  | 3 +++
 .../apache/sling/jcr/contentparser/impl/JsonTicksConverterTest.java  | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverter.java
b/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverter.java
index 3d2cf9d..691873c 100644
--- a/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverter.java
+++ b/src/main/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverter.java
@@ -50,6 +50,9 @@ public final class JsonTicksConverter {
                     if (in != '\'') {
                         output.append("\\");
                     }
+                    if (in == '\\') {
+                        output.append("\\");
+                    }
                     escaped = false;
                 }
                 else {
diff --git a/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverterTest.java
b/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverterTest.java
index dfec3a0..d8c373a 100644
--- a/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverterTest.java
+++ b/src/test/java/org/apache/sling/jcr/contentparser/impl/JsonTicksConverterTest.java
@@ -69,4 +69,9 @@ public class JsonTicksConverterTest {
         assertEquals("{\"p\":\"\\u03A9\\u03A6\\u00A5\"}", tickToDoubleQuote("{'p':\"\\u03A9\\u03A6\\u00A5\"}"));
     }
 
+    @Test
+    public void testTickToQuoteWithDoubleBackslash() {
+        assertEquals("{\"p\":\"aa\\\\bb\"}", tickToDoubleQuote("{'p':\"aa\\\\bb\"}"));
+    }
+
 }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <commits@sling.apache.org>.

Mime
View raw message