update to OpenJDK 21, Gradle 8.4-rc-1

This commit is contained in:
Jörg Prante 2023-09-30 22:22:33 +02:00
parent 344e234fc3
commit ad6cd526fa
15 changed files with 62 additions and 82 deletions

View file

@ -4,10 +4,10 @@ plugins {
id "pmd" id "pmd"
id 'maven-publish' id 'maven-publish'
id 'signing' id 'signing'
id "io.github.gradle-nexus.publish-plugin" version "1.3.0" id "io.github.gradle-nexus.publish-plugin" version "2.0.0-rc-1"
id "com.github.spotbugs" version "5.0.14" id "com.github.spotbugs" version "6.0.0-beta.3"
id "org.cyclonedx.bom" version "1.7.2" id "org.cyclonedx.bom" version "1.7.4"
id "org.xbib.gradle.plugin.asciidoctor" version "2.5.2.2" id "org.xbib.gradle.plugin.asciidoctor" version "3.0.0"
} }
wrapper { wrapper {
@ -38,7 +38,7 @@ subprojects {
apply from: rootProject.file('gradle/documentation/asciidoc.gradle') apply from: rootProject.file('gradle/documentation/asciidoc.gradle')
apply from: rootProject.file('gradle/quality/checkstyle.gradle') apply from: rootProject.file('gradle/quality/checkstyle.gradle')
apply from: rootProject.file('gradle/quality/pmd.gradle') apply from: rootProject.file('gradle/quality/pmd.gradle')
apply from: rootProject.file('gradle/quality/spotbugs.gradle') //apply from: rootProject.file('gradle/quality/spotbugs.gradle')
apply from: rootProject.file('gradle/publish/maven.gradle') apply from: rootProject.file('gradle/publish/maven.gradle')
} }
apply from: rootProject.file('gradle/publish/sonatype.gradle') apply from: rootProject.file('gradle/publish/sonatype.gradle')

View file

@ -1,5 +1,5 @@
group = org.xbib group = org.xbib
name = net name = net
version = 3.3.4 version = 4.0.0
org.gradle.warning.mode = ALL org.gradle.warning.mode = ALL

Binary file not shown.

View file

@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-rc-1-all.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

22
gradlew vendored
View file

@ -83,7 +83,8 @@ done
# This is normally unused # This is normally unused
# shellcheck disable=SC2034 # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum
@ -130,18 +131,21 @@ location of your Java installation."
fi fi
else else
JAVACMD=java JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi fi
fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #( case $MAX_FD in #(
max*) max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045 # shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) || MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit" warn "Could not query maximum file descriptor limit"
esac esac
@ -149,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #( '' | soft) :;; #(
*) *)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045 # shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" || ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD" warn "Could not set maximum file descriptor limit to $MAX_FD"
esac esac
@ -198,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command; # Collect all arguments for the java command:
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# shell script including quotes and variable substitutions, so put them in # and any embedded shellness will be escaped.
# double quotes to make sure that they get re-expanded; and # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# * put everything else in single quotes, so that it's not re-expanded. # treated as '${Hostname}' itself on the command line.
set -- \ set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \ "-Dorg.gradle.appname=$APP_BASE_NAME" \

View file

@ -23,10 +23,10 @@ public class PathDecoder {
this.path = PathNormalizer.normalize(path); this.path = PathNormalizer.normalize(path);
this.params = Parameter.builder().domain(Parameter.Domain.PATH).enablePercentDecoding(); this.params = Parameter.builder().domain(Parameter.Domain.PATH).enablePercentDecoding();
if (query != null) { if (query != null) {
parse(query); this.params.add(query);
} }
if (queryString != null) { if (queryString != null) {
parse(queryString); this.params.add(queryString);
} }
} }

View file

@ -30,11 +30,16 @@ public class PathMatcher {
} }
public PathMatcher(String pathSeparator) { public PathMatcher(String pathSeparator) {
setPathSeparator(pathSeparator); this.pathSeparator = pathSeparator;
update();
} }
public void setPathSeparator(String pathSeparator) { public void setPathSeparator(String pathSeparator) {
this.pathSeparator = pathSeparator != null ? pathSeparator : DEFAULT_PATH_SEPARATOR; this.pathSeparator = pathSeparator;
update();
}
private void update() {
this.endsOnWildCard = this.pathSeparator + "*"; this.endsOnWildCard = this.pathSeparator + "*";
this.endsOnDoubleWildCard = this.pathSeparator + "**"; this.endsOnDoubleWildCard = this.pathSeparator + "**";
this.caseSensitive = true; this.caseSensitive = true;

View file

@ -38,8 +38,7 @@ public class RegexPathElement extends PathElement {
this.pattern = buildPattern(regex, completePattern); this.pattern = buildPattern(regex, completePattern);
} }
private Pattern buildPattern(char[] regex, char[] completePattern) {
public Pattern buildPattern(char[] regex, char[] completePattern) {
StringBuilder patternBuilder = new StringBuilder(); StringBuilder patternBuilder = new StringBuilder();
String text = new String(regex); String text = new String(regex);
Matcher matcher = GLOB_PATTERN.matcher(text); Matcher matcher = GLOB_PATTERN.matcher(text);

View file

@ -52,7 +52,7 @@ public class Path {
return new Path(pathSpec); return new Path(pathSpec);
} }
public void init(String pathSpec, String pathSeparator, boolean trimTokens, boolean caseSensitive) { protected final void init(String pathSpec, String pathSeparator, boolean trimTokens, boolean caseSensitive) {
this.pathSpec = PathNormalizer.normalize(pathSpec); this.pathSpec = PathNormalizer.normalize(pathSpec);
this.pathSeparator = pathSeparator; this.pathSeparator = pathSeparator;
this.trimTokens = trimTokens; this.trimTokens = trimTokens;
@ -140,11 +140,11 @@ public class Path {
return Objects.hash(pathSpec, parameterCount, singleWildcards, doubleWildcards, catchAllPattern, prefixPattern, length); return Objects.hash(pathSpec, parameterCount, singleWildcards, doubleWildcards, catchAllPattern, prefixPattern, length);
} }
public List<PathSegment> tokenize(String string) { protected final List<PathSegment> tokenize(String string) {
return tokenize(string, pathSeparator, trimTokens, caseSensitive); return tokenize(string, pathSeparator, trimTokens, caseSensitive);
} }
public static List<PathSegment> tokenize(String string, String pathSeparator, boolean trimTokens, boolean caseSensitive) { protected static List<PathSegment> tokenize(String string, String pathSeparator, boolean trimTokens, boolean caseSensitive) {
List<PathSegment> pathSegments = new ArrayList<>(); List<PathSegment> pathSegments = new ArrayList<>();
if (string == null) { if (string == null) {
return pathSegments; return pathSegments;
@ -155,7 +155,7 @@ public class Path {
if (trimTokens) { if (trimTokens) {
token = token.trim(); token = token.trim();
} }
if (token.length() > 0) { if (!token.isEmpty()) {
if (!caseSensitive) { if (!caseSensitive) {
token = token.toLowerCase(Locale.ROOT); token = token.toLowerCase(Locale.ROOT);
} }

View file

@ -1538,43 +1538,29 @@ public final class IRI extends ResourceIdentifier
* or if some other error occurred while constructing the URL * or if some other error occurred while constructing the URL
*/ */
public URL toURL() throws MalformedURLException { public URL toURL() throws MalformedURLException {
return fromURI(this); if (!isAbsolute()) {
}
/**
* Creates a URL from an IRI, as if by invoking {@code iri.toURL()}.
*
*/
static URL fromURI(IRI uri) throws MalformedURLException {
if (!uri.isAbsolute()) {
throw new IllegalArgumentException("URI is not absolute"); throw new IllegalArgumentException("URI is not absolute");
} }
String protocol = uri.getScheme(); String protocol = getScheme();
// In general we need to go via Handler.parseURL, but for the jrt // In general we need to go via Handler.parseURL, but for the jrt
// protocol we enforce that the Handler is not overrideable and can // protocol we enforce that the Handler is not overrideable and can
// optimize URI to URL conversion. // optimize URI to URL conversion.
//
// Case-sensitive comparison for performance; malformed protocols will // Case-sensitive comparison for performance; malformed protocols will
// be handled correctly by the slow path. // be handled correctly by the slow path.
if (protocol.equals("jrt") && !uri.isOpaque() if (protocol.equals("jrt") && !isOpaque()
&& uri.getRawFragment() == null) { && getRawFragment() == null) {
String query = getRawQuery();
String query = uri.getRawQuery(); String path = getRawPath();
String path = uri.getRawPath();
String file = (query == null) ? path : path + "?" + query; String file = (query == null) ? path : path + "?" + query;
// URL represent undefined host as empty string while URI use null // URL represent undefined host as empty string while URI use null
String host = uri.getHost(); String host = getHost();
if (host == null) { if (host == null) {
host = ""; host = "";
} }
int port = getPort();
int port = uri.getPort(); return URI.create("jrt://" + host + ":" + port + "/" + file).toURL();
return new URL("jrt", host, port, file, null);
} else { } else {
return new URL((URL)null, uri.toString(), null); return URI.create(toString()).toURL();
} }
} }

View file

@ -1180,44 +1180,30 @@ public final class URI extends ResourceIdentifier
* or if some other error occurred while constructing the URL * or if some other error occurred while constructing the URL
*/ */
public URL toURL() throws MalformedURLException { public URL toURL() throws MalformedURLException {
return fromURI(this); if (!isAbsolute()) {
}
/**
* Creates a URL from a URI, as if by invoking {@code uri.toURL()}.
*
* @see java.net.URI#toURL()
*/
static URL fromURI(URI uri) throws MalformedURLException {
if (!uri.isAbsolute()) {
throw new IllegalArgumentException("URI is not absolute"); throw new IllegalArgumentException("URI is not absolute");
} }
String protocol = uri.getScheme(); String protocol = getScheme();
// In general we need to go via Handler.parseURL, but for the jrt // In general we need to go via Handler.parseURL, but for the jrt
// protocol we enforce that the Handler is not overrideable and can // protocol we enforce that the Handler is not overrideable and can
// optimize URI to URL conversion. // optimize URI to URL conversion.
// //
// Case-sensitive comparison for performance; malformed protocols will // Case-sensitive comparison for performance; malformed protocols will
// be handled correctly by the slow path. // be handled correctly by the slow path.
if (protocol.equals("jrt") && !uri.isOpaque() if (protocol.equals("jrt") && !isOpaque()
&& uri.getRawFragment() == null) { && getRawFragment() == null) {
String query = getRawQuery();
String query = uri.getRawQuery(); String path = getRawPath();
String path = uri.getRawPath();
String file = (query == null) ? path : path + "?" + query; String file = (query == null) ? path : path + "?" + query;
// URL represent undefined host as empty string while URI use null // URL represent undefined host as empty string while URI use null
String host = uri.getHost(); String host = getHost();
if (host == null) { if (host == null) {
host = ""; host = "";
} }
int port = getPort();
int port = uri.getPort(); return URI.create("jrt://" + host + ":" + port + "/" + file).toURL();
return new URL("jrt", host, port, file, null);
} else { } else {
return new URL((URL)null, uri.toString(), null); return URI.create(toString()).toURL();
} }
} }

View file

@ -438,14 +438,14 @@ public class URL implements Comparable<URL> {
return externalStringRepresentation; return externalStringRepresentation;
} }
public java.net.URL toURL() throws MalformedURLException {
return new java.net.URL(toString());
}
public URI toURI() { public URI toURI() {
return URI.create(toString()); return URI.create(toString());
} }
public java.net.URL toURL() throws MalformedURLException {
return toURI().toURL();
}
public Path toPath() { public Path toPath() {
return Paths.get(toURI()); return Paths.get(toURI());
} }

View file

@ -34,12 +34,11 @@ public class JsonFileStore implements Store<Map<String, Object>> {
private final Path path; private final Path path;
public JsonFileStore(String name, Path path, long expireAfterSeconds) throws IOException { public JsonFileStore(String name, Path path) throws IOException {
this.name = name; this.name = name;
this.path = path; this.path = path;
this.lock = new ReentrantReadWriteLock(); this.lock = new ReentrantReadWriteLock();
Files.createDirectories(path); Files.createDirectories(path);
purge(expireAfterSeconds);
} }
@Override @Override

View file

@ -22,7 +22,7 @@ public class JsonFileStoreTest {
@BeforeAll @BeforeAll
public static void before() throws IOException { public static void before() throws IOException {
Path path = Files.createTempDirectory("jsonstore"); Path path = Files.createTempDirectory("jsonstore");
jsonFileStore = new JsonFileStore("test", path, 3600L); jsonFileStore = new JsonFileStore("test", path);
} }
@AfterAll @AfterAll

View file

@ -15,7 +15,7 @@ pluginManagement {
dependencyResolutionManagement { dependencyResolutionManagement {
versionCatalogs { versionCatalogs {
libs { libs {
version('gradle', '8.1.1') version('gradle', '8.4-rc-1')
version('junit', '5.10.0') version('junit', '5.10.0')
library('junit-jupiter-api', 'org.junit.jupiter', 'junit-jupiter-api').versionRef('junit') library('junit-jupiter-api', 'org.junit.jupiter', 'junit-jupiter-api').versionRef('junit')
library('junit-jupiter-params', 'org.junit.jupiter', 'junit-jupiter-params').versionRef('junit') library('junit-jupiter-params', 'org.junit.jupiter', 'junit-jupiter-params').versionRef('junit')