You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:38:01 UTC
[sling-org-apache-sling-fsresource] 03/17: SLING-6918 enable json
comments and tick quotes by default (same as JCR content loader)
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.fsresource-1.4.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-fsresource.git
commit b49ef539209c57f58c1f87c72df3172c7becf23c
Author: Stefan Seifert <ss...@apache.org>
AuthorDate: Mon May 29 19:27:04 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/branches/fsresource-1.x@1796679 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
"commits@sling.apache.org" <co...@sling.apache.org>.