This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push:
new 587939ae8a Only try and load the native library from CATALINA_HOME
when it is set
587939ae8a is described below
commit 587939ae8aaf4878356af4b61c23e9bac230e0a5
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Sep 2 07:47:06 2026 +0100
Only try and load the native library from CATALINA_HOME when it is set
---
java/org/apache/tomcat/jni/Library.java | 37 ++++++++++++++++++---------------
webapps/docs/changelog.xml | 4 ++++
2 files changed, 24 insertions(+), 17 deletions(-)
diff --git a/java/org/apache/tomcat/jni/Library.java
b/java/org/apache/tomcat/jni/Library.java
index 27a7a3a1e7..08ca5b7f99 100644
--- a/java/org/apache/tomcat/jni/Library.java
+++ b/java/org/apache/tomcat/jni/Library.java
@@ -35,26 +35,29 @@ public final class Library {
private Library() throws Exception {
boolean loaded = false;
StringBuilder err = new StringBuilder();
- File binLib = new File(System.getProperty(CATALINA_HOME_PROP), "bin");
- for (int i = 0; i < NAMES.length; i++) {
- File library = new File(binLib, System.mapLibraryName(NAMES[i]));
- try {
- System.load(library.getAbsolutePath());
- loaded = true;
- } catch (ThreadDeath | VirtualMachineError t) {
- throw t;
- } catch (Throwable t) {
- if (library.exists()) {
- // File exists but failed to load
+ String catalinaHome = System.getProperty(CATALINA_HOME_PROP);
+ if (catalinaHome != null) {
+ File binLib = new File(catalinaHome, "bin");
+ for (int i = 0; i < NAMES.length; i++) {
+ File library = new File(binLib,
System.mapLibraryName(NAMES[i]));
+ try {
+ System.load(library.getAbsolutePath());
+ loaded = true;
+ } catch (ThreadDeath | VirtualMachineError t) {
throw t;
+ } catch (Throwable t) {
+ if (library.exists()) {
+ // File exists but failed to load
+ throw t;
+ }
+ if (i > 0) {
+ err.append(", ");
+ }
+ err.append(t.getMessage());
}
- if (i > 0) {
- err.append(", ");
+ if (loaded) {
+ break;
}
- err.append(t.getMessage());
- }
- if (loaded) {
- break;
}
}
if (!loaded) {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 02a9a4b30f..89ef636b6b 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -182,6 +182,10 @@
Avoid HTTP/2 exceptions with invalid <code>content-length</code>
values. (remm)
</fix>
+ <fix>
+ Only try and load the native library from the
<code>CATALINA_HOME</code>
+ system property when the property is set. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Jasper">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]