This is an automated email from the ASF dual-hosted git repository.

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

commit 7cc193725aa239683f60147c2d70c6a6035136dc
Author: Stefan Seifert <[email protected]>
AuthorDate: Mon May 29 19:25:52 2017 +0000

    SLING-6918 enable json comments and tick quotes by default (same as JCR 
content loader)
    
    git-svn-id: 
https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/fsresource@1796678
 13f79535-47bb-0310-9956-ffa450edef68
---
 .../sling/fsprovider/internal/parser/ContentFileParserUtil.java    | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git 
a/src/main/java/org/apache/sling/fsprovider/internal/parser/ContentFileParserUtil.java
 
b/src/main/java/org/apache/sling/fsprovider/internal/parser/ContentFileParserUtil.java
index fa5ed35..a105dad 100644
--- 
a/src/main/java/org/apache/sling/fsprovider/internal/parser/ContentFileParserUtil.java
+++ 
b/src/main/java/org/apache/sling/fsprovider/internal/parser/ContentFileParserUtil.java
@@ -27,11 +27,14 @@ import java.io.BufferedInputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
+import java.util.EnumSet;
 
 import org.apache.commons.lang3.StringUtils;
 import org.apache.sling.jcr.contentparser.ContentParser;
 import org.apache.sling.jcr.contentparser.ContentParserFactory;
 import org.apache.sling.jcr.contentparser.ContentType;
+import org.apache.sling.jcr.contentparser.JsonParserFeature;
+import org.apache.sling.jcr.contentparser.ParserOptions;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -48,7 +51,9 @@ class ContentFileParserUtil {
         ClassLoader oldClassLoader = 
Thread.currentThread().getContextClassLoader();
         try {
             
Thread.currentThread().setContextClassLoader(ContentFileParserUtil.class.getClassLoader());
-            JSON_PARSER = ContentParserFactory.create(ContentType.JSON);
+            // support comments and tick quotes for JSON parsing - same as in 
JCR content loader 
+            JSON_PARSER = ContentParserFactory.create(ContentType.JSON, new 
ParserOptions()
+                    .jsonParserFeatures(EnumSet.of(JsonParserFeature.COMMENTS, 
JsonParserFeature.QUOTE_TICK)));
         }
         finally {
             Thread.currentThread().setContextClassLoader(oldClassLoader);

-- 
To stop receiving notification emails like this one, please contact
"[email protected]" <[email protected]>.

Reply via email to