You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ss...@apache.org on 2024/04/09 08:48:17 UTC
(sling-org-apache-sling-contentparser-api) 02/04: SLING-12281 apply spotless code formatting
This is an automated email from the ASF dual-hosted git repository.
sseifert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-contentparser-api.git
commit fd85e6c2f2d830139ae38b93f238c5dad185e2b0
Author: Stefan Seifert <st...@users.noreply.github.com>
AuthorDate: Tue Apr 9 10:11:20 2024 +0200
SLING-12281 apply spotless code formatting
---
pom.xml | 32 ++++++------
.../sling/contentparser/api/ContentHandler.java | 37 +++++++-------
.../sling/contentparser/api/ContentParser.java | 38 +++++++--------
.../sling/contentparser/api/ParserHelper.java | 43 ++++++++--------
.../sling/contentparser/api/ParserOptions.java | 57 +++++++++-------------
.../sling/contentparser/api/package-info.java | 34 ++++++-------
.../sling/contentparser/api/ParserHelperTest.java | 51 ++++++++++---------
7 files changed, 138 insertions(+), 154 deletions(-)
diff --git a/pom.xml b/pom.xml
index b822e3d..90f4963 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.0.1-SNAPSHOT</version>
<name>Apache Sling Content Parser API</name>
- <description>
- API for parsing Apache Sling Resource trees stored in files (e.g. JSON, FileVault XML, etc.)
- </description>
+ <description>API for parsing Apache Sling Resource trees stored in files (e.g. JSON, FileVault XML, etc.)</description>
<scm>
<connection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-contentparser-api.git</connection>
<developerConnection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-contentparser-api.git</developerConnection>
- <url>https://github.com/apache/sling-org-apache-sling-contentparser-api.git</url>
<tag>HEAD</tag>
+ <url>https://github.com/apache/sling-org-apache-sling-contentparser-api.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.osgi</groupId>
@@ -65,4 +51,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/api/ContentHandler.java b/src/main/java/org/apache/sling/contentparser/api/ContentHandler.java
index 34103d1..12113f1 100644
--- a/src/main/java/org/apache/sling/contentparser/api/ContentHandler.java
+++ b/src/main/java/org/apache/sling/contentparser/api/ContentHandler.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.api;
import java.util.Map;
@@ -37,5 +37,4 @@ public interface ContentHandler {
* @param properties the resource's properties
*/
void resource(String path, Map<String, Object> properties);
-
}
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 28df2c7..2528662 100644
--- a/src/main/java/org/apache/sling/contentparser/api/ContentParser.java
+++ b/src/main/java/org/apache/sling/contentparser/api/ContentParser.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.api;
import java.io.IOException;
@@ -31,7 +31,6 @@ import org.osgi.annotation.versioning.ProviderType;
@ProviderType
public interface ContentParser {
-
/**
* OSGi service registration property indicating the content type this {@code ContentParser} supports. The simplest way to retrieve a
* {@code ContentParser} for a certain content type is to apply a filter on the service reference:
@@ -60,5 +59,4 @@ public interface ContentParser {
* @throws IOException when an I/O or parsing error occurs
*/
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 b0a64d7..bb2a6ee 100644
--- a/src/main/java/org/apache/sling/contentparser/api/ParserHelper.java
+++ b/src/main/java/org/apache/sling/contentparser/api/ParserHelper.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.api;
import java.lang.reflect.Array;
@@ -37,10 +37,10 @@ public final class ParserHelper {
private static final String ECMA_DATE_FORMAT = "EEE MMM dd yyyy HH:mm:ss 'GMT'Z";
private static final String ISO_8601_MILLISECONDS_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSVV";
private static final Locale DATE_FORMAT_LOCALE = Locale.US;
- private static final DateTimeFormatter ECMA_DATE_FORMATTER = DateTimeFormatter.ofPattern(ECMA_DATE_FORMAT, DATE_FORMAT_LOCALE);
+ private static final DateTimeFormatter ECMA_DATE_FORMATTER =
+ DateTimeFormatter.ofPattern(ECMA_DATE_FORMAT, DATE_FORMAT_LOCALE);
private static final DateTimeFormatter ISO_8601_MILLISECONDS_DATE_FORMATTER =
- DateTimeFormatter.ofPattern(ISO_8601_MILLISECONDS_DATE_FORMAT,
- DATE_FORMAT_LOCALE);
+ DateTimeFormatter.ofPattern(ISO_8601_MILLISECONDS_DATE_FORMAT, DATE_FORMAT_LOCALE);
// static methods only
private ParserHelper() {}
@@ -106,5 +106,4 @@ public final class ParserHelper {
calendar.setTimeZone(TimeZone.getTimeZone(zonedDateTime.getOffset()));
return calendar;
}
-
}
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 3bdcb12..7c27fa9 100644
--- a/src/main/java/org/apache/sling/contentparser/api/ParserOptions.java
+++ b/src/main/java/org/apache/sling/contentparser/api/ParserOptions.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.api;
import java.util.Arrays;
@@ -40,24 +40,14 @@ public class ParserOptions {
/**
* Default list of prefixes to remove from property names.
*/
- public static final Set<String> DEFAULT_REMOVE_PROPERTY_NAME_PREFIXES
- = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
- "jcr:reference:",
- "jcr:path:",
- "jcr:name:",
- "jcr:uri:"
- )));
+ public static final Set<String> DEFAULT_REMOVE_PROPERTY_NAME_PREFIXES = Collections.unmodifiableSet(
+ new HashSet<>(Arrays.asList("jcr:reference:", "jcr:path:", "jcr:name:", "jcr:uri:")));
/**
* Default list of resource names that should be ignored.
*/
- public static final Set<String> DEFAULT_IGNORE_RESOURCE_NAMES
- = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
- "security:acl",
- "security:principals"
- )));
-
-
+ public static final Set<String> DEFAULT_IGNORE_RESOURCE_NAMES =
+ Collections.unmodifiableSet(new HashSet<>(Arrays.asList("security:acl", "security:principals")));
private String defaultPrimaryType = DEFAULT_PRIMARY_TYPE;
private boolean detectCalendarValues;
@@ -142,7 +132,4 @@ public class ParserOptions {
public Set<String> getRemovePropertyNamePrefixes() {
return removePropertyNamePrefixes;
}
-
-
-
}
diff --git a/src/main/java/org/apache/sling/contentparser/api/package-info.java b/src/main/java/org/apache/sling/contentparser/api/package-info.java
index 9368f3a..aa1794f 100644
--- a/src/main/java/org/apache/sling/contentparser/api/package-info.java
+++ b/src/main/java/org/apache/sling/contentparser/api/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.api;
diff --git a/src/test/java/org/apache/sling/contentparser/api/ParserHelperTest.java b/src/test/java/org/apache/sling/contentparser/api/ParserHelperTest.java
index f79f7e3..716b91a 100644
--- a/src/test/java/org/apache/sling/contentparser/api/ParserHelperTest.java
+++ b/src/test/java/org/apache/sling/contentparser/api/ParserHelperTest.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.api;
import java.util.Calendar;
@@ -36,9 +36,9 @@ public class ParserHelperTest {
@Test
public void parseDate() {
Map<String, int[]> formats = new HashMap<>();
- formats.put("Sun Oct 31 2010 21:48:04 GMT+0100", new int[]{31, 10, 2010, 21, 48, 4, 0, 1});
+ formats.put("Sun Oct 31 2010 21:48:04 GMT+0100", new int[] {31, 10, 2010, 21, 48, 4, 0, 1});
formats.put("Sun Oct 31 2010 21:48", null);
- formats.put("2014-09-19T21:20:26.812+02:00", new int[]{19, 9, 2014, 21, 20, 26, 812, 2});
+ formats.put("2014-09-19T21:20:26.812+02:00", new int[] {19, 9, 2014, 21, 20, 26, 812, 2});
formats.put("2014-09-19T21:20:26.812", null);
for (Map.Entry<String, int[]> entry : formats.entrySet()) {
int[] dateAsInts = entry.getValue();
@@ -55,14 +55,13 @@ public class ParserHelperTest {
assertEquals(dateAsInts[5], calendar.get(Calendar.SECOND));
assertEquals(dateAsInts[6], calendar.get(Calendar.MILLISECOND));
assertEquals(dateAsInts[7], calendar.getTimeZone().getRawOffset() / 3600 / 1000);
-
}
}
}
@Test
public void convertSingleTypeArray() {
- Object[] empty = new Object[]{};
+ Object[] empty = new Object[] {};
assertEquals(empty, ParserHelper.convertSingleTypeArray(empty));
Object[] nullValues = new Object[] {"string", null};
@@ -72,7 +71,9 @@ public class ParserHelperTest {
} catch (IllegalArgumentException e) {
nullValuesException = e;
}
- assertNotNull("Expected a IllegalArgumentException when the Object array contains multiple types.", nullValuesException);
+ assertNotNull(
+ "Expected a IllegalArgumentException when the Object array contains multiple types.",
+ nullValuesException);
Object[] maps = new Object[] {Collections.emptyMap()};
IllegalArgumentException mapsException = null;
@@ -90,7 +91,9 @@ public class ParserHelperTest {
} catch (IllegalArgumentException e) {
differentTypesException = e;
}
- assertNotNull("Expected a IllegalArgumentException when the Object array contains multiple types.", differentTypesException);
+ assertNotNull(
+ "Expected a IllegalArgumentException when the Object array contains multiple types.",
+ differentTypesException);
Object[] values = new Object[] {1, 2, 3, 4, 5};
Object result = ParserHelper.convertSingleTypeArray(values);