This is an automated email from the ASF dual-hosted git repository.
ctubbsii pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo-classloaders.git
The following commit(s) were added to refs/heads/main by this push:
new 730771a Update POM and improve QA (#32)
730771a is described below
commit 730771aa8f385024fa861888a68d4e2d6b0924ab
Author: Christopher Tubbs <[email protected]>
AuthorDate: Thu Nov 20 14:36:03 2025 -0500
Update POM and improve QA (#32)
* Update and apply modernizer, spotbugs, and checkstyle fixes, including
removing unnecessary spotbugs warning suppressions
* Reorganize POM to ensure QA tools are running, and mirror the Accumulo
POM, so they can be more easily compared side-by-side
* Update formatter to match main Accumulo project
* Update GitHub Actions
* Also add release flag to the test jar compilation
* Remove stale links to GitHub docs (they can be searched easily without
the link)
---
.github/workflows/maven-on-demand.yaml | 24 +-
.github/workflows/maven.yaml | 19 +-
modules/example-iterators-a/pom.xml | 3 -
.../classloader/vfs/examples/ExampleIterator.java | 5 +-
modules/example-iterators-b/pom.xml | 3 -
.../classloader/vfs/examples/ExampleIterator.java | 5 +-
modules/vfs-class-loader/pom.xml | 4 -
.../classloader/vfs/AccumuloVFSClassLoader.java | 28 +-
.../classloader/vfs/UniqueFileReplicator.java | 9 +-
.../accumulo/classloader/vfs/VFSManager.java | 13 +-
.../ReloadingVFSContextClassLoaderFactory.java | 60 ++-
.../accumulo/classloader/vfs/AccumuloDFSBase.java | 14 +-
.../vfs/AccumuloVFSClassLoaderTest.java | 12 +-
.../classloader/vfs/ClassPathPrinterTest.java | 5 +-
.../ReloadingVFSContextClassLoaderFactoryTest.java | 53 ++-
.../src/test/shell/makeHelloWorldJars.sh | 4 +-
.../src/test/shell/makeTestJars.sh | 2 +-
pom.xml | 495 ++++++++++++---------
src/build/eclipse-codestyle.xml | 9 +-
19 files changed, 428 insertions(+), 339 deletions(-)
diff --git a/.github/workflows/maven-on-demand.yaml
b/.github/workflows/maven-on-demand.yaml
index 05342d0..5bdd47c 100644
--- a/.github/workflows/maven-on-demand.yaml
+++ b/.github/workflows/maven-on-demand.yaml
@@ -7,7 +7,7 @@
# "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
+# https://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
@@ -18,38 +18,36 @@
#
# This workflow will build a Java project with Maven
-# For more information see:
https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Manual Build
on:
workflow_dispatch:
+ # these inputs break down the Maven command-line, somewhat arbitrarily, so
+ # the UI when starting a run is easier to use
inputs:
goals:
description: Maven goals
required: true
default: verify
+
+permissions:
+ contents: read
+
jobs:
mvn:
name: mvn (triggered by ${{ github.event.sender.login }})
- timeout-minutes: 360
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- - name: Set up JDK 11
+ - name: Set up JDK 17
uses: actions/setup-java@v4
with:
- distribution: adopt
+ distribution: temurin
java-version: 17
- - name: Cache local maven repository
- uses: actions/cache@v4
- with:
- path: |
- ~/.m2/repository/
- !~/.m2/repository/org/apache/accumulo
- key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
- restore-keys: ${{ runner.os }}-m2
+ cache: 'maven'
- name: Build with Maven
+ timeout-minutes: 345
run: mvn -B -V -e -ntp "-Dstyle.color=always" ${{
github.event.inputs.goals }}
env:
MAVEN_OPTS: -Djansi.force=true
diff --git a/.github/workflows/maven.yaml b/.github/workflows/maven.yaml
index ea63ff9..099e04f 100644
--- a/.github/workflows/maven.yaml
+++ b/.github/workflows/maven.yaml
@@ -7,7 +7,7 @@
# "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
+# https://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
@@ -18,7 +18,6 @@
#
# This workflow will build a Java project with Maven
-# For more information see:
https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: QA
@@ -28,25 +27,21 @@ on:
pull_request:
branches: [ '*' ]
+permissions:
+ contents: read
+
jobs:
mvn:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- - name: Set up JDK 11
+ - name: Set up JDK 17
uses: actions/setup-java@v4
with:
- distribution: adopt
+ distribution: temurin
java-version: 17
- - name: Cache local maven repository
- uses: actions/cache@v4
- with:
- path: |
- ~/.m2/repository/
- !~/.m2/repository/org/apache/accumulo
- key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
- restore-keys: ${{ runner.os }}-m2
+ cache: 'maven'
- name: Build with Maven (verify javadoc:jar)
run: mvn -B -V -e -ntp "-Dstyle.color=always" verify javadoc:jar
-DskipFormat -DverifyFormat
env:
diff --git a/modules/example-iterators-a/pom.xml
b/modules/example-iterators-a/pom.xml
index 4109efd..aa2a192 100644
--- a/modules/example-iterators-a/pom.xml
+++ b/modules/example-iterators-a/pom.xml
@@ -28,9 +28,6 @@
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>example-iterators-a</artifactId>
- <properties>
-
<eclipseFormatterStyle>../../src/build/eclipse-codestyle.xml</eclipseFormatterStyle>
- </properties>
<dependencies>
<dependency>
<!-- provided by accumulo -->
diff --git
a/modules/example-iterators-a/src/main/java/org/apache/accumulo/classloader/vfs/examples/ExampleIterator.java
b/modules/example-iterators-a/src/main/java/org/apache/accumulo/classloader/vfs/examples/ExampleIterator.java
index 57fb936..f630aea 100644
---
a/modules/example-iterators-a/src/main/java/org/apache/accumulo/classloader/vfs/examples/ExampleIterator.java
+++
b/modules/example-iterators-a/src/main/java/org/apache/accumulo/classloader/vfs/examples/ExampleIterator.java
@@ -18,8 +18,9 @@
*/
package org.apache.accumulo.classloader.vfs.examples;
+import static java.nio.charset.StandardCharsets.UTF_8;
+
import java.io.IOException;
-import java.nio.charset.StandardCharsets;
import java.util.Collection;
import java.util.Map;
@@ -46,7 +47,7 @@ public class ExampleIterator implements
SortedKeyValueIterator<Key,Value> {
}
public Value getTopValue() {
- return new Value("foo".getBytes(StandardCharsets.UTF_8));
+ return new Value("foo".getBytes(UTF_8));
}
public boolean hasTop() {
diff --git a/modules/example-iterators-b/pom.xml
b/modules/example-iterators-b/pom.xml
index 2581992..c923949 100644
--- a/modules/example-iterators-b/pom.xml
+++ b/modules/example-iterators-b/pom.xml
@@ -28,9 +28,6 @@
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>example-iterators-b</artifactId>
- <properties>
-
<eclipseFormatterStyle>../../src/build/eclipse-codestyle.xml</eclipseFormatterStyle>
- </properties>
<dependencies>
<dependency>
<!-- provided by accumulo -->
diff --git
a/modules/example-iterators-b/src/main/java/org/apache/accumulo/classloader/vfs/examples/ExampleIterator.java
b/modules/example-iterators-b/src/main/java/org/apache/accumulo/classloader/vfs/examples/ExampleIterator.java
index 4dd4f26..868bd89 100644
---
a/modules/example-iterators-b/src/main/java/org/apache/accumulo/classloader/vfs/examples/ExampleIterator.java
+++
b/modules/example-iterators-b/src/main/java/org/apache/accumulo/classloader/vfs/examples/ExampleIterator.java
@@ -18,8 +18,9 @@
*/
package org.apache.accumulo.classloader.vfs.examples;
+import static java.nio.charset.StandardCharsets.UTF_8;
+
import java.io.IOException;
-import java.nio.charset.StandardCharsets;
import java.util.Collection;
import java.util.Map;
@@ -46,7 +47,7 @@ public class ExampleIterator implements
SortedKeyValueIterator<Key,Value> {
}
public Value getTopValue() {
- return new Value("bar".getBytes(StandardCharsets.UTF_8));
+ return new Value("bar".getBytes(UTF_8));
}
public boolean hasTop() {
diff --git a/modules/vfs-class-loader/pom.xml b/modules/vfs-class-loader/pom.xml
index 59c5bb7..b827e4d 100644
--- a/modules/vfs-class-loader/pom.xml
+++ b/modules/vfs-class-loader/pom.xml
@@ -29,10 +29,6 @@
</parent>
<artifactId>vfs-reloading-classloader</artifactId>
<name>classloader-extras-vfs-reloading</name>
- <properties>
-
<eclipseFormatterStyle>../../src/build/eclipse-codestyle.xml</eclipseFormatterStyle>
-
<maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile>
- </properties>
<dependencies>
<dependency>
<!-- needed for build checks, but not for runtime -->
diff --git
a/modules/vfs-class-loader/src/main/java/org/apache/accumulo/classloader/vfs/AccumuloVFSClassLoader.java
b/modules/vfs-class-loader/src/main/java/org/apache/accumulo/classloader/vfs/AccumuloVFSClassLoader.java
index 12a6907..db87100 100644
---
a/modules/vfs-class-loader/src/main/java/org/apache/accumulo/classloader/vfs/AccumuloVFSClassLoader.java
+++
b/modules/vfs-class-loader/src/main/java/org/apache/accumulo/classloader/vfs/AccumuloVFSClassLoader.java
@@ -89,11 +89,11 @@ public class AccumuloVFSClassLoader extends ClassLoader
implements Closeable, Fi
// the name node for info too frequently.
private static final long DEFAULT_TIMEOUT = TimeUnit.MINUTES.toMillis(5);
- private static boolean DEBUG = false;
+ private static volatile boolean DEBUG = false;
private static String CLASSPATH = null;
private static Boolean POST_DELEGATION = null;
private static Long MONITOR_INTERVAL = null;
- private static boolean VM_INITIALIZED = false;
+ private static volatile boolean VM_INITIALIZED = false;
private volatile long maxWaitInterval = 60000;
private volatile long maxRetries = -1;
@@ -118,8 +118,9 @@ public class AccumuloVFSClassLoader extends ClassLoader
implements Closeable, Fi
}
private static void printDebug(String msg) {
- if (!DEBUG)
+ if (!DEBUG) {
return;
+ }
System.out.println(
String.format("DEBUG: %d AccumuloVFSClassLoader: %s",
System.currentTimeMillis(), msg));
}
@@ -732,25 +733,32 @@ public class AccumuloVFSClassLoader extends ClassLoader
implements Closeable, Fi
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
AccumuloVFSClassLoader other = (AccumuloVFSClassLoader) obj;
if (name == null) {
- if (other.name != null)
+ if (other.name != null) {
return false;
- } else if (!name.equals(other.name))
+ }
+ } else if (!name.equals(other.name)) {
return false;
+ }
var parent = getParent();
var otherParent = other.getParent();
if (parent == null) {
- if (otherParent != null)
+ if (otherParent != null) {
return false;
- } else if (!parent.getName().equals(otherParent.getName()))
+ }
+ } else if (!parent.getName().equals(otherParent.getName())) {
return false;
+ }
return true;
}
diff --git
a/modules/vfs-class-loader/src/main/java/org/apache/accumulo/classloader/vfs/UniqueFileReplicator.java
b/modules/vfs-class-loader/src/main/java/org/apache/accumulo/classloader/vfs/UniqueFileReplicator.java
index a2cde12..0c78926 100644
---
a/modules/vfs-class-loader/src/main/java/org/apache/accumulo/classloader/vfs/UniqueFileReplicator.java
+++
b/modules/vfs-class-loader/src/main/java/org/apache/accumulo/classloader/vfs/UniqueFileReplicator.java
@@ -46,8 +46,9 @@ public class UniqueFileReplicator implements VfsComponent,
FileReplicator {
public UniqueFileReplicator(File tempDir) {
this.tempDir = tempDir;
- if (!tempDir.exists() && !tempDir.mkdirs())
+ if (!tempDir.exists() && !tempDir.mkdirs()) {
System.out.println("Unexpected error creating directory: " +
tempDir.getAbsolutePath());
+ }
}
@SuppressFBWarnings(value = "PATH_TRAVERSAL_IN",
@@ -98,16 +99,18 @@ public class UniqueFileReplicator implements VfsComponent,
FileReplicator {
public void close() {
synchronized (tmpFiles) {
for (File tmpFile : tmpFiles) {
- if (!tmpFile.delete())
+ if (!tmpFile.delete()) {
System.out.println("File does not exist: " +
tmpFile.getAbsolutePath());
+ }
}
}
if (tempDir.exists()) {
String[] list = tempDir.list();
int numChildren = list == null ? 0 : list.length;
- if (numChildren == 0 && !tempDir.delete())
+ if (numChildren == 0 && !tempDir.delete()) {
System.out.println("Cannot delete empty directory: " +
tempDir.getAbsolutePath());
+ }
}
}
}
diff --git
a/modules/vfs-class-loader/src/main/java/org/apache/accumulo/classloader/vfs/VFSManager.java
b/modules/vfs-class-loader/src/main/java/org/apache/accumulo/classloader/vfs/VFSManager.java
index fde94c8..e7c00e3 100644
---
a/modules/vfs-class-loader/src/main/java/org/apache/accumulo/classloader/vfs/VFSManager.java
+++
b/modules/vfs-class-loader/src/main/java/org/apache/accumulo/classloader/vfs/VFSManager.java
@@ -21,6 +21,7 @@ package org.apache.accumulo.classloader.vfs;
import java.io.File;
import java.io.IOException;
import java.lang.management.ManagementFactory;
+import java.nio.file.Path;
import java.util.ArrayList;
import org.apache.commons.io.FileUtils;
@@ -35,8 +36,6 @@ import
org.apache.commons.vfs2.impl.FileContentInfoFilenameFactory;
import org.apache.commons.vfs2.provider.FileReplicator;
import org.apache.commons.vfs2.provider.hdfs.HdfsFileProvider;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
public class VFSManager {
public static class AccumuloVFSManagerShutdownThread implements Runnable {
@@ -64,8 +63,9 @@ public class VFSManager {
}
private static void printDebug(String msg) {
- if (!DEBUG)
+ if (!DEBUG) {
return;
+ }
System.out.println(String.format("DEBUG: %d VFSManager: %s",
System.currentTimeMillis(), msg));
}
@@ -193,13 +193,12 @@ public class VFSManager {
return VFS;
}
- @SuppressFBWarnings(value = "PATH_TRAVERSAL_IN",
- justification = "tmpdir is controlled by admin, not unchecked user
input")
private static File computeTopCacheDir() {
String cacheDirPath = AccumuloVFSClassLoader.getVFSCacheDir();
String procName = ManagementFactory.getRuntimeMXBean().getName();
- return new File(cacheDirPath,
- "accumulo-vfs-manager-cache-" + procName + "-" +
System.getProperty("user.name", "nouser"));
+ return Path.of(cacheDirPath,
+ "accumulo-vfs-manager-cache-" + procName + "-" +
System.getProperty("user.name", "nouser"))
+ .toFile();
}
private static void close() {
diff --git
a/modules/vfs-class-loader/src/main/java/org/apache/accumulo/classloader/vfs/context/ReloadingVFSContextClassLoaderFactory.java
b/modules/vfs-class-loader/src/main/java/org/apache/accumulo/classloader/vfs/context/ReloadingVFSContextClassLoaderFactory.java
index 2266d4e..645aca7 100644
---
a/modules/vfs-class-loader/src/main/java/org/apache/accumulo/classloader/vfs/context/ReloadingVFSContextClassLoaderFactory.java
+++
b/modules/vfs-class-loader/src/main/java/org/apache/accumulo/classloader/vfs/context/ReloadingVFSContextClassLoaderFactory.java
@@ -23,6 +23,7 @@ import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.Files;
+import java.nio.file.Path;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -101,18 +102,23 @@ public class ReloadingVFSContextClassLoaderFactory
implements ContextClassLoader
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
Contexts other = (Contexts) obj;
if (contexts == null) {
- if (other.contexts != null)
+ if (other.contexts != null) {
return false;
- } else if (!contexts.equals(other.contexts))
+ }
+ } else if (!contexts.equals(other.contexts)) {
return false;
+ }
return true;
}
}
@@ -154,23 +160,30 @@ public class ReloadingVFSContextClassLoaderFactory
implements ContextClassLoader
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
Context other = (Context) obj;
if (config == null) {
- if (other.config != null)
+ if (other.config != null) {
return false;
- } else if (!config.equals(other.config))
+ }
+ } else if (!config.equals(other.config)) {
return false;
+ }
if (name == null) {
- if (other.name != null)
+ if (other.name != null) {
return false;
- } else if (!name.equals(other.name))
+ }
+ } else if (!name.equals(other.name)) {
return false;
+ }
return true;
}
}
@@ -223,22 +236,29 @@ public class ReloadingVFSContextClassLoaderFactory
implements ContextClassLoader
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
ContextConfig other = (ContextConfig) obj;
if (classPath == null) {
- if (other.classPath != null)
+ if (other.classPath != null) {
return false;
- } else if (!classPath.equals(other.classPath))
+ }
+ } else if (!classPath.equals(other.classPath)) {
return false;
- if (monitorIntervalMs != other.monitorIntervalMs)
+ }
+ if (monitorIntervalMs != other.monitorIntervalMs) {
return false;
- if (postDelegate != other.postDelegate)
+ }
+ if (postDelegate != other.postDelegate) {
return false;
+ }
return true;
}
}
@@ -272,7 +292,7 @@ public class ReloadingVFSContextClassLoaderFactory
implements ContextClassLoader
}
// Properties
String conf = getConfigFileLocation();
- File f = new File(new URI(conf));
+ File f = Path.of(new URI(conf)).toFile();
if (!f.canRead()) {
throw new RuntimeException("Unable to read configuration file: " + conf);
}
diff --git
a/modules/vfs-class-loader/src/test/java/org/apache/accumulo/classloader/vfs/AccumuloDFSBase.java
b/modules/vfs-class-loader/src/test/java/org/apache/accumulo/classloader/vfs/AccumuloDFSBase.java
index f82a521..39e67b5 100644
---
a/modules/vfs-class-loader/src/test/java/org/apache/accumulo/classloader/vfs/AccumuloDFSBase.java
+++
b/modules/vfs-class-loader/src/test/java/org/apache/accumulo/classloader/vfs/AccumuloDFSBase.java
@@ -18,12 +18,13 @@
*/
package org.apache.accumulo.classloader.vfs;
+import static java.nio.charset.StandardCharsets.UTF_8;
+
import java.io.BufferedReader;
-import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URI;
-import java.nio.charset.StandardCharsets;
+import java.nio.file.Path;
import org.apache.commons.vfs2.CacheStrategy;
import org.apache.commons.vfs2.FileSystemException;
@@ -38,9 +39,6 @@ import org.apache.hadoop.hdfs.MiniDFSCluster;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
-@SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "paths not
set by user input")
public class AccumuloDFSBase {
private static Configuration conf = null;
@@ -61,7 +59,7 @@ public class AccumuloDFSBase {
try {
Process p = Runtime.getRuntime().exec("/bin/sh -c umask");
try (BufferedReader bri =
- new BufferedReader(new InputStreamReader(p.getInputStream(),
StandardCharsets.UTF_8))) {
+ new BufferedReader(new InputStreamReader(p.getInputStream(),
UTF_8))) {
String line = bri.readLine();
p.waitFor();
@@ -142,8 +140,8 @@ public class AccumuloDFSBase {
vfs.addMimeTypeMap("application/java-archive", "jar");
vfs.setFileContentInfoFactory(new FileContentInfoFilenameFactory());
vfs.setFilesCache(new SoftRefFilesCache());
- vfs.setReplicator(new DefaultFileReplicator(new
File(System.getProperty("java.io.tmpdir"),
- "accumulo-vfs-cache-" + System.getProperty("user.name", "nouser"))));
+ vfs.setReplicator(new
DefaultFileReplicator(Path.of(System.getProperty("java.io.tmpdir"),
+ "accumulo-vfs-cache-" + System.getProperty("user.name",
"nouser")).toFile()));
vfs.setCacheStrategy(CacheStrategy.ON_RESOLVE);
vfs.init();
} catch (FileSystemException e) {
diff --git
a/modules/vfs-class-loader/src/test/java/org/apache/accumulo/classloader/vfs/AccumuloVFSClassLoaderTest.java
b/modules/vfs-class-loader/src/test/java/org/apache/accumulo/classloader/vfs/AccumuloVFSClassLoaderTest.java
index 5d16b96..1c857bf 100644
---
a/modules/vfs-class-loader/src/test/java/org/apache/accumulo/classloader/vfs/AccumuloVFSClassLoaderTest.java
+++
b/modules/vfs-class-loader/src/test/java/org/apache/accumulo/classloader/vfs/AccumuloVFSClassLoaderTest.java
@@ -18,12 +18,12 @@
*/
package org.apache.accumulo.classloader.vfs;
+import static java.util.Objects.requireNonNull;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import java.io.File;
-import java.util.Objects;
+import java.nio.file.Files;
-import org.apache.commons.io.FileUtils;
import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.FileSystemException;
import org.junit.jupiter.api.BeforeEach;
@@ -32,7 +32,6 @@ import org.junit.jupiter.api.io.TempDir;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-@SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "paths not
set by user input")
public class AccumuloVFSClassLoaderTest {
@TempDir
@@ -40,14 +39,17 @@ public class AccumuloVFSClassLoaderTest {
String folderPath;
@BeforeEach
+ @SuppressFBWarnings(value = "URLCONNECTION_SSRF_FD",
+ justification = "paths not set by user input")
public void setup() throws Exception {
System.setProperty(AccumuloVFSClassLoader.VFS_CLASSPATH_MONITOR_INTERVAL,
"1");
VFSManager.initialize();
folderPath = tempDir.toURI() + ".*";
-
FileUtils.copyURLToFile(Objects.requireNonNull(this.getClass().getResource("/HelloWorld.jar")),
- new File(tempDir, "HelloWorld.jar"));
+ try (var in =
requireNonNull(this.getClass().getResource("/HelloWorld.jar")).openStream()) {
+ Files.copy(in, tempDir.toPath().resolve("HelloWorld.jar"));
+ }
}
FileObject[] createFileSystems(FileObject[] fos) throws FileSystemException {
diff --git
a/modules/vfs-class-loader/src/test/java/org/apache/accumulo/classloader/vfs/ClassPathPrinterTest.java
b/modules/vfs-class-loader/src/test/java/org/apache/accumulo/classloader/vfs/ClassPathPrinterTest.java
index 02f33dc..6577b04 100644
---
a/modules/vfs-class-loader/src/test/java/org/apache/accumulo/classloader/vfs/ClassPathPrinterTest.java
+++
b/modules/vfs-class-loader/src/test/java/org/apache/accumulo/classloader/vfs/ClassPathPrinterTest.java
@@ -27,9 +27,6 @@ import java.net.MalformedURLException;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
-@SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "paths not
set by user input")
public class ClassPathPrinterTest {
@TempDir
@@ -49,7 +46,7 @@ public class ClassPathPrinterTest {
@Test
public void testPrintClassPath() throws Exception {
- File conf = new File(tempDir, "accumulo.properties");
+ File conf = tempDir.toPath().resolve("accumulo.properties").toFile();
assertTrue(conf.isFile() || conf.createNewFile());
VFSManager.initialize();
diff --git
a/modules/vfs-class-loader/src/test/java/org/apache/accumulo/classloader/vfs/context/ReloadingVFSContextClassLoaderFactoryTest.java
b/modules/vfs-class-loader/src/test/java/org/apache/accumulo/classloader/vfs/context/ReloadingVFSContextClassLoaderFactoryTest.java
index 539fd16..9039183 100644
---
a/modules/vfs-class-loader/src/test/java/org/apache/accumulo/classloader/vfs/context/ReloadingVFSContextClassLoaderFactoryTest.java
+++
b/modules/vfs-class-loader/src/test/java/org/apache/accumulo/classloader/vfs/context/ReloadingVFSContextClassLoaderFactoryTest.java
@@ -28,6 +28,8 @@ import static org.junit.jupiter.api.Assertions.fail;
import java.io.BufferedWriter;
import java.io.File;
import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.StandardCopyOption;
import java.util.ArrayList;
import java.util.List;
@@ -35,7 +37,6 @@ import
org.apache.accumulo.classloader.vfs.AccumuloVFSClassLoader;
import
org.apache.accumulo.classloader.vfs.context.ReloadingVFSContextClassLoaderFactory.Context;
import
org.apache.accumulo.classloader.vfs.context.ReloadingVFSContextClassLoaderFactory.ContextConfig;
import
org.apache.accumulo.classloader.vfs.context.ReloadingVFSContextClassLoaderFactory.Contexts;
-import org.apache.commons.io.FileUtils;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInfo;
@@ -47,7 +48,6 @@ import com.google.gson.Gson;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-@SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "paths not
set by user input")
public class ReloadingVFSContextClassLoaderFactoryTest {
private static final Logger LOG =
@@ -101,18 +101,18 @@ public class ReloadingVFSContextClassLoaderFactoryTest {
private static final Contexts c = new Contexts();
- private static File foo = new File(System.getProperty("user.dir") +
"/target/foo");
- private static File bar = new File(System.getProperty("user.dir") +
"/target/bar");
+ private static Path foo = Path.of(System.getProperty("user.dir"), "target",
"foo");
+ private static Path bar = Path.of(System.getProperty("user.dir"), "target",
"bar");
@BeforeAll
public static void setup() throws Exception {
- assertTrue(foo.mkdir());
- assertTrue(bar.mkdir());
+ assertTrue(foo.toFile().mkdir());
+ assertTrue(bar.toFile().mkdir());
System.setProperty(AccumuloVFSClassLoader.VFS_CLASSLOADER_DEBUG, "true");
ContextConfig cc1 = new ContextConfig();
- cc1.setClassPath(foo.toURI() + ".*");
+ cc1.setClassPath(foo.resolve(".*").toUri().toString());
cc1.setPostDelegate(true);
cc1.setMonitorIntervalMs(1000);
Context c1 = new Context();
@@ -120,7 +120,7 @@ public class ReloadingVFSContextClassLoaderFactoryTest {
c1.setConfig(cc1);
ContextConfig cc2 = new ContextConfig();
- cc2.setClassPath(bar.toURI() + ".*");
+ cc2.setClassPath(bar.resolve(".*").toUri().toString());
cc2.setPostDelegate(false);
cc2.setMonitorIntervalMs(1000);
Context c2 = new Context();
@@ -149,16 +149,18 @@ public class ReloadingVFSContextClassLoaderFactoryTest {
@Test
public void testCreation(TestInfo testInfo) throws Exception {
- FileUtils.copyURLToFile(this.getClass().getResource("/HelloWorld.jar"),
- new File(foo, "HelloWorld.jar"));
- FileUtils.copyURLToFile(this.getClass().getResource("/HelloWorld2.jar"),
- new File(bar, "HelloWorld2.jar"));
+ try (var in = this.getClass().getResource("/HelloWorld.jar").openStream())
{
+ Files.copy(in, foo.resolve("HelloWorld.jar"),
StandardCopyOption.REPLACE_EXISTING);
+ }
+ try (var in =
this.getClass().getResource("/HelloWorld2.jar").openStream()) {
+ Files.copy(in, bar.resolve("HelloWorld2.jar"),
StandardCopyOption.REPLACE_EXISTING);
+ }
String testMethodName = testInfo.getTestMethod().orElseThrow().getName();
- File testSubDir = new File(tempDir, testMethodName);
+ File testSubDir = tempDir.toPath().resolve(testMethodName).toFile();
assertTrue(testSubDir.isDirectory() || testSubDir.mkdir());
- File f = new File(testSubDir, "configFile");
+ File f = testSubDir.toPath().resolve("configFile").toFile();
assertTrue(f.isFile() || f.createNewFile());
f.deleteOnExit();
Gson g = new Gson();
@@ -188,16 +190,18 @@ public class ReloadingVFSContextClassLoaderFactoryTest {
System.setProperty(AccumuloVFSClassLoader.VFS_CLASSPATH_MONITOR_INTERVAL,
"1");
- FileUtils.copyURLToFile(this.getClass().getResource("/HelloWorld.jar"),
- new File(foo, "HelloWorld.jar"));
- FileUtils.copyURLToFile(this.getClass().getResource("/HelloWorld.jar"),
- new File(bar, "HelloWorld2.jar"));
+ try (var in = this.getClass().getResource("/HelloWorld.jar").openStream())
{
+ Files.copy(in, foo.resolve("HelloWorld.jar"),
StandardCopyOption.REPLACE_EXISTING);
+ }
+ try (var in = this.getClass().getResource("/HelloWorld.jar").openStream())
{
+ Files.copy(in, bar.resolve("HelloWorld2.jar"),
StandardCopyOption.REPLACE_EXISTING);
+ }
String testMethodName = testInfo.getTestMethod().orElseThrow().getName();
- File testSubDir = new File(tempDir, testMethodName);
+ File testSubDir = tempDir.toPath().resolve(testMethodName).toFile();
assertTrue(testSubDir.isDirectory() || testSubDir.mkdir());
- File f = new File(testSubDir, "configFile");
+ File f = testSubDir.toPath().resolve("configFile").toFile();
assertTrue(f.isFile() || f.createNewFile());
f.deleteOnExit();
Gson g = new Gson();
@@ -207,7 +211,7 @@ public class ReloadingVFSContextClassLoaderFactoryTest {
}
TestReloadingVFSContextClassLoaderFactory factory =
- new TestReloadingVFSContextClassLoaderFactory(foo.toURI() + ".*") {
+ new
TestReloadingVFSContextClassLoaderFactory(foo.resolve(".*").toUri().toString())
{
@Override
protected String getConfigFileLocation() {
return f.toURI().toString();
@@ -223,13 +227,14 @@ public class ReloadingVFSContextClassLoaderFactoryTest {
Class<?> clazz1_5 = cl1.loadClass("test.HelloWorld");
assertEquals(clazz1, clazz1_5);
- assertTrue(new File(foo, "HelloWorld.jar").delete());
+ assertTrue(foo.resolve("HelloWorld.jar").toFile().delete());
Thread.sleep(1000);
// Update the class
- FileUtils.copyURLToFile(this.getClass().getResource("/HelloWorld.jar"),
- new File(foo, "HelloWorld2.jar"));
+ try (var in = this.getClass().getResource("/HelloWorld.jar").openStream())
{
+ Files.copy(in, foo.resolve("HelloWorld2.jar"),
StandardCopyOption.REPLACE_EXISTING);
+ }
// Wait for the monitor to notice
Thread.sleep(1000);
diff --git a/modules/vfs-class-loader/src/test/shell/makeHelloWorldJars.sh
b/modules/vfs-class-loader/src/test/shell/makeHelloWorldJars.sh
index c22e26d..8ddefab 100755
--- a/modules/vfs-class-loader/src/test/shell/makeHelloWorldJars.sh
+++ b/modules/vfs-class-loader/src/test/shell/makeHelloWorldJars.sh
@@ -24,12 +24,12 @@ if [[ -z $JAVA_HOME ]]; then
fi
mkdir -p target/generated-sources/HelloWorld/test
sed "s/%%/Hello World\!/" <src/test/java/test/HelloWorldTemplate
>target/generated-sources/HelloWorld/test/HelloWorld.java
-"$JAVA_HOME/bin/javac"
target/generated-sources/HelloWorld/test/HelloWorld.java -d
target/generated-sources/HelloWorld
+"$JAVA_HOME/bin/javac" --release 11
target/generated-sources/HelloWorld/test/HelloWorld.java -d
target/generated-sources/HelloWorld
"$JAVA_HOME/bin/jar" -cf target/test-classes/HelloWorld.jar -C
target/generated-sources/HelloWorld test/HelloWorld.class
rm -r target/generated-sources/HelloWorld/test
mkdir -p target/generated-sources/HalloWelt/test
sed "s/%%/Hallo Welt/" <src/test/java/test/HelloWorldTemplate
>target/generated-sources/HalloWelt/test/HelloWorld.java
-"$JAVA_HOME/bin/javac" target/generated-sources/HalloWelt/test/HelloWorld.java
-d target/generated-sources/HalloWelt
+"$JAVA_HOME/bin/javac" --release 11
target/generated-sources/HalloWelt/test/HelloWorld.java -d
target/generated-sources/HalloWelt
"$JAVA_HOME/bin/jar" -cf target/test-classes/HelloWorld2.jar -C
target/generated-sources/HalloWelt test/HelloWorld.class
rm -r target/generated-sources/HalloWelt/test
diff --git a/modules/vfs-class-loader/src/test/shell/makeTestJars.sh
b/modules/vfs-class-loader/src/test/shell/makeTestJars.sh
index 40ccec6..02006e8 100755
--- a/modules/vfs-class-loader/src/test/shell/makeTestJars.sh
+++ b/modules/vfs-class-loader/src/test/shell/makeTestJars.sh
@@ -26,7 +26,7 @@ fi
for x in A B C; do
mkdir -p target/generated-sources/$x/test
target/test-classes/ClassLoaderTest$x
sed "s/testX/test$x/" <src/test/java/test/TestTemplate
>target/generated-sources/$x/test/TestObject.java
- "$JAVA_HOME/bin/javac" -cp target/test-classes
target/generated-sources/$x/test/TestObject.java -d target/generated-sources/$x
+ CLASSPATH=target/test-classes "$JAVA_HOME/bin/javac" --release 11
target/generated-sources/$x/test/TestObject.java -d target/generated-sources/$x
"$JAVA_HOME/bin/jar" -cf target/test-classes/ClassLoaderTest$x/Test.jar -C
target/generated-sources/$x test/TestObject.class
rm -r target/generated-sources/$x
done
diff --git a/pom.xml b/pom.xml
index bdbaa63..bd7b541 100644
--- a/pom.xml
+++ b/pom.xml
@@ -19,12 +19,12 @@
under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
https://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache</groupId>
<artifactId>apache</artifactId>
- <version>33</version>
+ <version>35</version>
<relativePath />
</parent>
<groupId>org.apache.accumulo</groupId>
@@ -92,9 +92,8 @@
<url>https://github.com/apache/accumulo-classloaders/actions</url>
</ciManagement>
<properties>
-
<eclipseFormatterStyle>src/build/eclipse-codestyle.xml</eclipseFormatterStyle>
- <it.failIfNoSpecifiedTests>false</it.failIfNoSpecifiedTests>
- <licenseText><![CDATA[Licensed to the Apache Software Foundation (ASF)
under one
+ <accumulo.build.license.header><![CDATA[
+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
@@ -109,18 +108,25 @@ 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.]]></licenseText>
+under the License.
+]]></accumulo.build.license.header>
+ <failsafe.failIfNoSpecifiedTests>false</failsafe.failIfNoSpecifiedTests>
<maven.compiler.release>11</maven.compiler.release>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.site.deploy.skip>true</maven.site.deploy.skip>
<maven.site.skip>true</maven.site.skip>
+ <!-- surefire/failsafe plugin option -->
+
<maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile>
<!-- versions-maven-plugin ignore patterns for snapshots, alpha, beta,
milestones, and release candidates -->
<maven.version.ignore>.+-SNAPSHOT,(?i).*(alpha|beta)[0-9.-]*,(?i).*[.-](m|rc)[0-9]+</maven.version.ignore>
<minimalJavaBuildVersion>17</minimalJavaBuildVersion>
+ <minimalMavenBuildVersion>3.9</minimalMavenBuildVersion>
<!-- timestamp for reproducible outputs, updated on release by the release
plugin -->
<project.build.outputTimestamp>2020-08-27T15:56:15Z</project.build.outputTimestamp>
+ <rat.consoleOutput>true</rat.consoleOutput>
<sourceReleaseAssemblyDescriptor>source-release-tar</sourceReleaseAssemblyDescriptor>
+ <surefire.failIfNoSpecifiedTests>false</surefire.failIfNoSpecifiedTests>
</properties>
<dependencyManagement>
<dependencies>
@@ -147,6 +153,13 @@ under the License.]]></licenseText>
</dependency>
</dependencies>
</dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>com.github.spotbugs</groupId>
+ <artifactId>spotbugs-annotations</artifactId>
+ <optional>true</optional>
+ </dependency>
+ </dependencies>
<build>
<pluginManagement>
<plugins>
@@ -154,21 +167,16 @@ under the License.]]></licenseText>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
- <version>2.17.1</version>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <version>3.4.1</version>
+ <version>2.19.0</version>
</plugin>
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
- <version>4.5</version>
+ <version>5.0.0</version>
<configuration>
<licenseSets>
<licenseSet>
- <inlineHeader>${licenseText}</inlineHeader>
+ <inlineHeader>${accumulo.build.license.header}</inlineHeader>
<excludes combine.children="append">
<exclude>**/DEPENDENCIES</exclude>
<exclude>**/LICENSE</exclude>
@@ -177,7 +185,7 @@ under the License.]]></licenseText>
</excludes>
</licenseSet>
</licenseSets>
- <mapping>
+ <mapping combine.children="append">
<!-- general mappings; module-specific mappings appear in their
respective pom -->
<java>SLASHSTAR_STYLE</java>
<HelloWorldTemplate>SLASHSTAR_STYLE</HelloWorldTemplate>
@@ -186,44 +194,17 @@ under the License.]]></licenseText>
</configuration>
</plugin>
<plugin>
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
- <configuration>
- <excludes combine.children="append">
- <exclude>.github/**</exclude>
- <exclude>**/*.json</exclude>
- </excludes>
- </configuration>
- </plugin>
- <plugin>
- <groupId>com.github.ekryd.sortpom</groupId>
- <artifactId>sortpom-maven-plugin</artifactId>
- <version>4.0.0</version>
- <configuration>
- <createBackupFile>false</createBackupFile>
- <expandEmptyElements>false</expandEmptyElements>
- <keepBlankLines>false</keepBlankLines>
- <lineSeparator>\n</lineSeparator>
- <nrOfIndentSpace>2</nrOfIndentSpace>
- <predefinedSortOrder>recommended_2008_06</predefinedSortOrder>
- <sortDependencies>scope,groupId,artifactId</sortDependencies>
- <sortProperties>true</sortProperties>
- <spaceBeforeCloseEmptyElement>true</spaceBeforeCloseEmptyElement>
- <verifyFail>Stop</verifyFail>
- </configuration>
- </plugin>
- <plugin>
- <groupId>com.github.koraktor</groupId>
- <artifactId>mavanagaiata</artifactId>
- <version>1.0.1</version>
+ <groupId>org.gaul</groupId>
+ <artifactId>modernizer-maven-plugin</artifactId>
+ <version>3.2.0</version>
<configuration>
- <skipNoGit>true</skipNoGit>
+ <javaVersion>${maven.compiler.target}</javaVersion>
</configuration>
</plugin>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
- <version>4.8.6.4</version>
+ <version>4.9.5.0</version>
<configuration>
<xmlOutput>true</xmlOutput>
<effort>Max</effort>
@@ -239,145 +220,35 @@ under the License.]]></licenseText>
<plugin>
<groupId>com.h3xstream.findsecbugs</groupId>
<artifactId>findsecbugs-plugin</artifactId>
- <version>1.8.0</version>
+ <version>1.14.0</version>
</plugin>
</plugins>
</configuration>
</plugin>
<plugin>
- <groupId>net.revelc.code</groupId>
- <artifactId>impsort-maven-plugin</artifactId>
- <version>1.12.0</version>
- <configuration>
- <removeUnused>true</removeUnused>
- <groups>java.,javax.,org.,com.</groups>
- </configuration>
- </plugin>
- <plugin>
- <groupId>net.revelc.code.formatter</groupId>
- <artifactId>formatter-maven-plugin</artifactId>
- <version>2.24.1</version>
+ <groupId>com.github.ekryd.sortpom</groupId>
+ <artifactId>sortpom-maven-plugin</artifactId>
+ <version>4.0.0</version>
<configuration>
- <configFile>${eclipseFormatterStyle}</configFile>
- <lineEnding>LF</lineEnding>
- <skipCssFormatting>true</skipCssFormatting>
- <skipHtmlFormatting>true</skipHtmlFormatting>
- <skipJsFormatting>true</skipJsFormatting>
- <skipJsonFormatting>true</skipJsonFormatting>
- <skipXmlFormatting>true</skipXmlFormatting>
+ <createBackupFile>false</createBackupFile>
+ <expandEmptyElements>false</expandEmptyElements>
+ <keepBlankLines>false</keepBlankLines>
+ <lineSeparator>\n</lineSeparator>
+ <nrOfIndentSpace>2</nrOfIndentSpace>
+ <predefinedSortOrder>recommended_2008_06</predefinedSortOrder>
+ <sortDependencies>scope,groupId,artifactId</sortDependencies>
+ <sortProperties>true</sortProperties>
+ <spaceBeforeCloseEmptyElement>true</spaceBeforeCloseEmptyElement>
+ <verifyFail>Stop</verifyFail>
</configuration>
</plugin>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
+ <groupId>com.github.koraktor</groupId>
+ <artifactId>mavanagaiata</artifactId>
+ <version>1.1.1</version>
<configuration>
- <checkstyleRules>
- <module name="Checker">
- <property name="charset" value="UTF-8" />
- <property name="severity" value="warning" />
- <!-- Checks for whitespace -->
- <!-- See http://checkstyle.sf.net/config_whitespace.html -->
- <module name="FileTabCharacter">
- <property name="eachLine" value="true" />
- </module>
- <module name="LineLength">
- <property name="max" value="100" />
- <property name="ignorePattern" value="^[ ]*[*].*@(link|see)
|Map.* = new .*Map|org[.]apache[.]accumulo[.]|a href=|http://|https://|ftp://"
/>
- </module>
- <module name="TreeWalker">
- <module name="OneTopLevelClass" />
- <module name="RegexpSinglelineJava">
- <property name="format" value="\s+$" />
- <property name="message" value="Line has trailing
whitespace." />
- </module>
- <module name="RegexpSinglelineJava">
- <property name="format" value="[@]see\s+[{][@]link" />
- <property name="message" value="Javadoc @see does not need
@link: pick one or the other." />
- </module>
- <module name="RegexpSinglelineJava">
- <property name="format"
value="jline[.]internal[.]Preconditions" />
- <property name="message" value="Please use Guava
Preconditions not JLine" />
- </module>
- <module name="RegexpSinglelineJava">
- <property name="format"
value="org[.]apache[.]commons[.]math[.]" />
- <property name="message" value="Use commons-math3
(org.apache.commons.math3.*)" />
- </module>
- <module name="RegexpSinglelineJava">
- <property name="format"
value="junit[.]framework[.]TestCase" />
- <property name="message" value="Use JUnit5+ @Test
annotation instead of TestCase" />
- </module>
- <module name="RegexpSinglelineJava">
- <property name="format" value="org[.]junit[.](?!jupiter)"
/>
- <property name="message" value="Use JUnit5 (JUnit Jupiter)
instead of JUnit4 (or lower)" />
- </module>
- <module name="RegexpSinglelineJava">
- <property name="format"
value="org[.]junit[.]jupiter[.]api[.]Assertions;" />
- <property name="message" value="Use static imports for
Assertions.* methods for consistency" />
- </module>
- <module name="RegexpSinglelineJava">
- <property name="format"
value="org[.]junit[.]jupiter[.]api[.]Assumptions;" />
- <property name="message" value="Use static imports for
Assumptions.* methods for consistency" />
- </module>
- <module name="OuterTypeFilename" />
- <module name="AvoidStarImport" />
- <module name="UnusedImports">
- <property name="processJavadoc" value="true" />
- </module>
- <module name="NoLineWrap" />
- <module name="LeftCurly" />
- <module name="RightCurly">
- <property name="option" value="alone" />
- <property name="tokens" value="CLASS_DEF, METHOD_DEF,
CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT, INSTANCE_INIT" />
- </module>
- <module name="SeparatorWrap">
- <property name="tokens" value="DOT" />
- <property name="option" value="nl" />
- </module>
- <module name="SeparatorWrap">
- <property name="tokens" value="COMMA" />
- <property name="option" value="EOL" />
- </module>
- <module name="PackageName">
- <property name="format"
value="^[a-z]+(\.[a-z][a-zA-Z0-9]*)*$" />
- </module>
- <module name="MethodTypeParameterName">
- <property name="format"
value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)" />
- </module>
- <module name="MethodParamPad" />
- <module name="OperatorWrap">
- <property name="option" value="NL" />
- <property name="tokens" value="BAND, BOR, BSR, BXOR, DIV,
EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR, LT, MINUS, MOD, NOT_EQUAL,
QUESTION, SL, SR, STAR " />
- </module>
- <module name="AnnotationLocation">
- <property name="tokens" value="CLASS_DEF, INTERFACE_DEF,
ENUM_DEF, METHOD_DEF, CTOR_DEF" />
- </module>
- <module name="AnnotationLocation">
- <property name="tokens" value="VARIABLE_DEF" />
- <property name="allowSamelineMultipleAnnotations"
value="true" />
- </module>
- <module name="NonEmptyAtclauseDescription" />
- <module name="JavadocTagContinuationIndentation" />
- <module name="JavadocMethod">
- <property name="allowMissingParamTags" value="true" />
- <property name="allowMissingReturnTag" value="true" />
- <property name="allowedAnnotations"
value="Override,Test,BeforeClass,AfterClass,Before,After" />
- </module>
- <module name="SingleLineJavadoc" />
- <module name="MissingOverrideCheck" />
- <module name="AnnotationLocation" />
- </module>
- </module>
- </checkstyleRules>
- <violationSeverity>warning</violationSeverity>
- <includeTestSourceDirectory>true</includeTestSourceDirectory>
+ <skipNoGit>true</skipNoGit>
</configuration>
- <dependencies>
- <dependency>
- <groupId>com.puppycrawl.tools</groupId>
- <artifactId>checkstyle</artifactId>
- <version>10.18.1</version>
- </dependency>
- </dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -399,8 +270,9 @@ under the License.]]></licenseText>
<configuration>
<archive>
<manifestEntries>
- <Sealed>true</Sealed>
+
<Automatic-Module-Name>${accumulo.build.module.name}</Automatic-Module-Name>
<Implementation-Build>${mvngit.commit.id}</Implementation-Build>
+ <Sealed>true</Sealed>
</manifestEntries>
</archive>
</configuration>
@@ -412,13 +284,14 @@ under the License.]]></licenseText>
<quiet>true</quiet>
<additionalJOption>-J-Xmx512m</additionalJOption>
<doclint>all,-missing</doclint>
+ <legacyMode>true</legacyMode>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
- <arguments>-P !autoformat</arguments>
+ <arguments>-P !autoformat,verifyformat</arguments>
<goals>clean deploy</goals>
<preparationGoals>clean verify</preparationGoals>
<tagNameFormat>rel/@{project.artifactId}-@{project.version}</tagNameFormat>
@@ -429,51 +302,145 @@ under the License.]]></licenseText>
</configuration>
</plugin>
<plugin>
- <groupId>org.gaul</groupId>
- <artifactId>modernizer-maven-plugin</artifactId>
- <version>2.9.0</version>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>3.6.1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>3.5.1</version>
+ </plugin>
+ <plugin>
+ <groupId>net.revelc.code.formatter</groupId>
+ <artifactId>formatter-maven-plugin</artifactId>
+ <version>2.29.0</version>
<configuration>
- <javaVersion>${maven.compiler.target}</javaVersion>
+
<configFile>${rootlocation}/src/build/eclipse-codestyle.xml</configFile>
+ <lineEnding>LF</lineEnding>
+ <skipCssFormatting>true</skipCssFormatting>
+ <skipHtmlFormatting>true</skipHtmlFormatting>
+ <skipJsFormatting>true</skipJsFormatting>
+ <skipJsonFormatting>true</skipJsonFormatting>
+ <skipXmlFormatting>true</skipXmlFormatting>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <configuration>
+ <excludes combine.children="append">
+ <exclude>.github/**</exclude>
+ <exclude>**/*.json</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>net.revelc.code</groupId>
+ <artifactId>impsort-maven-plugin</artifactId>
+ <version>1.12.0</version>
+ <configuration>
+ <removeUnused>true</removeUnused>
+ <groups>java.,javax.,jakarta.,org.,com.</groups>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
- <!-- verify before compile; should be sorted already -->
- <groupId>com.github.ekryd.sortpom</groupId>
- <artifactId>sortpom-maven-plugin</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
- <id>verify-sorted-pom</id>
+ <id>analyze</id>
<goals>
- <goal>verify</goal>
+ <goal>analyze-only</goal>
</goals>
- <phase>process-resources</phase>
+ <configuration>
+ <failOnWarning>true</failOnWarning>
+ <ignoredUnusedDeclaredDependencies>
+ <!-- ignore false positive runtime dependencies -->
+ <unused>org.apache.commons:commons-vfs2-hdfs:*</unused>
+
<unused>org.apache.httpcomponents.client5:httpclient5:*</unused>
+ <unused>org.apache.logging.log4j:log4j-slf4j2-impl:*</unused>
+ <!-- spotbugs annotations may or may not be used in each
module -->
+ <unused>com.github.spotbugs:spotbugs-annotations:jar:*</unused>
+ </ignoredUnusedDeclaredDependencies>
+ </configuration>
</execution>
</executions>
</plugin>
<plugin>
- <groupId>com.github.koraktor</groupId>
- <artifactId>mavanagaiata</artifactId>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
- <id>git-commit</id>
+ <!-- create property named 'rootlocation' to point to top of
multi-module project -->
+ <id>create-rootlocation-property</id>
<goals>
- <goal>commit</goal>
+ <goal>rootlocation</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>create-automatic-module-name</id>
+ <goals>
+ <goal>regex-property</goal>
+ </goals>
+ <configuration>
+ <name>accumulo.build.module.name</name>
+ <regex>-</regex>
+ <replacement>.</replacement>
+ <value>org-apache-${project.artifactId}</value>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>enforce-accumulo-rules</id>
+ <goals>
+ <goal>enforce</goal>
</goals>
<phase>validate</phase>
+ <configuration>
+ <rules>
+ <reactorModuleConvergence />
+ <banDuplicatePomDependencyVersions />
+ <dependencyConvergence />
+ <banDynamicVersions />
+ <bannedDependencies>
+ <excludes>
+ <!-- we redirect logging to log4j2, so we should have
those bridges instead -->
+ <!-- commons-logging is allowed because it natively sends
to log4j2 or slf4j -->
+ <exclude>ch.qos.logback:*</exclude>
+ <exclude>ch.qos.reload4j:*</exclude>
+ <exclude>log4j:*</exclude>
+ <!-- exclude log4j-slf4j-impl to prefer log4j-slf4j2-impl
-->
+
<exclude>org.apache.logging.log4j:log4j-slf4j-impl</exclude>
+ <exclude>org.apache.logging.log4j:log4j-to-slf4j</exclude>
+ <exclude>org.slf4j:*</exclude>
+ </excludes>
+ <includes>
+ <!-- only allow API jar for slf4j, but no other slf4j
implementations -->
+ <include>org.slf4j:slf4j-api</include>
+ </includes>
+ </bannedDependencies>
+ </rules>
+ </configuration>
</execution>
</executions>
</plugin>
<plugin>
- <groupId>com.github.spotbugs</groupId>
- <artifactId>spotbugs-maven-plugin</artifactId>
+ <groupId>org.gaul</groupId>
+ <artifactId>modernizer-maven-plugin</artifactId>
<executions>
<execution>
- <id>run-spotbugs</id>
+ <id>modernizer</id>
<goals>
- <goal>check</goal>
+ <goal>modernizer</goal>
</goals>
</execution>
</executions>
@@ -481,6 +448,100 @@ under the License.]]></licenseText>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <checkstyleRules>
+ <module name="Checker">
+ <property name="charset" value="UTF-8" />
+ <property name="severity" value="warning" />
+ <!-- Checks for whitespace -->
+ <!-- See
https://checkstyle.sourceforge.io/config_whitespace.html -->
+ <module name="FileTabCharacter" />
+ <module name="TreeWalker">
+ <module name="OneTopLevelClass" />
+ <module name="RegexpSinglelineJava">
+ <property name="format" value="\s+$" />
+ <property name="message" value="Line has trailing
whitespace." />
+ </module>
+ <module name="RegexpSinglelineJava">
+ <property name="format"
value="[@]Deprecated([^)]*forRemoval[^)]*)" />
+ <property name="message" value="forRemoval should not be
used." />
+ </module>
+ <module name="RegexpSinglelineJava">
+ <property name="format" value="[@]see\s+[{][@]link" />
+ <property name="message" value="Javadoc @see does not need
@link: pick one or the other." />
+ </module>
+ <module name="RegexpSinglelineJava">
+ <property name="format"
value="jline[.]internal[.]Preconditions" />
+ <property name="message" value="Please use Guava
Preconditions not JLine" />
+ </module>
+ <module name="RegexpSinglelineJava">
+ <property name="format"
value="org[.]apache[.]commons[.]math[.]" />
+ <property name="message" value="Use commons-math3
(org.apache.commons.math3.*)" />
+ </module>
+ <module name="RegexpSinglelineJava">
+ <property name="format"
value="org[.]junit[.]jupiter[.]api[.]Assertions;" />
+ <property name="message" value="Use static imports for
Assertions.* methods for consistency" />
+ </module>
+ <module name="RegexpSinglelineJava">
+ <property name="format"
value="org[.]junit[.]jupiter[.]api[.]Assumptions;" />
+ <property name="message" value="Use static imports for
Assumptions.* methods for consistency" />
+ </module>
+ <module name="RegexpSinglelineJava">
+ <property name="format" value="import
java[.]nio[.]charset[.]StandardCharsets;" />
+ <property name="message" value="Use static imports for
StandardCharsets.* constants for consistency" />
+ </module>
+ <module name="RegexpSinglelineJava">
+ <!-- double escape quotes because checkstyle passes these
through another xml parser -->
+ <property name="format" value="&quot; [+] &quot;" />
+ <property name="message" value="Unnecessary concatenation of
string literals" />
+ </module>
+ <module name="RegexpSinglelineJava">
+ <property name="format"
value="com[.]google[.]common[.]cache[.]" />
+ <property name="message" value="Please use Caffeine Cache,
not Guava" />
+ </module>
+ <module name="OuterTypeFilename" />
+ <module name="AvoidStarImport" />
+ <module name="NoLineWrap" />
+ <module name="LeftCurly" />
+ <module name="RightCurly">
+ <property name="tokens" value="LITERAL_TRY, LITERAL_CATCH,
LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, CLASS_DEF, METHOD_DEF, CTOR_DEF,
LITERAL_FOR, LITERAL_WHILE, LITERAL_DO, STATIC_INIT, INSTANCE_INIT" />
+ </module>
+ <module name="SeparatorWrap">
+ <property name="tokens" value="DOT" />
+ <property name="option" value="nl" />
+ </module>
+ <module name="SeparatorWrap">
+ <property name="tokens" value="COMMA" />
+ <property name="option" value="EOL" />
+ </module>
+ <module name="PackageName">
+ <property name="format"
value="^[a-z]+(\.[a-z][a-zA-Z0-9]*)*$" />
+ </module>
+ <module name="MethodTypeParameterName">
+ <property name="format"
value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)" />
+ </module>
+ <module name="NonEmptyAtclauseDescription" />
+ <module name="JavadocMethod">
+ <property name="allowMissingParamTags" value="true" />
+ <property name="allowMissingReturnTag" value="true" />
+ <property name="allowedAnnotations"
value="Override,Test,BeforeClass,AfterClass,Before,After,BeforeAll,AfterAll,BeforeEach,AfterEach"
/>
+ </module>
+ <module name="MissingOverrideCheck" />
+ <!--Require braces for all control statements -->
+ <module name="NeedBraces" />
+ </module>
+ </module>
+ </checkstyleRules>
+ <violationSeverity>warning</violationSeverity>
+ <includeTestSourceDirectory>true</includeTestSourceDirectory>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>com.puppycrawl.tools</groupId>
+ <artifactId>checkstyle</artifactId>
+ <version>11.0.1</version>
+ </dependency>
+ </dependencies>
<executions>
<execution>
<id>check-style</id>
@@ -490,33 +551,38 @@ under the License.]]></licenseText>
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>com.github.koraktor</groupId>
+ <artifactId>mavanagaiata</artifactId>
+ <executions>
+ <execution>
+ <id>git-commit</id>
+ <goals>
+ <goal>commit</goal>
+ </goals>
+ <phase>validate</phase>
+ </execution>
+ </executions>
+ </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
+ <artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
- <id>analyze</id>
+ <id>run-integration-tests</id>
<goals>
- <goal>analyze-only</goal>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
</goals>
- <configuration>
- <failOnWarning>true</failOnWarning>
- <ignoredUnusedDeclaredDependencies>
- <!-- ignore false positive runtime dependencies -->
- <unused>org.apache.commons:commons-vfs2-hdfs:*</unused>
-
<unused>org.apache.httpcomponents.client5:httpclient5:*</unused>
- <unused>org.apache.logging.log4j:log4j-slf4j2-impl:*</unused>
- </ignoredUnusedDeclaredDependencies>
- </configuration>
</execution>
</executions>
</plugin>
<plugin>
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
+ <groupId>com.github.spotbugs</groupId>
+ <artifactId>spotbugs-maven-plugin</artifactId>
<executions>
<execution>
- <id>check-licenses</id>
+ <id>run-spotbugs</id>
<goals>
<goal>check</goal>
</goals>
@@ -524,14 +590,15 @@ under the License.]]></licenseText>
</executions>
</plugin>
<plugin>
- <groupId>org.gaul</groupId>
- <artifactId>modernizer-maven-plugin</artifactId>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
<executions>
<execution>
- <id>modernizer</id>
+ <id>check-licenses</id>
<goals>
- <goal>modernizer</goal>
+ <goal>check</goal>
</goals>
+ <phase>prepare-package</phase>
</execution>
</executions>
</plugin>
diff --git a/src/build/eclipse-codestyle.xml b/src/build/eclipse-codestyle.xml
index d6f63a0..e05cc4d 100644
--- a/src/build/eclipse-codestyle.xml
+++ b/src/build/eclipse-codestyle.xml
@@ -19,8 +19,9 @@
under the License.
-->
-<profiles version="22">
- <profile kind="CodeFormatterProfile" name="Accumulo" version="22">
+<profiles version="23">
+ <profile kind="CodeFormatterProfile" name="Accumulo" version="23">
+ <setting
id="org.eclipse.jdt.core.formatter.align_arrows_in_switch_on_columns"
value="false"/>
<setting
id="org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns"
value="false"/>
<setting
id="org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines"
value="2147483647"/>
<setting
id="org.eclipse.jdt.core.formatter.align_selector_in_method_invocation_on_expression_first_line"
value="true"/>
@@ -61,6 +62,7 @@
<setting
id="org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references"
value="16"/>
<setting
id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration"
value="16"/>
<setting
id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration"
value="16"/>
+ <setting
id="org.eclipse.jdt.core.formatter.alignment_for_permitted_types_in_type_declaration"
value="16"/>
<setting
id="org.eclipse.jdt.core.formatter.alignment_for_record_components" value="16"/>
<setting
id="org.eclipse.jdt.core.formatter.alignment_for_relational_operator"
value="16"/>
<setting
id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="16"/>
@@ -97,6 +99,7 @@
<setting
id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer"
value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block"
value="end_of_line"/>
<setting
id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case"
value="end_of_line"/>
+ <setting
id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case_after_arrow"
value="end_of_line"/>
<setting
id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration"
value="end_of_line"/>
<setting
id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant"
value="end_of_line"/>
<setting
id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration"
value="end_of_line"/>
@@ -123,6 +126,7 @@
<setting
id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags"
value="insert"/>
<setting
id="org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags"
value="do not insert"/>
<setting
id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter"
value="do not insert"/>
+ <setting
id="org.eclipse.jdt.core.formatter.comment.javadoc_do_not_separate_block_tags"
value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.line_length"
value="100"/>
<setting
id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries"
value="true"/>
<setting
id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries"
value="true"/>
@@ -351,6 +355,7 @@
<setting
id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant"
value="do not insert"/>
<setting
id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration"
value="do not insert"/>
<setting
id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation"
value="do not insert"/>
+ <setting id="org.eclipse.jdt.core.formatter.join_line_comments"
value="false"/>
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments"
value="true"/>
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines"
value="true"/>
<setting
id="org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line"
value="one_line_if_empty"/>