SLING-10750 update to sling-bundle-parent 44
update dependencies to 2018 (same as used in SLING-10045)
update to latest sling-mock
eliminate code warnings
diff --git a/pom.xml b/pom.xml
index 79d0fc7..3aa7dea 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling-bundle-parent</artifactId>
- <version>39</version>
+ <version>44</version>
<relativePath />
</parent>
@@ -38,8 +38,12 @@
<connection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-fsresource.git</connection>
<developerConnection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-fsresource.git</developerConnection>
<url>https://gitbox.apache.org/repos/asf?p=sling-org-apache-sling-fsresource.git</url>
- <tag>HEAD</tag>
- </scm>
+ <tag>HEAD</tag>
+ </scm>
+
+ <properties>
+ <project.build.outputTimestamp>2021-08-24T00:00:00Z</project.build.outputTimestamp>
+ </properties>
<build>
<plugins>
@@ -73,29 +77,29 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.api</artifactId>
- <version>2.11.0</version>
+ <version>2.16.4</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.adapter</artifactId>
- <version>2.0.4</version>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>osgi.core</artifactId>
+ <version>2.1.10</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
- <version>3.3.2</version>
+ <version>3.6</version>
<scope>compile</scope>
</dependency>
<dependency>
@@ -106,8 +110,8 @@
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-json_1.0_spec</artifactId>
- <version>1.0-alpha-1</version>
+ <artifactId>geronimo-json_1.1_spec</artifactId>
+ <version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -119,7 +123,7 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.commons.osgi</artifactId>
- <version>2.2.0</version>
+ <version>2.4.0</version>
<scope>compile</scope>
</dependency>
<dependency>
@@ -131,7 +135,6 @@
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
- <version>16.0.2</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -141,8 +144,15 @@
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
- <artifactId>org.apache.sling.testing.sling-mock</artifactId>
- <version>2.2.6</version>
+ <artifactId>org.apache.sling.testing.sling-mock.junit4</artifactId>
+ <version>3.0.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jackrabbit</groupId>
+ <artifactId>jackrabbit-api</artifactId>
+ <!-- Overwrite old version from org.apache.sling.jcr.contentparser -->
+ <version>2.16.0</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -160,7 +170,7 @@
<dependency>
<groupId>org.apache.johnzon</groupId>
<artifactId>johnzon-core</artifactId>
- <version>1.0.0</version>
+ <version>1.1.1</version>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/src/main/java/org/apache/sling/fsprovider/internal/FileMonitor.java b/src/main/java/org/apache/sling/fsprovider/internal/FileMonitor.java
index 21dccc2..261f34e 100644
--- a/src/main/java/org/apache/sling/fsprovider/internal/FileMonitor.java
+++ b/src/main/java/org/apache/sling/fsprovider/internal/FileMonitor.java
@@ -299,7 +299,7 @@
}
}
private ResourceChange buildContentResourceChange(final ChangeType changeType, final String path) {
- return new ResourceChange(changeType, path, false, null, null, null);
+ return new ResourceChange(changeType, path, false);
}
/**
diff --git a/src/main/java/org/apache/sling/fsprovider/internal/mapper/Escape.java b/src/main/java/org/apache/sling/fsprovider/internal/mapper/Escape.java
index 9b059a3..fd41e9a 100644
--- a/src/main/java/org/apache/sling/fsprovider/internal/mapper/Escape.java
+++ b/src/main/java/org/apache/sling/fsprovider/internal/mapper/Escape.java
@@ -21,10 +21,9 @@
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
import java.util.BitSet;
-import org.apache.commons.lang3.CharEncoding;
-
/**
* Manages deescaping for platform file names to resource names.
*/
@@ -88,7 +87,7 @@
for (int i=0; i<path.length(); i++) {
char c = path.charAt(i);
if (RESERVED_CHARS_SET.get(c)) {
- result.append(URLEncoder.encode(String.valueOf(c), CharEncoding.UTF_8));
+ result.append(URLEncoder.encode(String.valueOf(c), StandardCharsets.UTF_8.name()));
}
else {
result.append(c);
diff --git a/src/main/java/org/apache/sling/fsprovider/internal/mapper/valuemap/ObjectConverter.java b/src/main/java/org/apache/sling/fsprovider/internal/mapper/valuemap/ObjectConverter.java
index da2d86b..9a6fe4a 100644
--- a/src/main/java/org/apache/sling/fsprovider/internal/mapper/valuemap/ObjectConverter.java
+++ b/src/main/java/org/apache/sling/fsprovider/internal/mapper/valuemap/ObjectConverter.java
@@ -42,7 +42,7 @@
* @param type type
* @return the converted object
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({ "unchecked", "null" })
public static <T> T convert(Object obj, Class<T> type) {
if (obj == null) {
return null;
diff --git a/src/main/java/org/apache/sling/fsprovider/internal/mapper/valuemap/ValueMapDecorator.java b/src/main/java/org/apache/sling/fsprovider/internal/mapper/valuemap/ValueMapDecorator.java
index c5fb347..f6808c2 100644
--- a/src/main/java/org/apache/sling/fsprovider/internal/mapper/valuemap/ValueMapDecorator.java
+++ b/src/main/java/org/apache/sling/fsprovider/internal/mapper/valuemap/ValueMapDecorator.java
@@ -48,6 +48,7 @@
/**
* {@inheritDoc}
*/
+ @SuppressWarnings("null")
public <T> T get(@NotNull String name, @NotNull Class<T> type) {
if (base instanceof ValueMap) {
// shortcut if decorated map is ValueMap
@@ -59,8 +60,8 @@
/**
* {@inheritDoc}
*/
- @SuppressWarnings("unchecked")
- public <T> T get(@NotNull String name, T defaultValue) {
+ @SuppressWarnings({ "unchecked", "unused" })
+ public <T> @NotNull T get(@NotNull String name, @NotNull T defaultValue) {
if (base instanceof ValueMap) {
// shortcut if decorated map is ValueMap
return ((ValueMap)base).get(name, defaultValue);
diff --git a/src/test/java/org/apache/sling/fsprovider/internal/FileMonitorTest.java b/src/test/java/org/apache/sling/fsprovider/internal/FileMonitorTest.java
index 89f8837..d7c4e90 100644
--- a/src/test/java/org/apache/sling/fsprovider/internal/FileMonitorTest.java
+++ b/src/test/java/org/apache/sling/fsprovider/internal/FileMonitorTest.java
@@ -35,6 +35,7 @@
import org.apache.sling.testing.mock.sling.junit.SlingContext;
import org.apache.sling.testing.mock.sling.junit.SlingContextBuilder;
import org.apache.sling.testing.mock.sling.junit.SlingContextCallback;
+import org.jetbrains.annotations.NotNull;
import org.junit.Rule;
import org.junit.Test;
@@ -57,7 +58,7 @@
public SlingContext context = new SlingContextBuilder(ResourceResolverType.JCR_MOCK)
.beforeSetUp(new SlingContextCallback() {
@Override
- public void execute(SlingContext context) throws Exception {
+ public void execute(@NotNull SlingContext context) throws Exception {
// copy test content to temp. directory
tempDir.mkdirs();
File sourceDir = new File("src/test/resources/fs-test");
@@ -73,12 +74,13 @@
// register resource change listener
context.registerService(ResourceChangeListener.class, resourceListener,
- ResourceChangeListener.PATHS, new String[] { "/fs-test" });
+ ResourceChangeListener.PATHS, new String[] { "/fs-test" },
+ ResourceChangeListener.CHANGES, new String[] { ChangeType.CHANGED.toString(), ChangeType.ADDED.toString(), ChangeType.REMOVED.toString() });
}
})
.afterTearDown(new SlingContextCallback() {
@Override
- public void execute(SlingContext context) throws Exception {
+ public void execute(@NotNull SlingContext context) throws Exception {
// remove temp directory
tempDir.delete();
}
diff --git a/src/test/java/org/apache/sling/fsprovider/internal/FileVaultContentTest.java b/src/test/java/org/apache/sling/fsprovider/internal/FileVaultContentTest.java
index 2dcd9c1..18edd2d 100644
--- a/src/test/java/org/apache/sling/fsprovider/internal/FileVaultContentTest.java
+++ b/src/test/java/org/apache/sling/fsprovider/internal/FileVaultContentTest.java
@@ -20,11 +20,11 @@
import static org.apache.sling.fsprovider.internal.TestUtils.assertFile;
import static org.apache.sling.fsprovider.internal.TestUtils.assertFolder;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import java.util.HashMap;
diff --git a/src/test/java/org/apache/sling/fsprovider/internal/FileVaultFileMonitorTest.java b/src/test/java/org/apache/sling/fsprovider/internal/FileVaultFileMonitorTest.java
index 763c64a..b143c93 100644
--- a/src/test/java/org/apache/sling/fsprovider/internal/FileVaultFileMonitorTest.java
+++ b/src/test/java/org/apache/sling/fsprovider/internal/FileVaultFileMonitorTest.java
@@ -35,6 +35,7 @@
import org.apache.sling.testing.mock.sling.junit.SlingContext;
import org.apache.sling.testing.mock.sling.junit.SlingContextBuilder;
import org.apache.sling.testing.mock.sling.junit.SlingContextCallback;
+import org.jetbrains.annotations.NotNull;
import org.junit.Rule;
import org.junit.Test;
@@ -57,7 +58,7 @@
public SlingContext context = new SlingContextBuilder(ResourceResolverType.JCR_MOCK)
.beforeSetUp(new SlingContextCallback() {
@Override
- public void execute(SlingContext context) throws Exception {
+ public void execute(@NotNull SlingContext context) throws Exception {
// copy test content to temp. directory
tempDir.mkdirs();
File sourceDir = new File("src/test/resources/vaultfs-test");
@@ -79,12 +80,13 @@
// register resource change listener
context.registerService(ResourceChangeListener.class, resourceListener,
- ResourceChangeListener.PATHS, new String[] { "/content/dam/talk.png", "/content/samples" });
+ ResourceChangeListener.PATHS, new String[] { "/content/dam/talk.png", "/content/samples" },
+ ResourceChangeListener.CHANGES, new String[] { ChangeType.CHANGED.toString(), ChangeType.ADDED.toString(), ChangeType.REMOVED.toString() });
}
})
.afterTearDown(new SlingContextCallback() {
@Override
- public void execute(SlingContext context) throws Exception {
+ public void execute(@NotNull SlingContext context) throws Exception {
// remove temp directory
tempDir.delete();
}
diff --git a/src/test/java/org/apache/sling/fsprovider/internal/FilesFolderTest.java b/src/test/java/org/apache/sling/fsprovider/internal/FilesFolderTest.java
index 18dffdb..17e3a04 100644
--- a/src/test/java/org/apache/sling/fsprovider/internal/FilesFolderTest.java
+++ b/src/test/java/org/apache/sling/fsprovider/internal/FilesFolderTest.java
@@ -20,9 +20,9 @@
import static org.apache.sling.fsprovider.internal.TestUtils.assertFile;
import static org.apache.sling.fsprovider.internal.TestUtils.assertFolder;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThat;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ValueMap;
diff --git a/src/test/java/org/apache/sling/fsprovider/internal/InvalidRootFolderTest.java b/src/test/java/org/apache/sling/fsprovider/internal/InvalidRootFolderTest.java
index 6d080b1..c9bd6c7 100644
--- a/src/test/java/org/apache/sling/fsprovider/internal/InvalidRootFolderTest.java
+++ b/src/test/java/org/apache/sling/fsprovider/internal/InvalidRootFolderTest.java
@@ -29,6 +29,7 @@
import org.apache.sling.testing.mock.sling.junit.SlingContext;
import org.apache.sling.testing.mock.sling.junit.SlingContextBuilder;
import org.apache.sling.testing.mock.sling.junit.SlingContextCallback;
+import org.jetbrains.annotations.NotNull;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -45,7 +46,7 @@
.plugin(new RegisterFsResourcePlugin("provider.file", "target/temp/invalid-folder"))
.afterTearDown(new SlingContextCallback() {
@Override
- public void execute(SlingContext context) throws Exception {
+ public void execute(@NotNull SlingContext context) throws Exception {
File file = new File("target/temp/invalid-folder");
file.delete();
}
diff --git a/src/test/java/org/apache/sling/fsprovider/internal/JcrMixedTest.java b/src/test/java/org/apache/sling/fsprovider/internal/JcrMixedTest.java
index 3c7be0d..6b0ff82 100644
--- a/src/test/java/org/apache/sling/fsprovider/internal/JcrMixedTest.java
+++ b/src/test/java/org/apache/sling/fsprovider/internal/JcrMixedTest.java
@@ -19,8 +19,8 @@
package org.apache.sling.fsprovider.internal;
import static org.apache.sling.fsprovider.internal.TestUtils.assertFile;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.not;
-import static org.junit.Assert.assertThat;
import javax.jcr.Node;
import javax.jcr.RepositoryException;
diff --git a/src/test/java/org/apache/sling/fsprovider/internal/JcrXmlContentTest.java b/src/test/java/org/apache/sling/fsprovider/internal/JcrXmlContentTest.java
index c9f8c66..4c96990 100644
--- a/src/test/java/org/apache/sling/fsprovider/internal/JcrXmlContentTest.java
+++ b/src/test/java/org/apache/sling/fsprovider/internal/JcrXmlContentTest.java
@@ -20,12 +20,12 @@
import static org.apache.sling.fsprovider.internal.TestUtils.assertFile;
import static org.apache.sling.fsprovider.internal.TestUtils.assertFolder;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
import java.util.Collections;
import java.util.List;
diff --git a/src/test/java/org/apache/sling/fsprovider/internal/JsonContentTest.java b/src/test/java/org/apache/sling/fsprovider/internal/JsonContentTest.java
index 84226e3..b5b38c3 100644
--- a/src/test/java/org/apache/sling/fsprovider/internal/JsonContentTest.java
+++ b/src/test/java/org/apache/sling/fsprovider/internal/JsonContentTest.java
@@ -20,12 +20,12 @@
import static org.apache.sling.fsprovider.internal.TestUtils.assertFile;
import static org.apache.sling.fsprovider.internal.TestUtils.assertFolder;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import java.io.InputStream;
diff --git a/src/test/java/org/apache/sling/fsprovider/internal/TestUtils.java b/src/test/java/org/apache/sling/fsprovider/internal/TestUtils.java
index 1211b70..b3acb49 100644
--- a/src/test/java/org/apache/sling/fsprovider/internal/TestUtils.java
+++ b/src/test/java/org/apache/sling/fsprovider/internal/TestUtils.java
@@ -18,23 +18,23 @@
*/
package org.apache.sling.fsprovider.internal;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.CharEncoding;
import org.apache.commons.lang3.StringUtils;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.observation.ResourceChange;
@@ -92,7 +92,7 @@
if (content != null) {
try {
try (InputStream is = file.adaptTo(InputStream.class)) {
- String data = IOUtils.toString(is, CharEncoding.UTF_8);
+ String data = IOUtils.toString(is, StandardCharsets.UTF_8);
assertEquals(content, data);
}
}
diff --git a/src/test/java/org/apache/sling/fsprovider/internal/mapper/valuemap/Convert.java b/src/test/java/org/apache/sling/fsprovider/internal/mapper/valuemap/Convert.java
index adf49c1..ef48c38 100644
--- a/src/test/java/org/apache/sling/fsprovider/internal/mapper/valuemap/Convert.java
+++ b/src/test/java/org/apache/sling/fsprovider/internal/mapper/valuemap/Convert.java
@@ -31,6 +31,7 @@
/**
* This is copied from org.apache.sling.api.wrappers.impl.Convert
*/
+@SuppressWarnings("null")
final class Convert {
private Convert() {