get proper session ID in JDK 11 and newer
@@ -74,6 +74,15 @@ initAppOutputStreamGlobals(JNIEnv *jni)
//support for JDK 9, JDK 10
g_fid_AppOutputStream_socket = (*jni)->GetFieldID(jni, appOutputStreamClass, "socket", "Lsun/security/ssl/SSLSocketImpl;");
}
+ if (g_fid_AppOutputStream_socket == NULL) {
+ jboolean flag = (*jni)->ExceptionCheck(jni);
+ if (flag) (*jni)->ExceptionClear(jni);
+ //support for JDK 11 - 14
+ g_fid_AppOutputStream_socket = (*jni)->GetFieldID(jni, appOutputStreamClass, "this$0", "Lsun/security/ssl/SSLSocketImpl;");
+ if ( g_fid_AppOutputStream_socket != NULL) {
+ printf("g_fid_AppOutputStream_socket found\n");
+ }
+ }
if (g_fid_AppOutputStream_socket == NULL) {
jboolean flag = (*jni)->ExceptionCheck(jni);
if (flag) (*jni)->ExceptionClear(jni);
@@ -97,6 +106,15 @@ initAppInputStreamGlobals(JNIEnv *jni)
//support for JDK 9, JDK 10
g_fid_AppInputStream_socket = (*jni)->GetFieldID(jni, appInputStreamClass, "socket", "Lsun/security/ssl/SSLSocketImpl;");
}
+ if (g_fid_AppInputStream_socket == NULL) {
+ jboolean flag = (*jni)->ExceptionCheck(jni);
+ if (flag) (*jni)->ExceptionClear(jni);
+ //support for JDK 11 - 14
+ g_fid_AppInputStream_socket = (*jni)->GetFieldID(jni, appInputStreamClass, "this$0", "Lsun/security/ssl/SSLSocketImpl;");
+ if ( g_fid_AppInputStream_socket != NULL) {
+ printf("g_fid_AppInputStream_socket found\n");
+ }
+ }
if (g_fid_AppInputStream_socket == NULL) {
jboolean flag = (*jni)->ExceptionCheck(jni);
if (flag) (*jni)->ExceptionClear(jni);
