This is an automated email from the ASF dual-hosted git repository. sseifert pushed a commit to branch feature/SLING-12281-parent-60 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-contentparser-json.git
commit 4e4dff80384c93bc0e20ff64fee9cdb86e628f77 Author: Stefan Seifert <[email protected]> AuthorDate: Tue Apr 9 10:32:31 2024 +0200 SLING-12281 apply spotless code formatting --- pom.xml | 32 +++++----- .../contentparser/json/JSONParserFeature.java | 37 ++++++----- .../contentparser/json/JSONParserOptions.java | 36 +++++------ .../json/internal/JSONContentParser.java | 62 +++++++++--------- .../json/internal/JSONTicksConverter.java | 62 ++++++++---------- .../sling/contentparser/json/package-info.java | 34 +++++----- .../json/internal/JSONContentParserTest.java | 74 ++++++++++++---------- 7 files changed, 166 insertions(+), 171 deletions(-) diff --git a/pom.xml b/pom.xml index f4f0636..68eb048 100644 --- a/pom.xml +++ b/pom.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> +<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file @@ -30,29 +30,15 @@ <version>2.1.0-SNAPSHOT</version> <name>Apache Sling Content Parser for JSON</name> - <description> - Apache Sling Content Parser for resource trees stored in JSON files - </description> + <description>Apache Sling Content Parser for resource trees stored in JSON files</description> <scm> <connection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-contentparser-json.git</connection> <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-contentparser-json.git</developerConnection> - <url>https://github.com/apache/sling-org-apache-sling-contentparser-json.git</url> <tag>HEAD</tag> + <url>https://github.com/apache/sling-org-apache-sling-contentparser-json.git</url> </scm> - <build> - <plugins> - <plugin> - <groupId>biz.aQute.bnd</groupId> - <artifactId>bnd-baseline-maven-plugin</artifactId> - <configuration> - <failOnMissing>false</failOnMissing> - </configuration> - </plugin> - </plugins> - </build> - <dependencies> <dependency> <groupId>org.apache.sling</groupId> @@ -100,4 +86,16 @@ <scope>test</scope> </dependency> </dependencies> + + <build> + <plugins> + <plugin> + <groupId>biz.aQute.bnd</groupId> + <artifactId>bnd-baseline-maven-plugin</artifactId> + <configuration> + <failOnMissing>false</failOnMissing> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/src/main/java/org/apache/sling/contentparser/json/JSONParserFeature.java b/src/main/java/org/apache/sling/contentparser/json/JSONParserFeature.java index 3d2b5f8..1081b8d 100644 --- a/src/main/java/org/apache/sling/contentparser/json/JSONParserFeature.java +++ b/src/main/java/org/apache/sling/contentparser/json/JSONParserFeature.java @@ -1,21 +1,21 @@ -/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.apache.sling.contentparser.json; /** @@ -32,5 +32,4 @@ public enum JSONParserFeature { * Support ticks (') additional to double quotes (") as quoting symbol for JSON names and strings. */ QUOTE_TICK - } diff --git a/src/main/java/org/apache/sling/contentparser/json/JSONParserOptions.java b/src/main/java/org/apache/sling/contentparser/json/JSONParserOptions.java index 3d4ea92..baa6939 100644 --- a/src/main/java/org/apache/sling/contentparser/json/JSONParserOptions.java +++ b/src/main/java/org/apache/sling/contentparser/json/JSONParserOptions.java @@ -1,21 +1,21 @@ -/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.apache.sling.contentparser.json; import java.util.Arrays; diff --git a/src/main/java/org/apache/sling/contentparser/json/internal/JSONContentParser.java b/src/main/java/org/apache/sling/contentparser/json/internal/JSONContentParser.java index 2e12639..6255606 100644 --- a/src/main/java/org/apache/sling/contentparser/json/internal/JSONContentParser.java +++ b/src/main/java/org/apache/sling/contentparser/json/internal/JSONContentParser.java @@ -1,21 +1,21 @@ -/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.apache.sling.contentparser.json.internal; import java.io.IOException; @@ -38,7 +38,6 @@ import jakarta.json.JsonReaderFactory; import jakarta.json.JsonString; import jakarta.json.JsonValue; import jakarta.json.stream.JsonParsingException; - import org.apache.commons.io.IOUtils; import org.apache.sling.contentparser.api.ContentHandler; import org.apache.sling.contentparser.api.ContentParser; @@ -48,11 +47,7 @@ import org.apache.sling.contentparser.json.JSONParserFeature; import org.apache.sling.contentparser.json.JSONParserOptions; import org.osgi.service.component.annotations.Component; -@Component( - property = { - ContentParser.SERVICE_PROPERTY_CONTENT_TYPE + "=json" - } -) +@Component(property = {ContentParser.SERVICE_PROPERTY_CONTENT_TYPE + "=json"}) public class JSONContentParser implements ContentParser { private static final String JOHNZON_SUPPORT_COMMENTS = "org.apache.johnzon.supports-comments"; @@ -83,7 +78,8 @@ public class JSONContentParser implements ContentParser { jsonReaderFactoryConfiguration = Collections.emptyMap(); } final JsonReaderFactory jsonReaderFactory = Json.createReaderFactory(jsonReaderFactoryConfiguration); - JsonObject jsonObject = jsonQuoteTicks ? toJsonObjectWithJsonTicks(jsonReaderFactory, is) : toJsonObject(jsonReaderFactory, is); + JsonObject jsonObject = + jsonQuoteTicks ? toJsonObjectWithJsonTicks(jsonReaderFactory, is) : toJsonObject(jsonReaderFactory, is); parse(handler, jsonObject, parserOptions, "/"); } @@ -95,7 +91,8 @@ public class JSONContentParser implements ContentParser { } } - private JsonObject toJsonObjectWithJsonTicks(JsonReaderFactory jsonReaderFactory, InputStream is) throws IOException { + private JsonObject toJsonObjectWithJsonTicks(JsonReaderFactory jsonReaderFactory, InputStream is) + throws IOException { String jsonString = IOUtils.toString(is, StandardCharsets.UTF_8); // convert ticks to double quotes @@ -108,7 +105,8 @@ public class JSONContentParser implements ContentParser { } } - private void parse(ContentHandler handler, JsonObject object, ParserOptions parserOptions, String path) throws IOException { + private void parse(ContentHandler handler, JsonObject object, ParserOptions parserOptions, String path) + throws IOException { // parse JSON object Map<String, Object> properties = new HashMap<>(); Map<String, JsonObject> children = new LinkedHashMap<>(); @@ -119,8 +117,11 @@ public class JSONContentParser implements ContentParser { try { value = convertValue(parserOptions, entry.getValue()); } catch (IllegalArgumentException ex) { - if (parserOptions.getIgnoreResourceNames().contains(childName) || parserOptions.getIgnorePropertyNames() - .contains(removePrefixFromPropertyName(parserOptions.getRemovePropertyNamePrefixes(), childName))) { + if (parserOptions.getIgnoreResourceNames().contains(childName) + || parserOptions + .getIgnorePropertyNames() + .contains(removePrefixFromPropertyName( + parserOptions.getRemovePropertyNamePrefixes(), childName))) { ignore = true; } else { throw new IOException(ex); @@ -136,7 +137,6 @@ public class JSONContentParser implements ContentParser { childName = childName.substring(prefix.length()); break; } - } ignore = parserOptions.getIgnorePropertyNames().contains(childName); } @@ -210,6 +210,4 @@ public class JSONContentParser implements ContentParser { } return propertyName; } - - } diff --git a/src/main/java/org/apache/sling/contentparser/json/internal/JSONTicksConverter.java b/src/main/java/org/apache/sling/contentparser/json/internal/JSONTicksConverter.java index 83d0c07..77fd694 100644 --- a/src/main/java/org/apache/sling/contentparser/json/internal/JSONTicksConverter.java +++ b/src/main/java/org/apache/sling/contentparser/json/internal/JSONTicksConverter.java @@ -1,21 +1,21 @@ -/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.apache.sling.contentparser.json.internal; /** @@ -30,11 +30,11 @@ package org.apache.sling.contentparser.json.internal; * </ul> */ final class JSONTicksConverter { - + private JSONTicksConverter() { // static methods only } - + static String tickToDoubleQuote(final String input) { final int len = input.length(); final StringBuilder output = new StringBuilder(len); @@ -54,41 +54,34 @@ final class JSONTicksConverter { output.append("\\"); } escaped = false; - } - else { + } else { if (in == '"') { if (quoted) { quoted = false; } else { output.append("\\"); } - } - else if (in == '\'') { + } else if (in == '\'') { if (tickQuoted) { in = '"'; tickQuoted = false; } - } - else if (in == '\\') { + } else if (in == '\\') { escaped = true; } } - } - else { + } else { if (comment) { if (lastChar == '*' && in == '/') { comment = false; } - } - else { + } else { if (lastChar == '/' && in == '*') { comment = true; - } - else if (in == '\'') { + } else if (in == '\'') { in = '"'; tickQuoted = true; - } - else if (in == '"') { + } else if (in == '"') { quoted = true; } } @@ -101,5 +94,4 @@ final class JSONTicksConverter { } return output.toString(); } - } diff --git a/src/main/java/org/apache/sling/contentparser/json/package-info.java b/src/main/java/org/apache/sling/contentparser/json/package-info.java index 3e86af2..e576a8f 100644 --- a/src/main/java/org/apache/sling/contentparser/json/package-info.java +++ b/src/main/java/org/apache/sling/contentparser/json/package-info.java @@ -1,21 +1,21 @@ /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ +~ Licensed to the Apache Software Foundation (ASF) under one +~ or more contributor license agreements. See the NOTICE file +~ distributed with this work for additional information +~ regarding copyright ownership. The ASF licenses this file +~ to you under the Apache License, Version 2.0 (the +~ "License"); you may not use this file except in compliance +~ with the License. You may obtain a copy of the License at +~ +~ http://www.apache.org/licenses/LICENSE-2.0 +~ +~ Unless required by applicable law or agreed to in writing, +~ software distributed under the License is distributed on an +~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +~ KIND, either express or implied. See the License for the +~ specific language governing permissions and limitations +~ under the License. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ @Version("2.0.0") package org.apache.sling.contentparser.json; diff --git a/src/test/java/org/apache/sling/contentparser/json/internal/JSONContentParserTest.java b/src/test/java/org/apache/sling/contentparser/json/internal/JSONContentParserTest.java index 48a5c3e..a09ffb4 100644 --- a/src/test/java/org/apache/sling/contentparser/json/internal/JSONContentParserTest.java +++ b/src/test/java/org/apache/sling/contentparser/json/internal/JSONContentParserTest.java @@ -1,21 +1,21 @@ -/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.apache.sling.contentparser.json.internal; import java.io.File; @@ -72,9 +72,10 @@ public class JSONContentParserTest { assertEquals(new BigDecimal("1.2345"), props.get("decimalProp")); assertEquals(true, props.get("booleanProp")); - assertArrayEquals(new Long[]{1234567890123L, 55L}, (Long[]) props.get("longPropMulti")); - assertArrayEquals(new BigDecimal[]{new BigDecimal("1.2345"), new BigDecimal("1.1")}, (BigDecimal[]) props.get("decimalPropMulti")); - assertArrayEquals(new Boolean[]{true, false}, (Boolean[]) props.get("booleanPropMulti")); + assertArrayEquals(new Long[] {1234567890123L, 55L}, (Long[]) props.get("longPropMulti")); + assertArrayEquals(new BigDecimal[] {new BigDecimal("1.2345"), new BigDecimal("1.1")}, (BigDecimal[]) + props.get("decimalPropMulti")); + assertArrayEquals(new Boolean[] {true, false}, (Boolean[]) props.get("booleanPropMulti")); } @Test @@ -88,7 +89,8 @@ public class JSONContentParserTest { @Test public void testCalendar() throws Exception { - ContentElement content = TestUtils.parse(contentParser, new JSONParserOptions().detectCalendarValues(true), file); + ContentElement content = + TestUtils.parse(contentParser, new JSONParserOptions().detectCalendarValues(true), file); ContentElement child = content.getChild("jcr:content"); assertNotNull("Expected child at jcr:content", child); Map<String, Object> props = child.getProperties(); @@ -109,7 +111,8 @@ public class JSONContentParserTest { @Test public void testIso8601Calendar() throws Exception { - ContentElement content = TestUtils.parse(contentParser, new JSONParserOptions().detectCalendarValues(true), file); + ContentElement content = + TestUtils.parse(contentParser, new JSONParserOptions().detectCalendarValues(true), file); ContentElement child = content.getChild("jcr:content"); assertNotNull("Expected child at jcr:content", child); Map<String, Object> props = child.getProperties(); @@ -154,9 +157,11 @@ public class JSONContentParserTest { public void testIgnoreResourcesProperties() throws Exception { ContentElement content = TestUtils.parse( contentParser, - new JSONParserOptions().ignoreResourceNames(Collections - .unmodifiableSet(new HashSet<>(Arrays.asList("header", "newslist", "security:acl", "security:principals")))) - .ignorePropertyNames(Collections.unmodifiableSet(new HashSet<>(Arrays.asList("jcr:title")))), file); + new JSONParserOptions() + .ignoreResourceNames(Collections.unmodifiableSet(new HashSet<>( + Arrays.asList("header", "newslist", "security:acl", "security:principals")))) + .ignorePropertyNames(Collections.unmodifiableSet(new HashSet<>(Arrays.asList("jcr:title")))), + file); ContentElement child = content.getChild("jcr:content"); assertNotNull("Expected child at jcr:content", child); assertEquals("Sample Homepage", child.getProperties().get("pageTitle")); @@ -189,9 +194,10 @@ public class JSONContentParserTest { @Test public void testGetChildFromJsonWithTicks() throws Exception { File jsonWithTicks = file = new File("src/test/resources/content-test/content-ticks.json"); - ContentElement content = TestUtils - .parse(contentParser, new JSONParserOptions().withFeatures(JSONParserFeature.COMMENTS, JSONParserFeature.QUOTE_TICK), - jsonWithTicks); + ContentElement content = TestUtils.parse( + contentParser, + new JSONParserOptions().withFeatures(JSONParserFeature.COMMENTS, JSONParserFeature.QUOTE_TICK), + jsonWithTicks); assertNull(content.getName()); ContentElement deepChild = content.getChild("jcr:content/par/image/file/jcr:content"); assertNotNull("Expected child at jcr:content/par/image/file/jcr:content", deepChild); @@ -207,13 +213,15 @@ public class JSONContentParserTest { @Test(expected = IOException.class) public void testFailsWithoutCommentsEnabled() throws Exception { - TestUtils.parse(contentParser, new JSONParserOptions().withFeatures(EnumSet.noneOf(JSONParserFeature.class)), file); + TestUtils.parse( + contentParser, new JSONParserOptions().withFeatures(EnumSet.noneOf(JSONParserFeature.class)), file); } @Test(expected = IOException.class) public void testInvalidJsonWithTicks() throws Exception { - TestUtils.parse(contentParser, new JSONParserOptions().withFeatures(EnumSet.noneOf(JSONParserFeature.class)), new File("src/test" + - "/resources/content-test/invalid-ticks.json")); + TestUtils.parse( + contentParser, + new JSONParserOptions().withFeatures(EnumSet.noneOf(JSONParserFeature.class)), + new File("src/test" + "/resources/content-test/invalid-ticks.json")); } - }
