From bf74c97415d3543b2c089dd7ff1597a86d2fbaeb Mon Sep 17 00:00:00 2001 From: Christian Haeubl Date: Wed, 24 Jul 2024 17:18:13 +0200 Subject: [PATCH] Fixed a crash in InheritedChannel.inetPeerAddress0(). --- .../oracle/svm/hosted/jdk/JNIRegistrationJavaNet.java | 9 ++++++++- .../oracle/svm/hosted/jdk/JNIRegistrationJavaNio.java | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JNIRegistrationJavaNet.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JNIRegistrationJavaNet.java index 24d423df9ebc..4d468be6b12c 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JNIRegistrationJavaNet.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JNIRegistrationJavaNet.java @@ -50,7 +50,14 @@ class JNIRegistrationJavaNet extends JNIRegistrationUtil implements InternalFeat public void duringSetup(DuringSetupAccess a) { /* jdk.net.ExtendedSocketOptions is only available if the jdk.net module is loaded. */ this.hasPlatformSocketOptions = a.findClassByName("jdk.net.ExtendedSocketOptions$PlatformSocketOptions") != null; - initializeAtRunTime(a, "java.net.DatagramPacket", "java.net.InetAddress", "java.net.NetworkInterface", + initializeAtRunTime(a, "java.net.DatagramPacket", "java.net.NetworkInterface", + /* + * InetAddress would be enough ("initialized-at-runtime" is propagated to + * subclasses) but for documentation purposes we mention all subclasses + * anyway (each subclass has its own static constructor that calls native + * code). + */ + "java.net.InetAddress", "java.net.Inet4Address", "java.net.Inet6Address", /* Stores a default SSLContext in a static field. */ "javax.net.ssl.SSLContext"); diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JNIRegistrationJavaNio.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JNIRegistrationJavaNio.java index ae6935b3c5a3..f39aa6c7b3bc 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JNIRegistrationJavaNio.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JNIRegistrationJavaNio.java @@ -75,6 +75,7 @@ public void duringSetup(DuringSetupAccess a) { initializeAtRunTime(a, "sun.nio.ch.FileDispatcherImpl", "sun.nio.ch.FileChannelImpl$Unmapper"); if (isPosix()) { + initializeAtRunTime(a, "sun.nio.ch.InheritedChannel"); initializeAtRunTime(a, "sun.nio.ch.SimpleAsynchronousFileChannelImpl", "sun.nio.ch.SimpleAsynchronousFileChannelImpl$DefaultExecutorHolder", "sun.nio.ch.SinkChannelImpl", "sun.nio.ch.SourceChannelImpl"); initializeAtRunTime(a, "sun.nio.fs.UnixNativeDispatcher", "sun.nio.ch.UnixAsynchronousServerSocketChannelImpl");