This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git
The following commit(s) were added to refs/heads/master by this push:
new c0e32eae5 Add a null check for the class loader of OsgiUtils (#451)
c0e32eae5 is described below
commit c0e32eae54d0aa666e55108139e5cfe98b384f2d
Author: alumi <[email protected]>
AuthorDate: Wed Dec 13 02:13:14 2023 +0900
Add a null check for the class loader of OsgiUtils (#451)
---
src/main/java/org/apache/commons/compress/utils/OsgiUtils.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/commons/compress/utils/OsgiUtils.java
b/src/main/java/org/apache/commons/compress/utils/OsgiUtils.java
index 37506d2f4..f057c702b 100644
--- a/src/main/java/org/apache/commons/compress/utils/OsgiUtils.java
+++ b/src/main/java/org/apache/commons/compress/utils/OsgiUtils.java
@@ -27,8 +27,9 @@ public class OsgiUtils {
private static final boolean inOsgiEnvironment;
static {
- final Class<?> classLoaderClass =
OsgiUtils.class.getClassLoader().getClass();
- inOsgiEnvironment = isBundleReference(classLoaderClass);
+ inOsgiEnvironment = OsgiUtils.class.getClassLoader() != null
+ ? isBundleReference(OsgiUtils.class.getClassLoader().getClass())
+ : false;
}
private static boolean isBundleReference(final Class<?> clazz) {