diff --git a/common/src/main/java/net/adoptopenjdk/icedteaweb/jdk89access/JarIndexAccess.java b/common/src/main/java/net/adoptopenjdk/icedteaweb/jdk89access/JarIndexAccess.java index cba097c3e..ec9ee98c1 100644 --- a/common/src/main/java/net/adoptopenjdk/icedteaweb/jdk89access/JarIndexAccess.java +++ b/common/src/main/java/net/adoptopenjdk/icedteaweb/jdk89access/JarIndexAccess.java @@ -35,8 +35,8 @@ public class JarIndexAccess { LOG.debug(CLASS_SUN_MISC_JAR_INDEX + " not found - Running jdk9+ ?"); jarIndexClass = Class.forName(CLASS_JDK_INTERNAL_UTIL_JAR_JAR_INDEX); } catch (ClassNotFoundException exx) { - LOG.error(CLASS_JDK_INTERNAL_UTIL_JAR_JAR_INDEX + " not found"); - throw new RuntimeException("JarIndex not found!"); + LOG.debug(CLASS_JDK_INTERNAL_UTIL_JAR_JAR_INDEX + " not found"); + jarIndexClass = JarIndexDummy.class; } } } @@ -79,4 +79,18 @@ private LinkedList getImpl(final String replace) throws NoSuchMethodExce final Object o = method.invoke(parent, replace); return (LinkedList) o; } + + /** + * Because starting of JAVA 21 the JarIndex is no longer supported we provide a dummy implementation which always returns {@code null}. + */ + @SuppressWarnings("unused") + private static class JarIndexDummy { + public static Object getJarIndex(JarFile jar) { + return null; + } + + public Object get(String fileName) { + return null; + } + } }