Skip to content

Commit 0b48a44

Browse files
authored
Merge branch 'develop' into dependabot/maven/org.junit.platform-junit-platform-engine-1.13.4
2 parents c72a9a0 + 45db4a0 commit 0b48a44

File tree

18 files changed

+546
-524
lines changed

18 files changed

+546
-524
lines changed

exist-core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
<dependency>
6060
<groupId>com.fasterxml.jackson.core</groupId>
6161
<artifactId>jackson-core</artifactId>
62-
<version>2.19.1</version>
62+
<version>2.19.2</version>
6363
</dependency>
6464

6565
<!-- dependency>

exist-core/src/main/java/org/exist/repo/ClasspathHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
import org.apache.logging.log4j.LogManager;
2525
import org.apache.logging.log4j.Logger;
2626
import org.exist.SystemProperties;
27-
import org.exist.start.Classpath;
28-
import org.exist.start.EXistClassLoader;
27+
import org.exist.start.classloader.Classpath;
28+
import org.exist.start.classloader.EXistClassLoader;
2929
import org.exist.storage.BrokerPool;
3030
import org.exist.storage.BrokerPoolService;
3131
import org.expath.pkg.repo.FileSystemStorage;

exist-core/src/main/java/org/exist/test/ExistEmbeddedServer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
import org.apache.logging.log4j.LogManager;
2525
import org.apache.logging.log4j.Logger;
2626
import org.exist.EXistException;
27-
import org.exist.start.Classpath;
28-
import org.exist.start.EXistClassLoader;
27+
import org.exist.start.classloader.Classpath;
28+
import org.exist.start.classloader.EXistClassLoader;
2929
import org.exist.storage.BrokerPool;
3030
import org.exist.storage.journal.Journal;
3131
import org.exist.util.Configuration;

exist-core/src/main/java/org/exist/webstart/JnlpJarFiles.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333

3434
import org.apache.logging.log4j.LogManager;
3535
import org.apache.logging.log4j.Logger;
36-
import org.exist.start.LatestFileResolver;
3736
import org.exist.util.FileUtils;
3837

3938
/**

exist-start/src/main/java/org/exist/start/LatestFileResolver.java renamed to exist-core/src/main/java/org/exist/webstart/LatestFileResolver.java

Lines changed: 34 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -19,62 +19,61 @@
1919
* License along with this library; if not, write to the Free Software
2020
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2121
*/
22-
package org.exist.start;
22+
package org.exist.webstart;
23+
24+
import org.apache.logging.log4j.LogManager;
25+
import org.apache.logging.log4j.Logger;
26+
import org.exist.util.FileUtils;
2327

2428
import java.io.File;
2529
import java.io.IOException;
2630
import java.nio.file.Path;
2731
import java.nio.file.Paths;
28-
import java.util.Collections;
2932
import java.util.List;
3033
import java.util.regex.Matcher;
3134
import java.util.regex.Pattern;
3235

36+
import static org.exist.util.FileUtils.fileName;
37+
3338
/**
3439
* This class uses regex pattern matching to find the latest version of a
35-
* particular jar file.
36-
*
37-
* @see LatestFileResolver#getResolvedFileName(String)
38-
*
40+
* particular jar file.
41+
*
3942
* @author Ben Schmaus ([email protected])
4043
* @version $Revision$
44+
* @see org.exist.webstart.LatestFileResolver#getResolvedFileName(String)
4145
*/
4246
public class LatestFileResolver {
4347

48+
private static final Logger LOGGER = LogManager.getLogger();
49+
4450
// Pattern that can be used to indicate that the
4551
// latest version of a particular file should be added to the classpath.
4652
// E.g., commons-fileupload-%latest%.jar would resolve to something like
4753
// commons-fileupload-1.1.jar.
48-
private final static Pattern latestVersionPattern = Pattern.compile(
49-
"(%latest%)"
50-
);
51-
52-
// Set debug mode for each file resolver instance based on whether or
53-
// not the system was started with debugging turned on.
54-
private static boolean _debug = Boolean.getBoolean("exist.start.debug");
55-
54+
private static final Pattern LATEST_VERSION_PATTERN = Pattern.compile("(%latest%)");
55+
5656
/**
5757
* If the passed file name contains a %latest% token,
5858
* find the latest version of that file. Otherwise, return
5959
* the passed file name unmodified.
60-
*
60+
*
6161
* @param filename Path relative to exist home dir of
62-
* a jar file that should be added to the classpath.
62+
* a jar file that should be added to the classpath.
6363
* @return Resolved filename.
6464
*/
6565
public String getResolvedFileName(final String filename) {
66-
final Matcher matches = latestVersionPattern.matcher(filename);
66+
final Matcher matches = LATEST_VERSION_PATTERN.matcher(filename);
6767
if (!matches.find()) {
6868
return filename;
6969
}
70+
7071
final String[] fileinfo = filename.split("%latest%");
7172
// Path of file up to the beginning of the %latest% token.
7273
final String uptoToken = fileinfo[0];
7374

74-
// Dir that should contain our jar.
75-
final String containerDirName = uptoToken.substring(
76-
0, uptoToken.lastIndexOf(File.separatorChar)
77-
);
75+
// Directory that should contain our jar.
76+
final String containerDirName = uptoToken.substring(0, uptoToken.lastIndexOf(File.separatorChar));
7877

7978
final Path containerDir = Paths.get(containerDirName);
8079

@@ -84,35 +83,25 @@ public String getResolvedFileName(final String filename) {
8483
final Pattern pattern = Pattern.compile(patternString);
8584
final Matcher matcher = pattern.matcher("");
8685

87-
List<Path> jars;
8886
try {
89-
jars = Main.list(containerDir, p -> {
90-
matcher.reset(Main.fileName(p));
87+
final List<Path> jars = FileUtils.list(containerDir, p -> {
88+
matcher.reset(fileName(p));
9189
return matcher.find();
9290
});
93-
} catch (final IOException e) {
94-
System.err.println("ERROR: No jars found in " + containerDir.toAbsolutePath());
95-
e.printStackTrace();
96-
jars = Collections.emptyList();
97-
}
9891

99-
if (!jars.isEmpty()) {
100-
final String actualFileName = jars.getFirst().toAbsolutePath().toString();
101-
if (_debug) {
102-
System.err.println(
103-
"Found match: " + actualFileName
104-
+ " for jar file pattern: " + filename
105-
);
106-
}
107-
return actualFileName;
108-
} else {
109-
if (_debug) {
110-
System.err.println(
111-
"WARN: No latest version found for JAR file: '"
112-
+ filename + "'"
113-
);
92+
if (jars.isEmpty()) {
93+
LOGGER.warn("WARN: No latest version found for JAR file: '{}'", filename);
94+
95+
} else {
96+
final String actualFileName = jars.getFirst().toAbsolutePath().toString();
97+
LOGGER.debug("Found match: {} for jar file pattern: {}", actualFileName, filename);
98+
return actualFileName;
11499
}
100+
101+
} catch (final IOException e) {
102+
LOGGER.error("No jars found in {}. Reason: {}", containerDir.toAbsolutePath(), e.getMessage(), e);
115103
}
104+
116105
return filename;
117-
}
106+
}
118107
}

exist-distribution/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1057,7 +1057,7 @@
10571057
<identifier>org.exist.start.Main</identifier>
10581058
<mainClassName>org.exist.start.Main</mainClassName>
10591059
<executableName>eXist-JavaAppLauncher</executableName>
1060-
<jvmRequired>1.8</jvmRequired>
1060+
<jvmRequired>21</jvmRequired>
10611061
<minimumSystemVersion>10.9</minimumSystemVersion>
10621062
<version>${project.version}</version>
10631063
<shortVersion>${project.version}</shortVersion>

exist-parent/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
<jaxb.impl.version>4.0.2</jaxb.impl.version>
117117
<eclipse.angus-activation.version>2.0.2</eclipse.angus-activation.version>
118118
<jetty.version>11.0.25</jetty.version>
119-
<log4j.version>2.25.0</log4j.version>
119+
<log4j.version>2.25.1</log4j.version>
120120
<lucene.version>4.10.4</lucene.version>
121121
<milton.version>1.8.1.3</milton.version>
122122
<milton.servlet.version>1.8.1.3-jakarta5</milton.servlet.version>
@@ -126,7 +126,7 @@
126126
<xmlunit.version>2.10.3</xmlunit.version>
127127
<junit.version>4.13.2</junit.version>
128128
<junit.platform.version>1.13.4</junit.platform.version>
129-
<junit.jupiter.version>5.13.3</junit.jupiter.version>
129+
<junit.jupiter.version>5.13.4</junit.jupiter.version>
130130
<easymock.version>5.6.0</easymock.version>
131131
<objenesis.version>3.4</objenesis.version>
132132
<assertj.version>3.27.3</assertj.version>
@@ -235,13 +235,13 @@
235235
<dependency>
236236
<groupId>commons-codec</groupId>
237237
<artifactId>commons-codec</artifactId>
238-
<version>1.18.0</version>
238+
<version>1.19.0</version>
239239
</dependency>
240240

241241
<dependency>
242242
<groupId>commons-io</groupId>
243243
<artifactId>commons-io</artifactId>
244-
<version>2.19.0</version>
244+
<version>2.20.0</version>
245245
</dependency>
246246

247247
<dependency>

exist-service/src/main/java/org/exist/service/ExistDbDaemon.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class ExistDbDaemon implements Daemon {
3636
private String[] args = null;
3737

3838
private void init(final String args[]) {
39-
this.main = new Main("jetty");
39+
this.main = new Main(Main.MODE_JETTY);
4040
this.args = args;
4141
}
4242

@@ -65,12 +65,12 @@ public void start() throws Exception {
6565
runArgs[0] = MODE_JETTY;
6666
System.arraycopy(args, 0, runArgs, 1, args.length);
6767

68-
this.main.runEx(runArgs);
68+
this.main.startExistdb(runArgs);
6969
}
7070

7171
@Override
7272
public void stop() throws Exception {
73-
this.main.shutdownEx();
73+
this.main.shutdownExistdb();
7474
}
7575

7676
@Override

exist-start/pom.xml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@
7676
-->
7777
<excludes>
7878
<exclude>Mortbay-APACHE-2-license.template.txt</exclude>
79-
<exclude>src/main/java/org/exist/start/Classpath.java</exclude>
80-
<exclude>src/main/java/org/exist/start/Main.java</exclude>
81-
<exclude>src/main/java/org/exist/start/Version.java</exclude>
79+
<exclude>src/main/java/org/exist/start/classloader/Classpath.java</exclude>
8280
</excludes>
8381

8482
</licenseSet>
@@ -95,9 +93,7 @@ The original license statement is also included below.]]></preamble>
9593
</multi>
9694
<excludes />
9795
<includes>
98-
<include>src/main/java/org/exist/start/Classpath.java</include>
99-
<include>src/main/java/org/exist/start/Main.java</include>
100-
<include>src/main/java/org/exist/start/Version.java</include>
96+
<include>src/main/java/org/exist/start/classloader/Classpath.java</include>
10197
</includes>
10298
</licenseSet>
10399

exist-start/src/main/java/org/exist/start/CompatibleJavaVersionCheck.java

Lines changed: 48 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -24,37 +24,49 @@
2424
import java.util.Optional;
2525
import java.util.stream.Stream;
2626

27-
import static org.exist.start.CompatibleJavaVersionCheck.IncompatibleJavaVersion.IncompatibleJavaVersion;
27+
import static org.exist.start.CompatibleJavaVersionCheck.IncompatibleJavaVersion.create;
2828
import static org.exist.start.Main.ERROR_CODE_INCOMPATIBLE_JAVA_DETECTED;
2929

30+
/**
31+
* Helper class for checking OpenJDK compatibility.
32+
* <p>
33+
* eXist-db has been compiled with Java21 (state of 2025Q2).
34+
* <p>
35+
* Older versions of Java contained a number of (runtime) HotSpot compiler bugs that caused database corruptions.
36+
* These problematic versions are deprecated, and therefore, this class is not relevant anymore.
37+
* <p>
38+
* The code is kept for archival purposes and potential future re-usage.
39+
* <p>
40+
* ----------------------------
41+
* <p>
42+
* OpenJDK versions 12 through 15.0.1 suffer from a critical bug in the JIT C2 compiler that will
43+
* cause data loss in eXist-db. The problem has been reported to the OpenJDK community.
44+
* <p>
45+
* For more information, see:
46+
* - <a href="https://bugs.openjdk.java.net/browse/JDK-8253191">C2: Masked byte comparisons with large masks produce wrong result on x86</a>
47+
* - <a href="https://github.com/eXist-db/exist/issues/3375">eXist-db does not run correctly on JDKs 12, 13, 14 and 15 #3375</a>
48+
*
49+
*
50+
*/
3051
public class CompatibleJavaVersionCheck {
3152

3253
private static final IncompatibleJavaVersion[] INCOMPATIBLE_JAVA_VERSIONS = {
33-
IncompatibleJavaVersion(12),
34-
IncompatibleJavaVersion(13),
35-
IncompatibleJavaVersion(14),
36-
IncompatibleJavaVersion(15, 0, 2)
54+
create(12),
55+
create(13),
56+
create(14),
57+
IncompatibleJavaVersion.create(15, 0, 2),
3758
};
3859

3960
private static final String INCOMPATIBLE_JAVA_VERSION_NOTICE =
40-
"*****************************************************%n" +
41-
"Warning: Unreliable Java version has been detected!%n" +
42-
"%n" +
43-
"OpenJDK versions 12 through 15.0.1 suffer from a critical%n" +
44-
" bug in the JIT C2 compiler that will cause data loss in%n" +
45-
"eXist-db.%n" +
46-
"%n" +
47-
"The problem has been reported to the OpenJDK community.%n" +
48-
"%n" +
49-
"For more information, see:%n" +
50-
"\t* https://bugs.openjdk.java.net/browse/JDK-8253191%n" +
51-
"\t* https://github.com/eXist-db/exist/issues/3375%n" +
52-
"%n" +
53-
"The detected version of Java on your system is: %s.%n" +
54-
"%n" +
55-
"To prevent potential data loss, eXist-db will not be started.%n" +
56-
"To start eXist-db, we recommend using Java 8 or 11.%n" +
57-
"*****************************************************";
61+
"*****************************************************%n"
62+
+ "Incorrect version of Java detected!%n"
63+
+ "%n"
64+
+ "The detected version of Java on your system is: %s.%n"
65+
+ "%n"
66+
+ "eXist-db has been developed and qualified using Java 21.%n"
67+
+ "%n"
68+
+ "Newer versions of Java might or might not work correctly.%n"
69+
+ "*****************************************************";
5870

5971
private static final Optional<String> RUNTIME_JAVA_VERSION = Optional.ofNullable(System.getProperty("java.version"));
6072

@@ -71,16 +83,18 @@ public static void checkForCompatibleJavaVersion() throws StartException {
7183
static void checkForCompatibleJavaVersion(final Optional<String> checkJavaVersion) throws StartException {
7284
final Optional<int[]> maybeJavaVersionComponents = extractJavaVersionComponents(checkJavaVersion);
7385

74-
if (!maybeJavaVersionComponents.isPresent()) {
86+
if (maybeJavaVersionComponents.isEmpty()) {
7587
// Could not determine major java version, so best to let the user proceed...
7688
return;
7789
}
7890

7991
// check for incompatible java version
8092
final int[] javaVersionComponents = maybeJavaVersionComponents.get();
8193
final int majorJavaVersion = javaVersionComponents[0];
82-
/* @Nullable */ final Integer minorJavaVersion = javaVersionComponents.length > 1 ? javaVersionComponents[1] : null;
83-
/* @Nullable */ final Integer patchJavaVersion = javaVersionComponents.length > 2 ? javaVersionComponents[2] : null;
94+
/* @Nullable */
95+
final Integer minorJavaVersion = javaVersionComponents.length > 1 ? javaVersionComponents[1] : null;
96+
/* @Nullable */
97+
final Integer patchJavaVersion = javaVersionComponents.length > 2 ? javaVersionComponents[2] : null;
8498

8599
for (final IncompatibleJavaVersion incompatibleJavaVersion : INCOMPATIBLE_JAVA_VERSIONS) {
86100
// compare major versions
@@ -104,7 +118,8 @@ static void checkForCompatibleJavaVersion(final Optional<String> checkJavaVersio
104118
}
105119

106120
// version is NOT compatible!
107-
throw new StartException(ERROR_CODE_INCOMPATIBLE_JAVA_DETECTED, String.format(INCOMPATIBLE_JAVA_VERSION_NOTICE, RUNTIME_JAVA_VERSION));
121+
throw new StartException(ERROR_CODE_INCOMPATIBLE_JAVA_DETECTED,
122+
String.format(INCOMPATIBLE_JAVA_VERSION_NOTICE, RUNTIME_JAVA_VERSION.orElse("UKNOWN")));
108123
}
109124

110125
// version is compatible
@@ -131,22 +146,22 @@ static class IncompatibleJavaVersion {
131146
/* @Nullable */ final Integer lessThanMinor;
132147
/* @Nullable */ final Integer lessThanPatch;
133148

134-
private IncompatibleJavaVersion(final int major, /* @Nullable */ Integer lessThanMinor, /* @Nullable */ Integer lessThanPatch) {
149+
private IncompatibleJavaVersion(final int major, /* @Nullable */ final Integer lessThanMinor, /* @Nullable */ final Integer lessThanPatch) {
135150
this.major = major;
136151
this.lessThanMinor = lessThanMinor;
137152
this.lessThanPatch = lessThanPatch;
138153
}
139154

140-
public static IncompatibleJavaVersion IncompatibleJavaVersion(final int major, /* @Nullable */ Integer lessThanMinor, /* @Nullable */ Integer lessThanPatch) {
155+
public static IncompatibleJavaVersion create(final int major, /* @Nullable */ final Integer lessThanMinor, /* @Nullable */ final Integer lessThanPatch) {
141156
return new IncompatibleJavaVersion(major, lessThanMinor, lessThanPatch);
142157
}
143158

144-
public static IncompatibleJavaVersion IncompatibleJavaVersion(final int major, /* @Nullable */ Integer lessThanMinor) {
145-
return IncompatibleJavaVersion(major, lessThanMinor, null);
159+
public static IncompatibleJavaVersion create(final int major, /* @Nullable */ final Integer lessThanMinor) {
160+
return new IncompatibleJavaVersion(major, lessThanMinor, null);
146161
}
147162

148-
public static IncompatibleJavaVersion IncompatibleJavaVersion(final int major) {
149-
return IncompatibleJavaVersion(major, null, null);
163+
public static IncompatibleJavaVersion create(final int major) {
164+
return new IncompatibleJavaVersion(major, null, null);
150165
}
151166
}
152167
}

0 commit comments

Comments
 (0)