Skip to content

Commit e655d07

Browse files
authored
Merge pull request #925 from AdoptOpenJDK/addJarIndexDummy
add a dummy implementation of JarIndex to support Java 21+
2 parents 111e0fd + b2fb142 commit e655d07

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

common/src/main/java/net/adoptopenjdk/icedteaweb/jdk89access/JarIndexAccess.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ public class JarIndexAccess {
3535
LOG.debug(CLASS_SUN_MISC_JAR_INDEX + " not found - Running jdk9+ ?");
3636
jarIndexClass = Class.forName(CLASS_JDK_INTERNAL_UTIL_JAR_JAR_INDEX);
3737
} catch (ClassNotFoundException exx) {
38-
LOG.error(CLASS_JDK_INTERNAL_UTIL_JAR_JAR_INDEX + " not found");
39-
throw new RuntimeException("JarIndex not found!");
38+
LOG.debug(CLASS_JDK_INTERNAL_UTIL_JAR_JAR_INDEX + " not found");
39+
jarIndexClass = JarIndexDummy.class;
4040
}
4141
}
4242
}
@@ -79,4 +79,18 @@ private LinkedList<String> getImpl(final String replace) throws NoSuchMethodExce
7979
final Object o = method.invoke(parent, replace);
8080
return (LinkedList<String>) o;
8181
}
82+
83+
/**
84+
* Because starting of JAVA 21 the JarIndex is no longer supported we provide a dummy implementation which always returns {@code null}.
85+
*/
86+
@SuppressWarnings("unused")
87+
private static class JarIndexDummy {
88+
public static Object getJarIndex(JarFile jar) {
89+
return null;
90+
}
91+
92+
public Object get(String fileName) {
93+
return null;
94+
}
95+
}
8296
}

0 commit comments

Comments
 (0)