You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ra...@apache.org on 2019/07/24 09:03:13 UTC

[sling-org-apache-sling-contentparser-api] branch master updated: SLING-8570 - Extract a generic Content Parser API from org.apache.sling.jcr.contentparser with pluggable implementations

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

radu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-contentparser-api.git


The following commit(s) were added to refs/heads/master by this push:
     new 45d17a0  SLING-8570 - Extract a generic Content Parser API from org.apache.sling.jcr.contentparser with pluggable implementations
45d17a0 is described below

commit 45d17a048f7d21f08fab581f3b74dc640116545f
Author: Radu Cotescu <co...@adobe.com>
AuthorDate: Wed Jul 24 10:17:52 2019 +0200

    SLING-8570 - Extract a generic Content Parser API from org.apache.sling.jcr.contentparser with pluggable implementations
    
    * minor code cleanup
---
 src/main/java/org/apache/sling/contentparser/api/ContentParser.java | 2 +-
 src/main/java/org/apache/sling/contentparser/api/ParserHelper.java  | 5 ++++-
 src/main/java/org/apache/sling/contentparser/api/ParserOptions.java | 6 +++---
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/sling/contentparser/api/ContentParser.java b/src/main/java/org/apache/sling/contentparser/api/ContentParser.java
index 2738088..4b3a29f 100644
--- a/src/main/java/org/apache/sling/contentparser/api/ContentParser.java
+++ b/src/main/java/org/apache/sling/contentparser/api/ContentParser.java
@@ -60,6 +60,6 @@ public interface ContentParser {
      * @throws IOException    when an I/O error occurs
      * @throws ParseException when a parsing error occurs.
      */
-    void parse(ContentHandler contentHandler, InputStream inputStream, ParserOptions parserOptions) throws IOException, ParseException;
+    void parse(ContentHandler contentHandler, InputStream inputStream, ParserOptions parserOptions) throws IOException;
 
 }
diff --git a/src/main/java/org/apache/sling/contentparser/api/ParserHelper.java b/src/main/java/org/apache/sling/contentparser/api/ParserHelper.java
index 3d6a973..a0d3c11 100644
--- a/src/main/java/org/apache/sling/contentparser/api/ParserHelper.java
+++ b/src/main/java/org/apache/sling/contentparser/api/ParserHelper.java
@@ -42,6 +42,9 @@ public final class ParserHelper {
             DateTimeFormatter.ofPattern(ISO_8601_MILLISECONDS_DATE_FORMAT,
                     DATE_FORMAT_LOCALE);
 
+    // static methods only
+    private ParserHelper() {}
+
     /**
      * Attempts to parse a {@code string} using first the {@link #ISO_8601_MILLISECONDS_DATE_FORMAT} format and then the {@link
      * #ECMA_DATE_FORMAT}.
@@ -95,7 +98,7 @@ public final class ParserHelper {
         return convertedArray;
     }
 
-    private static Calendar parseDate(String string, DateTimeFormatter formatter) throws DateTimeParseException {
+    private static Calendar parseDate(String string, DateTimeFormatter formatter) {
         final ZonedDateTime zonedDateTime = ZonedDateTime.parse(string, formatter);
         final Instant instant = zonedDateTime.toInstant();
         Calendar calendar = Calendar.getInstance();
diff --git a/src/main/java/org/apache/sling/contentparser/api/ParserOptions.java b/src/main/java/org/apache/sling/contentparser/api/ParserOptions.java
index c28ffe7..3bdcb12 100644
--- a/src/main/java/org/apache/sling/contentparser/api/ParserOptions.java
+++ b/src/main/java/org/apache/sling/contentparser/api/ParserOptions.java
@@ -105,7 +105,7 @@ public class ParserOptions {
      * @return this
      */
     public ParserOptions ignorePropertyNames(Set<String> value) {
-        this.ignorePropertyNames = value;
+        this.ignorePropertyNames = Collections.unmodifiableSet(value);
         return this;
     }
 
@@ -120,7 +120,7 @@ public class ParserOptions {
      * @return this
      */
     public ParserOptions ignoreResourceNames(Set<String> value) {
-        this.ignoreResourceNames = value;
+        this.ignoreResourceNames = Collections.unmodifiableSet(value);
         return this;
     }
 
@@ -135,7 +135,7 @@ public class ParserOptions {
      * @return this
      */
     public ParserOptions removePropertyNamePrefixes(Set<String> value) {
-        this.removePropertyNamePrefixes = value;
+        this.removePropertyNamePrefixes = Collections.unmodifiableSet(value);
         return this;
     }