# HG changeset patch # User andrew # Date 1622048542 -3600 # Node ID 63e69aef69973de3c4ee761e7ad78d5ed41901d5 # Parent 5216448557456ffc0eb12a5ccc86e1da26081227# Parent 18b7da5618f5131c79667359a861d2f62a8b6a53 Merge diff -r 521644855745 -r 63e69aef6997 make/lib/SecurityLibraries.gmk --- a/make/lib/SecurityLibraries.gmk Tue May 25 05:53:13 2021 +0100 +++ b/make/lib/SecurityLibraries.gmk Wed May 26 18:02:22 2021 +0100 @@ -133,6 +133,8 @@ endif ifneq ($(BUILD_LIBKRB5_NAME), ) + # libosxkrb5 needs to call deprecated krb5 APIs so that java + # can use the native credentials cache. $(eval $(call SetupNativeCompilation,BUILD_LIBKRB5, \ LIBRARY := $(BUILD_LIBKRB5_NAME), \ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \ diff -r 521644855745 -r 63e69aef6997 make/lib/ServiceabilityLibraries.gmk --- a/make/lib/ServiceabilityLibraries.gmk Tue May 25 05:53:13 2021 +0100 +++ b/make/lib/ServiceabilityLibraries.gmk Wed May 26 18:02:22 2021 +0100 @@ -53,7 +53,7 @@ EXCLUDE_FILES := $(LIBATTACH_EXCLUDE_FILES), \ LANG := C, \ OPTIMIZATION := LOW, \ - CFLAGS := $(CFLAGS_JDKLIB), \ + CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS), \ CFLAGS_windows := /Gy, \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libattach/mapfile-$(OPENJDK_TARGET_OS), \ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \ @@ -83,7 +83,7 @@ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/transport/socket, \ LANG := C, \ OPTIMIZATION := LOW, \ - CFLAGS := $(CFLAGS_JDKLIB) -DUSE_MMAP \ + CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) -DUSE_MMAP \ -I$(INCLUDEDIR) -I$(JDK_OUTPUTDIR)/include/$(OPENJDK_TARGET_OS) \ -I$(JDK_TOPDIR)/src/share/transport/socket \ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/transport/socket \ @@ -119,7 +119,7 @@ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/transport/shmem, \ LANG := C, \ OPTIMIZATION := LOW, \ - CFLAGS := $(CFLAGS_JDKLIB) -DUSE_MMAP \ + CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) -DUSE_MMAP \ -I$(INCLUDEDIR) -I$(JDK_OUTPUTDIR)/include/$(OPENJDK_TARGET_OS) \ -I$(JDK_TOPDIR)/src/share/transport/shmem \ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/transport/shmem \ @@ -148,7 +148,7 @@ SRC := $(JDK_TOPDIR)/src/share/back $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/back, \ LANG := C, \ OPTIMIZATION := LOW, \ - CFLAGS := $(CFLAGS_JDKLIB) -DJDWP_LOGGING \ + CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) -DJDWP_LOGGING \ -I$(JDK_TOPDIR)/src/share/transport/export \ -I$(JDK_TOPDIR)/src/share/back/export \ -I$(JDK_TOPDIR)/src/share/npt \ @@ -183,7 +183,7 @@ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/tracing/dtrace, \ LANG := C, \ OPTIMIZATION := LOW, \ - CFLAGS := $(CFLAGS_JDKLIB) \ + CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) \ -I$(JDK_TOPDIR)/src/share/native/sun/tracing/dtrace, \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjsdt/mapfile-vers, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ @@ -252,7 +252,7 @@ INCLUDE_FILES := $(LIBINSTRUMENT_FILES), \ LANG := C, \ OPTIMIZATION := LOW, \ - CFLAGS := $(LIBINSTRUMENT_CFLAGS), \ + CFLAGS := $(LIBINSTRUMENT_CFLAGS) $(CFLAGS_WARNINGS_ARE_ERRORS), \ CFLAGS_debug := -DJPLIS_LOGGING, \ CFLAGS_release := -DNO_JPLIS_LOGGING, \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libinstrument/mapfile-vers, \ @@ -327,7 +327,7 @@ EXCLUDE_FILES := $(BUILD_LIBMANAGEMENT_EXCLUDES), \ LANG := C, \ OPTIMIZATION := $(LIBMANAGEMENT_OPTIMIZATION), \ - CFLAGS := $(CFLAGS_JDKLIB) $(BUILD_LIBMANAGEMENT_CFLAGS), \ + CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) $(BUILD_LIBMANAGEMENT_CFLAGS), \ MAPFILE := $(LIBMANAGEMENT_MAPFILE), \ LDFLAGS := $(LDFLAGS_JDKLIB) \ $(call SET_SHARED_LIBRARY_ORIGIN), \ @@ -375,7 +375,7 @@ SRC := $(BUILD_LIBHPROF_SRC), \ LANG := C, \ OPTIMIZATION := $(LIBHPROF_OPTIMIZATION), \ - CFLAGS := $(CFLAGS_JDKLIB) \ + CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) \ $(BUILD_LIBHPROF_CFLAGS), \ CFLAGS_debug := -DHPROF_LOGGING, \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libhprof/mapfile-vers, \ @@ -403,7 +403,7 @@ SRC := $(JDK_TOPDIR)/src/share/demo/jvmti/java_crw_demo, \ LANG := C, \ OPTIMIZATION := LOW, \ - CFLAGS := $(CFLAGS_JDKLIB) \ + CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) \ -I$(JDK_TOPDIR)/src/share/demo/jvmti/java_crw_demo, \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjava_crw_demo/mapfile-vers, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ @@ -430,7 +430,7 @@ SRC := $(JDK_TOPDIR)/src/closed/share/native/oracle/jfr, \ LANG := C, \ OPTIMIZATION := LOW, \ - CFLAGS := $(CFLAGS_JDKLIB) \ + CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) \ -I$(JDK_TOPDIR)/src/closed/share/javavm/export, \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjfr/mapfile-vers, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ diff -r 521644855745 -r 63e69aef6997 src/macosx/native/sun/osxapp/ThreadUtilities.m --- a/src/macosx/native/sun/osxapp/ThreadUtilities.m Tue May 25 05:53:13 2021 +0100 +++ b/src/macosx/native/sun/osxapp/ThreadUtilities.m Wed May 26 18:02:22 2021 +0100 @@ -36,7 +36,7 @@ static jobject appkitThreadGroup = NULL; static BOOL awtEmbedded = NO; -inline void attachCurrentThread(void** env) { +static inline void attachCurrentThread(void** env) { if ([NSThread isMainThread]) { JavaVMAttachArgs args; args.version = JNI_VERSION_1_4; diff -r 521644855745 -r 63e69aef6997 src/share/back/SDE.c --- a/src/share/back/SDE.c Tue May 25 05:53:13 2021 +0100 +++ b/src/share/back/SDE.c Wed May 26 18:02:22 2021 +0100 @@ -48,8 +48,6 @@ #define BASE_STRATUM_NAME "Java" #define null NULL -#define true JNI_TRUE -#define false JNI_FALSE #define String char * #define private static @@ -147,7 +145,7 @@ defaultStratumId = null; defaultStratumIndex = -1; baseStratumIndex = -2; /* so as not to match -1 above */ - sourceMapIsValid = false; + sourceMapIsValid = JNI_FALSE; if (getSourceDebugExtension(clazz, &sourceDebugExtension) == JVMTI_ERROR_NONE) { @@ -667,7 +665,7 @@ jplsFilename = readLine(); defaultStratumId = readLine(); createJavaStratum(); - while (true) { + while (1) { if (sdeRead() != '*') { syntax("expected '*'"); } @@ -684,7 +682,7 @@ case 'E': /* set end points */ storeStratum("*terminator*"); - sourceMapIsValid = true; + sourceMapIsValid = JNI_TRUE; return; default: ignoreSection(); diff -r 521644855745 -r 63e69aef6997 src/share/back/eventHandler.c --- a/src/share/back/eventHandler.c Tue May 25 05:53:13 2021 +0100 +++ b/src/share/back/eventHandler.c Wed May 26 18:02:22 2021 +0100 @@ -1685,7 +1685,7 @@ eventHandler_createPermanentInternal(EventIndex ei, HandlerFunction func) { return createInternal(ei, func, NULL, - NULL, NULL, (jlocation)NULL, JNI_TRUE); + NULL, NULL, 0, JNI_TRUE); } HandlerNode * @@ -1694,7 +1694,7 @@ jthread thread) { return createInternal(ei, func, thread, - NULL, NULL, (jlocation)NULL, JNI_FALSE); + NULL, NULL, 0, JNI_FALSE); } HandlerNode * diff -r 521644855745 -r 63e69aef6997 src/share/back/log_messages.c --- a/src/share/back/log_messages.c Tue May 25 05:53:13 2021 +0100 +++ b/src/share/back/log_messages.c Wed May 26 18:02:22 2021 +0100 @@ -56,17 +56,24 @@ static void get_time_stamp(char *tbuf, size_t ltbuf) { - char format[MAXLEN_TIMESTAMP+1]; + char timestamp_prefix[MAXLEN_TIMESTAMP+1]; + char timestamp_postfix[MAXLEN_TIMESTAMP+1]; unsigned millisecs = 0; time_t t = 0; GETMILLSECS(millisecs); - if ( time(&t) == (time_t)(-1) ) + if ( time(&t) == (time_t)(-1) ) { t = 0; - (void)strftime(format, sizeof(format), - /* Break this string up for SCCS's sake */ - "%" "d.%" "m.%" "Y %" "T.%%.3d %" "Z", localtime(&t)); - (void)snprintf(tbuf, ltbuf, format, (int)(millisecs)); + } + /* Break this up so that the format strings are string literals + and we avoid a compiler warning. */ + (void)strftime(timestamp_prefix, sizeof(timestamp_prefix), + "%d.%m.%Y %T", localtime(&t)); + (void)strftime(timestamp_postfix, sizeof(timestamp_postfix), + "%Z", localtime(&t)); + (void)snprintf(tbuf, ltbuf, + "%s.%.3d %s", timestamp_prefix, + (int)(millisecs), timestamp_postfix); } /* Get basename of filename */ @@ -175,7 +182,7 @@ "LOC=%s;PID=%d;THR=t@%d", location_stamp, (int)processPid, - (int)tid); + (int)(intptr_t)tid); /* Construct message string. */ va_start(ap, format); diff -r 521644855745 -r 63e69aef6997 src/share/classes/jdk/jfr/internal/JVM.java --- a/src/share/classes/jdk/jfr/internal/JVM.java Tue May 25 05:53:13 2021 +0100 +++ b/src/share/classes/jdk/jfr/internal/JVM.java Wed May 26 18:02:22 2021 +0100 @@ -177,6 +177,14 @@ */ public static native void log(int tagSetId, int level, String message); + /** + * Check whether the logger would output on the given level + * + * @param level on level + * @return {@literal true} if the logger would output on the given level + */ + public static native boolean shouldLog(int level); + /** * Subscribe to LogLevel updates for LogTag * @@ -524,4 +532,4 @@ * @return if it is time to perform a chunk rotation */ public native boolean shouldRotateDisk(); -} +} \ No newline at end of file diff -r 521644855745 -r 63e69aef6997 src/share/classes/jdk/jfr/internal/Logger.java --- a/src/share/classes/jdk/jfr/internal/Logger.java Tue May 25 05:53:13 2021 +0100 +++ b/src/share/classes/jdk/jfr/internal/Logger.java Wed May 26 18:02:22 2021 +0100 @@ -62,8 +62,6 @@ } public static boolean shouldLog(LogTag tag, LogLevel level) { - // Logging level is not initialized because of lack of Xlog support in jdk8, - // so this method returns true directly now. - return true; // TODO: level.level >= tag.tagSetLevel; + return JVM.shouldLog(level.level); } } diff -r 521644855745 -r 63e69aef6997 src/share/classes/jdk/jfr/internal/RequestEngine.java --- a/src/share/classes/jdk/jfr/internal/RequestEngine.java Tue May 25 05:53:13 2021 +0100 +++ b/src/share/classes/jdk/jfr/internal/RequestEngine.java Wed May 26 18:02:22 2021 +0100 @@ -67,7 +67,9 @@ } else { jvm.emitEvent(type.getId(), JVM.counterTime(), 0); } - Logger.log(LogTag.JFR_SYSTEM_EVENT, LogLevel.DEBUG, ()-> "Executed periodic hook for " + type.getLogName()); + if (Logger.shouldLog(LogTag.JFR_EVENT, LogLevel.DEBUG)) { + Logger.log(LogTag.JFR_SYSTEM_EVENT, LogLevel.DEBUG, ()-> "Executed periodic hook for " + type.getLogName()); + } } else { executeSecure(); } @@ -83,7 +85,9 @@ public Void run() { try { hook.run(); - Logger.log(LogTag.JFR_EVENT, LogLevel.DEBUG, ()-> "Executed periodic hook for " + type.getLogName()); + if (Logger.shouldLog(LogTag.JFR_EVENT, LogLevel.DEBUG)) { + Logger.log(LogTag.JFR_EVENT, LogLevel.DEBUG, ()-> "Executed periodic hook for " + type.getLogName()); + } } catch (Throwable t) { // Prevent malicious user to propagate exception callback in the wrong context Logger.log(LogTag.JFR_EVENT, LogLevel.WARN, "Exception occured during execution of period hook for " + type.getLogName()); diff -r 521644855745 -r 63e69aef6997 src/share/classes/sun/security/x509/AlgorithmId.java --- a/src/share/classes/sun/security/x509/AlgorithmId.java Tue May 25 05:53:13 2021 +0100 +++ b/src/share/classes/sun/security/x509/AlgorithmId.java Wed May 26 18:02:22 2021 +0100 @@ -589,6 +589,15 @@ || name.equalsIgnoreCase("SHA1/RSA")) { return AlgorithmId.sha1WithRSAEncryption_oid; } + if (name.equalsIgnoreCase("SHA256WithRSA")) { + return AlgorithmId.sha256WithRSAEncryption_oid; + } + if (name.equalsIgnoreCase("SHA384WithRSA")) { + return AlgorithmId.sha384WithRSAEncryption_oid; + } + if (name.equalsIgnoreCase("SHA512WithRSA")) { + return AlgorithmId.sha512WithRSAEncryption_oid; + } if (name.equalsIgnoreCase("SHA1withECDSA") || name.equalsIgnoreCase("ECDSA")) { return AlgorithmId.sha1WithECDSA_oid; diff -r 521644855745 -r 63e69aef6997 src/share/instrument/InvocationAdapter.c --- a/src/share/instrument/InvocationAdapter.c Tue May 25 05:53:13 2021 +0100 +++ b/src/share/instrument/InvocationAdapter.c Wed May 26 18:02:22 2021 +0100 @@ -373,7 +373,7 @@ * class name. The manifest is in UTF8 so need to convert to * modified UTF8 (see JNI spec). */ - oldLen = strlen(agentClass); + oldLen = (int)strlen(agentClass); newLen = modifiedUtf8LengthOfUtf8(agentClass, oldLen); /* * According to JVMS class name is represented as CONSTANT_Utf8_info, diff -r 521644855745 -r 63e69aef6997 src/share/instrument/PathCharsValidator.c --- a/src/share/instrument/PathCharsValidator.c Tue May 25 05:53:13 2021 +0100 +++ b/src/share/instrument/PathCharsValidator.c Wed May 26 18:02:22 2021 +0100 @@ -46,9 +46,9 @@ /* Compute the low-order mask for the characters in the given string */ static jlong lowMask(char* s) { - int n = strlen(s); + size_t n = strlen(s); jlong m = 0; - int i; + size_t i; for (i = 0; i < n; i++) { int c = (int)s[i]; if (c < 64) @@ -59,9 +59,9 @@ /* Compute the high-order mask for the characters in the given string */ static jlong highMask(char* s) { - int n = strlen(s); + size_t n = strlen(s); jlong m = 0; - int i; + size_t i; for (i = 0; i < n; i++) { int c = (int)s[i]; if ((c >= 64) && (c < 128)) @@ -168,7 +168,7 @@ * illegal characters. Returns 0 if only validate characters are present. */ int validatePathChars(const char* path) { - int i, n; + size_t i, n; /* initialize on first usage */ if (L_HEX == 0) { diff -r 521644855745 -r 63e69aef6997 src/share/native/com/sun/java/util/jar/pack/bands.cpp --- a/src/share/native/com/sun/java/util/jar/pack/bands.cpp Tue May 25 05:53:13 2021 +0100 +++ b/src/share/native/com/sun/java/util/jar/pack/bands.cpp Wed May 26 18:02:22 2021 +0100 @@ -288,7 +288,7 @@ { e_##name, #name, /*debug only*/ \ cspec, ix } -const band_init all_band_inits[] = { +const band_init all_band_inits[BAND_LIMIT+1] = { //BAND_INIT(archive_magic, BYTE1_spec, 0), //BAND_INIT(archive_header, UNSIGNED5_spec, 0), //BAND_INIT(band_headers, BYTE1_spec, 0), @@ -448,14 +448,8 @@ BAND_INIT(file_modtime, DELTA5_spec, 0), BAND_INIT(file_options, UNSIGNED5_spec, 0), //BAND_INIT(file_bits, BYTE1_spec, 0), -#ifndef PRODUCT - { 0, 0, 0, 0 } -#else - { 0, 0 } -#endif + { 0, NULL, 0, 0 } }; -#define NUM_BAND_INITS \ - (sizeof(all_band_inits)/sizeof(all_band_inits[0])) band* band::makeBands(unpacker* u) { band* tmp_all_bands = U_NEW(band, BAND_LIMIT); diff -r 521644855745 -r 63e69aef6997 src/share/native/sun/java2d/opengl/OGLContext.c --- a/src/share/native/sun/java2d/opengl/OGLContext.c Tue May 25 05:53:13 2021 +0100 +++ b/src/share/native/sun/java2d/opengl/OGLContext.c Wed May 26 18:02:22 2021 +0100 @@ -38,6 +38,8 @@ #include "GraphicsPrimitiveMgr.h" #include "Region.h" +#include "jvm.h" + /** * The following methods are implemented in the windowing system (i.e. GLX * and WGL) source files. diff -r 521644855745 -r 63e69aef6997 src/share/native/sun/security/jgss/wrapper/GSSLibStub.c --- a/src/share/native/sun/security/jgss/wrapper/GSSLibStub.c Tue May 25 05:53:13 2021 +0100 +++ b/src/share/native/sun/security/jgss/wrapper/GSSLibStub.c Wed May 26 18:02:22 2021 +0100 @@ -430,11 +430,11 @@ checkStatus(env, jobj, major, minor, "[GSSLibStub_canonicalizeName]"); if ((*env)->ExceptionCheck(env)) { - return (jlong) GSS_C_NO_NAME; + return ptr_to_jlong(GSS_C_NO_NAME); } return ptr_to_jlong(mnNameHdl); } - return (jlong) GSS_C_NO_NAME; + return ptr_to_jlong(GSS_C_NO_NAME); } /* diff -r 521644855745 -r 63e69aef6997 src/share/native/sun/security/krb5/nativeccache.c --- a/src/share/native/sun/security/krb5/nativeccache.c Tue May 25 05:53:13 2021 +0100 +++ b/src/share/native/sun/security/krb5/nativeccache.c Wed May 26 18:02:22 2021 +0100 @@ -25,6 +25,8 @@ #import "sun_security_krb5_Credentials.h" #import +#import +#import /* * Based largely on klist.c, diff -r 521644855745 -r 63e69aef6997 src/solaris/back/util_md.h --- a/src/solaris/back/util_md.h Tue May 25 05:53:13 2021 +0100 +++ b/src/solaris/back/util_md.h Wed May 26 18:02:22 2021 +0100 @@ -62,13 +62,13 @@ (((UNSIGNED_JINT)(x & 0xff000000)) >> 24)) #define HOST_TO_JAVA_LONG(x) \ ((x << 56) | \ - ((x & 0x000000000000ff00) << 40) | \ - ((x & 0x0000000000ff0000) << 24) | \ - ((x & 0x00000000ff000000) << 8) | \ - ((x & 0x000000ff00000000) >> 8) | \ - ((x & 0x0000ff0000000000) >> 24) | \ - ((x & 0x00ff000000000000) >> 40) | \ - (((UNSIGNED_JLONG)(x & 0xff00000000000000)) >> 56)) + ((x & 0x000000000000ff00LL) << 40) | \ + ((x & 0x0000000000ff0000LL) << 24) | \ + ((x & 0x00000000ff000000LL) << 8) | \ + ((x & 0x000000ff00000000LL) >> 8) | \ + ((x & 0x0000ff0000000000LL) >> 24) | \ + ((x & 0x00ff000000000000LL) >> 40) | \ + (((UNSIGNED_JLONG)(x & 0xff00000000000000ULL)) >> 56)) #define HOST_TO_JAVA_FLOAT(x) stream_encodeFloat(x) #define HOST_TO_JAVA_DOUBLE(x) stream_encodeDouble(x) diff -r 521644855745 -r 63e69aef6997 src/solaris/native/sun/awt/awt_Font.c --- a/src/solaris/native/sun/awt/awt_Font.c Tue May 25 05:53:13 2021 +0100 +++ b/src/solaris/native/sun/awt/awt_Font.c Wed May 26 18:02:22 2021 +0100 @@ -454,6 +454,7 @@ int32_t i, size; char *fontsetname = NULL; char *nativename = NULL; + Boolean doFree = FALSE; jobjectArray componentFonts = NULL; jobject peer = NULL; jobject fontDescriptor = NULL; @@ -493,8 +494,10 @@ if (!JNU_IsNull(env, fontDescriptorName)) { nativename = (char *) JNU_GetStringPlatformChars(env, fontDescriptorName, NULL); + doFree = TRUE; } else { nativename = ""; + doFree = FALSE; } fdata->flist[i].xlfd = malloc(strlen(nativename) @@ -502,7 +505,7 @@ jio_snprintf(fdata->flist[i].xlfd, strlen(nativename) + 10, nativename, size * 10); - if (nativename != NULL && nativename != "") + if (nativename != NULL && doFree) JNU_ReleaseStringPlatformChars(env, fontDescriptorName, (const char *) nativename); /* diff -r 521644855745 -r 63e69aef6997 src/solaris/native/sun/java2d/x11/X11SurfaceData.c --- a/src/solaris/native/sun/java2d/x11/X11SurfaceData.c Tue May 25 05:53:13 2021 +0100 +++ b/src/solaris/native/sun/java2d/x11/X11SurfaceData.c Wed May 26 18:02:22 2021 +0100 @@ -545,7 +545,7 @@ xsdo->cData = xsdo->configData->color_data; XShared_initSurface(env, xsdo, depth, width, height, drawable); - xsdo->xrPic = NULL; + xsdo->xrPic = None; #endif /* !HEADLESS */ } diff -r 521644855745 -r 63e69aef6997 src/solaris/native/sun/management/MacosxOperatingSystem.c --- a/src/solaris/native/sun/management/MacosxOperatingSystem.c Tue May 25 05:53:13 2021 +0100 +++ b/src/solaris/native/sun/management/MacosxOperatingSystem.c Wed May 26 18:02:22 2021 +0100 @@ -29,6 +29,7 @@ #include #include +#include "jvm.h" JNIEXPORT jdouble JNICALL Java_sun_management_OperatingSystemImpl_getSystemCpuLoad0 diff -r 521644855745 -r 63e69aef6997 src/solaris/native/sun/xawt/XToolkit.c --- a/src/solaris/native/sun/xawt/XToolkit.c Tue May 25 05:53:13 2021 +0100 +++ b/src/solaris/native/sun/xawt/XToolkit.c Wed May 26 18:02:22 2021 +0100 @@ -716,7 +716,7 @@ if (pollFds[0].revents) { // Events in X pipe update_poll_timeout(TIMEOUT_EVENTS); - PRINT2("performPoll(): TIMEOUT_EVENTS curPollTimeout = %ld \n", curPollTimeout); + PRINT2("performPoll(): TIMEOUT_EVENTS curPollTimeout = %d \n", curPollTimeout); } return TRUE; diff -r 521644855745 -r 63e69aef6997 src/windows/back/linker_md.c --- a/src/windows/back/linker_md.c Tue May 25 05:53:13 2021 +0100 +++ b/src/windows/back/linker_md.c Wed May 26 18:02:22 2021 +0100 @@ -33,6 +33,7 @@ #include #include #include +#include #include "sys.h" diff -r 521644855745 -r 63e69aef6997 src/windows/back/proc_md.h --- a/src/windows/back/proc_md.h Tue May 25 05:53:13 2021 +0100 +++ b/src/windows/back/proc_md.h Wed May 26 18:02:22 2021 +0100 @@ -27,6 +27,7 @@ #include #include +#include #define MUTEX_T int #define MUTEX_INIT 0 @@ -40,4 +41,4 @@ #define popen _popen #define pclose _pclose -#define sleep _sleep +#define sleep(s) Sleep((s)*1000) diff -r 521644855745 -r 63e69aef6997 test/com/sun/jdi/ShellScaffold.sh --- a/test/com/sun/jdi/ShellScaffold.sh Tue May 25 05:53:13 2021 +0100 +++ b/test/com/sun/jdi/ShellScaffold.sh Wed May 26 18:02:22 2021 +0100 @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -267,10 +267,10 @@ # treat them as control chars on mks (eg \t is tab) # Oops; windows mks really seems to want this cat line # to start in column 1 - if [ -w "$SystemRoot" ] ; then - tmpFile=$SystemRoot/tmp.$$ - elif [ -w "$SYSTEMROOT" ] ; then - tmpFile=$SYSTEMROOT/tmp.$$ + if [ -w "$Temp" ] ; then + tmpFile=$Temp/tmp.$$ + elif [ -w "$TEMP" ] ; then + tmpFile=$TEMP/tmp.$$ else tmpFile=tmp.$$ fi diff -r 521644855745 -r 63e69aef6997 test/java/awt/EventDispatchThread/HandleExceptionOnEDT/HandleExceptionOnEDT.java --- a/test/java/awt/EventDispatchThread/HandleExceptionOnEDT/HandleExceptionOnEDT.java Tue May 25 05:53:13 2021 +0100 +++ b/test/java/awt/EventDispatchThread/HandleExceptionOnEDT/HandleExceptionOnEDT.java Wed May 26 18:02:22 2021 +0100 @@ -89,9 +89,9 @@ Point fp = f.getLocationOnScreen(); r.mouseMove(fp.x + f.getWidth() / 2, fp.y + f.getHeight() / 2); Util.waitForIdle(r); - r.mousePress(InputEvent.BUTTON1_MASK); + r.mousePress(InputEvent.BUTTON1_DOWN_MASK); Util.waitForIdle(r); - r.mouseRelease(InputEvent.BUTTON2_MASK); + r.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); f.removeMouseListener(exceptionListener); if (!exceptionHandled) @@ -117,9 +117,9 @@ Point dp = d.getLocationOnScreen(); r.mouseMove(dp.x + d.getWidth() / 2, dp.y + d.getHeight() / 2); Util.waitForIdle(r); - r.mousePress(InputEvent.BUTTON1_MASK); + r.mousePress(InputEvent.BUTTON1_DOWN_MASK); Util.waitForIdle(r); - r.mouseRelease(InputEvent.BUTTON2_MASK); + r.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); d.removeMouseListener(exceptionListener); if (!exceptionHandled) @@ -141,9 +141,9 @@ mousePressed = false; r.mouseMove(fp.x + 50, fp.y + 50); Util.waitForIdle(r); - r.mousePress(InputEvent.BUTTON1_MASK); + r.mousePress(InputEvent.BUTTON1_DOWN_MASK); Util.waitForIdle(r); - r.mouseRelease(InputEvent.BUTTON1_MASK); + r.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); Util.waitForIdle(r); f.removeMouseListener(pressedListener); diff -r 521644855745 -r 63e69aef6997 test/java/awt/FontClass/CreateFont/DeleteFont.java --- a/test/java/awt/FontClass/CreateFont/DeleteFont.java Tue May 25 05:53:13 2021 +0100 +++ b/test/java/awt/FontClass/CreateFont/DeleteFont.java Wed May 26 18:02:22 2021 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,8 +21,11 @@ * questions. */ -import java.io.*; -import java.awt.*; +import java.io.ByteArrayInputStream; +import java.io.FileInputStream; +import java.io.InputStream; +import java.io.IOException; +import java.awt.Font; public class DeleteFont { @@ -55,19 +58,22 @@ if (!gotException) { throw new RuntimeException("No expected IOException"); } - badRead(-2, Font.TRUETYPE_FONT); - badRead(8193, Font.TRUETYPE_FONT); - badRead(-2, Font.TYPE1_FONT); - badRead(8193, Font.TYPE1_FONT); + badRead(-2, 16, Font.TYPE1_FONT); + badRead(8193, 14, Font.TYPE1_FONT); + + badRead(-2, 12, Font.TRUETYPE_FONT); + badRead(8193, 10, Font.TRUETYPE_FONT); // Make sure GC has a chance to clean up before we exit. System.gc(); System.gc(); + Thread.sleep(5000); + System.gc(); System.gc(); } - static void badRead(final int retval, int fontType) { + static void badRead(final int retval, final int multiple, int fontType) { int num = 2; - byte[] buff = new byte[16*8192]; // Multiple of 8192 is important. + byte[] buff = new byte[multiple*8192]; // Multiple of 8192 is important. for (int ct=0; ct= TIME_OUT) { - - // dont pollute other tests; increase the likelihood - // that rmid will go away if it did not exit already. - if (utility.equals(ACTIVATION)) { - RMID.shutdown(port); - } - TestLibrary.bomb(utilityToStart + " took too long to die..."); } else { diff -r 521644855745 -r 63e69aef6997 test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java --- a/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java Tue May 25 05:53:13 2021 +0100 +++ b/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java Wed May 26 18:02:22 2021 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,7 +58,7 @@ RMID rmid = null; try { - rmid = RMID.createRMID(true); + rmid = RMID.createRMID(); rmid.addArguments(new String[] { "-C-Djava.security.policy=" + TestParams.defaultGroupPolicy + diff -r 521644855745 -r 63e69aef6997 test/java/rmi/testlibrary/ActivationLibrary.java --- a/test/java/rmi/testlibrary/ActivationLibrary.java Tue May 25 05:53:13 2021 +0100 +++ b/test/java/rmi/testlibrary/ActivationLibrary.java Wed May 26 18:02:22 2021 +0100 @@ -102,68 +102,4 @@ } catch (NoSuchObjectException e) { } } - - /** cleanup after rmid */ - public static void rmidCleanup(RMID rmid) { - if (rmid != null) { - if (!ActivationLibrary.safeDestroy(rmid, SAFE_WAIT_TIME)) { - TestLibrary.bomb("rmid not destroyed in: " + - SAFE_WAIT_TIME + - " milliseconds"); - } - } - RMID.removeLog(); - } - - /** - * Invoke shutdown on rmid in a way that will not cause a test - * to hang. - * - * @return whether or not shutdown completed succesfully in the - * timeAllowed - */ - private static boolean safeDestroy(RMID rmid, long timeAllowed) { - DestroyThread destroyThread = new DestroyThread(rmid); - destroyThread.start(); - - try { - destroyThread.join(timeAllowed); - } catch (InterruptedException ie) { - Thread.currentThread().interrupt(); - } - - return destroyThread.shutdownSucceeded(); - } - - /** - * Thread class to handle the destruction of rmid - */ - private static class DestroyThread extends Thread { - private final RMID rmid; - private final int port; - private boolean succeeded = false; - - DestroyThread(RMID rmid) { - this.rmid = rmid; - this.port = rmid.getPort(); - this.setDaemon(true); - } - - public void run() { - if (RMID.lookupSystem(port) != null) { - rmid.destroy(); - synchronized (this) { - // flag that the test was able to shutdown rmid - succeeded = true; - } - mesg("finished destroying rmid"); - } else { - mesg("tried to shutdown when rmid was not running"); - } - } - - public synchronized boolean shutdownSucceeded() { - return succeeded; - } - } } diff -r 521644855745 -r 63e69aef6997 test/java/rmi/testlibrary/RMID.java --- a/test/java/rmi/testlibrary/RMID.java Tue May 25 05:53:13 2021 +0100 +++ b/test/java/rmi/testlibrary/RMID.java Wed May 26 18:02:22 2021 +0100 @@ -21,14 +21,11 @@ * questions. */ -/** - * - */ - import java.io.*; import java.rmi.*; import java.rmi.activation.*; import java.rmi.registry.*; +import java.util.concurrent.TimeoutException; /** * Utility class that creates an instance of rmid with a policy @@ -39,6 +36,14 @@ */ public class RMID extends JavaVM { + // TODO: adjust these based on the timeout factor + // such as jcov.sleep.multiplier; see start(long) method. + // Also consider the test.timeout.factor property (a float). + private static final long TIMEOUT_SHUTDOWN_MS = 60_000L; + private static final long TIMEOUT_DESTROY_MS = 10_000L; + private static final long STARTTIME_MS = 15_000L; + private static final long POLLTIME_MS = 100L; + private static final String SYSTEM_NAME = ActivationSystem.class.getName(); // "java.rmi.activation.ActivationSystem" @@ -140,15 +145,8 @@ * policy file. */ public static RMID createRMID() { - return createRMID(System.out, System.err, true); - } - - public static RMID createRMID(boolean debugExec) { - return createRMID(System.out, System.err, debugExec); - } - - public static RMID createRMID(OutputStream out, OutputStream err) { - return createRMID(out, err, true); + return createRMID(System.out, System.err, true, true, + TestLibrary.getUnusedRandomPort()); } public static RMID createRMID(OutputStream out, OutputStream err, @@ -173,24 +171,24 @@ /** - * Test RMID should be created with the createRMID method. + * Private constructor. RMID instances should be created + * using the static factory methods. */ - protected RMID(String classname, String options, String args, + private RMID(String classname, String options, String args, OutputStream out, OutputStream err, int port) { super(classname, options, args, out, err); this.port = port; } + /** + * Removes rmid's log file directory. + */ public static void removeLog() { - /* - * Remove previous log file directory before - * starting up rmid. - */ File f = new File(LOGDIR, log); if (f.exists()) { - mesg("removing rmid's old log file..."); + mesg("Removing rmid's old log file."); String[] files = f.list(); if (files != null) { @@ -199,8 +197,8 @@ } } - if (f.delete() != true) { - mesg("\t" + " unable to delete old log file."); + if (! f.delete()) { + mesg("Warning: unable to delete old log file."); } } } @@ -215,14 +213,6 @@ return TestLibrary.getExtraProperty("rmid.jcov.args",""); } - public void start() throws IOException { - start(10000); - } - - public void slowStart() throws IOException { - start(60000); - } - /** * Looks up the activation system in the registry on the given port, * returning its stub, or null if it's not present. This method differs from @@ -239,12 +229,24 @@ } } + /** + * Starts rmid and waits up to the default timeout period + * to confirm that it's running. + */ + public void start() throws IOException { + start(STARTTIME_MS); + } + + /** + * Starts rmid and waits up to the given timeout period + * to confirm that it's running. + */ public void start(long waitTime) throws IOException { // if rmid is already running, then the test will fail with // a well recognized exception (port already in use...). - mesg("starting rmid on port #" + port + "..."); + mesg("Starting rmid on port " + port + "."); super.start(); int slopFactor = 1; @@ -254,20 +256,17 @@ } catch (NumberFormatException ignore) {} waitTime = waitTime * slopFactor; - // We check several times (as many as provides passed waitTime) to - // see if Rmid is currently running. Waiting steps last 100 msecs. - final long rmidStartSleepTime = 100; + // We check several times, for a maximum of waitTime, until we have + // verified that rmid is running. do { - // Sleeping for another rmidStartSleepTime time slice. try { - Thread.sleep(Math.min(waitTime, rmidStartSleepTime)); + Thread.sleep(Math.min(waitTime, POLLTIME_MS)); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); - mesg("Thread interrupted while checking for start of Activation System. Giving up check."); - mesg("Activation System state unknown"); + mesg("Interrupted while starting activation system, giving up."); return; } - waitTime -= rmidStartSleepTime; + waitTime -= POLLTIME_MS; // Checking if rmid is present if (lookupSystem(port) != null) { @@ -279,7 +278,7 @@ * incorrect value. */ System.setProperty("java.rmi.activation.port", Integer.toString(port)); - mesg("finished starting rmid."); + mesg("Started successfully."); return; } else { if (waitTime > 0) { @@ -287,9 +286,15 @@ } } } while (waitTime > 0); - TestLibrary.bomb("start rmid failed... giving up", null); + TestLibrary.bomb("Failed to start rmid, giving up.", null); } + /** + * Destroys rmid and restarts it. Note that this does NOT clean up + * the log file, because it stores information about restartable + * and activatable objects that must be carried over to the new + * rmid instance. + */ public void restart() throws IOException { destroy(); start(); @@ -298,30 +303,35 @@ /** * Ask rmid to shutdown gracefully using a remote method call. * catch any errors that might occur from rmid not being present - * at time of shutdown invocation. - * - * Shutdown does not nullify possible references to the rmid - * process object (destroy does though). + * at time of shutdown invocation. If the remote call is + * successful, wait for the process to terminate. Return true + * if the process terminated, otherwise return false. */ - public static void shutdown(int port) { + private boolean shutdown() throws InterruptedException { + mesg("shutdown()"); + ActivationSystem system = lookupSystem(port); + if (system == null) { + mesg("lookupSystem() returned null"); + return false; + } try { - ActivationSystem system = lookupSystem(port); - - if (system == null) { - TestLibrary.bomb("reference to the activation system was null"); - } - + mesg("ActivationSystem.shutdown()"); system.shutdown(); - } catch (RemoteException re) { - mesg("shutting down the activation daemon failed"); } catch (Exception e) { - mesg("caught exception trying to shutdown rmid"); - mesg(e.getMessage()); + mesg("Caught exception from ActivationSystem.shutdown():"); e.printStackTrace(); } - mesg("testlibrary finished shutting down rmid"); + try { + waitFor(TIMEOUT_SHUTDOWN_MS); + mesg("Shutdown successful."); + return true; + } catch (TimeoutException ex) { + mesg("Shutdown timed out:"); + ex.printStackTrace(); + return false; + } } /** @@ -330,60 +340,46 @@ * if rmid is a child process of the current VM. */ public void destroy() { - // attempt graceful shutdown of the activation system - shutdown(port); + if (vm == null) { + throw new IllegalStateException("can't wait for RMID that isn't running"); + } - if (vm != null) { - try { - /* Waiting for distant RMID process to shutdown. - * Waiting is bounded at a hardcoded max of 60 secs (1 min). - * Waiting by steps of 200 msecs, thus at most 300 such attempts - * for termination of distant RMID process. If process is not - * known to be terminated properly after that time, - * we give up for a gracefull termination, and thus go for - * forcibly destroying the process. - */ - boolean vmEnded = false; - int waitingTrials = 0; - final int maxTrials = 300; - final long vmProcessEndWaitInterval = 200; - int vmExitValue; - do { - try { - Thread.sleep(vmProcessEndWaitInterval); - waitingTrials++; - vmExitValue = vm.exitValue(); - mesg("rmid exited on shutdown request"); - vmEnded = true; - } catch (IllegalThreadStateException illegal) { - mesg("RMID's process still not terminated after more than " + - (waitingTrials * vmProcessEndWaitInterval) + " milliseconds"); - } + // First, attempt graceful shutdown of the activation system. + try { + if (! shutdown()) { + // Graceful shutdown failed, use Process.destroy(). + mesg("Destroying RMID process."); + vm.destroy(); + try { + waitFor(TIMEOUT_DESTROY_MS); + mesg("Destroy successful."); + } catch (TimeoutException ex) { + mesg("Destroy timed out, giving up."); + ex.printStackTrace(); } - while (!vmEnded && - (waitingTrials < maxTrials)); - - if (waitingTrials >= maxTrials) { - mesg("RMID's process still not terminated after more than " + - (waitingTrials * vmProcessEndWaitInterval) + " milliseconds." + - "Givinp up gracefull termination..."); - mesg("destroying RMID's process using Process.destroy()"); - super.destroy(); - } + } + } catch (InterruptedException ie) { + mesg("Shutdown/destroy interrupted, giving up."); + ie.printStackTrace(); + Thread.currentThread().interrupt(); + return; + } - } catch (InterruptedException ie) { - Thread.currentThread().interrupt(); - mesg("Thread interrupted while checking for termination of distant rmid vm. Giving up check."); - } catch (Exception e) { - mesg("caught unexpected exception trying to destroy rmid: " + - e.getMessage()); - e.printStackTrace(); - } - - // rmid will not restart if its process is not null - vm = null; - } + vm = null; } - public int getPort() {return port;} + /** + * Shuts down rmid and then removes its log file. + */ + public void cleanup() { + destroy(); + RMID.removeLog(); + } + + /** + * Gets the port on which this rmid is listening. + */ + public int getPort() { + return port; + } } diff -r 521644855745 -r 63e69aef6997 test/javax/accessibility/6192422/bug6192422.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/accessibility/6192422/bug6192422.java Wed May 26 18:02:22 2021 +0100 @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import javax.accessibility.Accessible; +import javax.accessibility.AccessibleContext; +import javax.accessibility.AccessibleRole; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.SwingUtilities; + +/** + * @test + * @bug 6192422 7106851 + * @key headful + * @summary Verifies fix for JMenuBar not being in the accessibility hierarchy + */ +public class bug6192422 { + + private static boolean foundJMenuBar = false; + + public static void main(String[] args) throws Throwable { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + if (!testIt()) { + throw new RuntimeException("JMenuBar was not found"); + } + } + }); + } + + /* + * Test whether JMenuBar is in accessibility hierarchy + */ + private static boolean testIt() { + + JFrame frame = new JFrame("bug6192422"); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + /* + * Add a menu bar to the frame using setJMenuBar. The setJMenuBar + * method add the menu bar to the JLayeredPane. + */ + JMenuBar menuBar = new JMenuBar(); + menuBar.add(new JMenu("foo")); + menuBar.add(new JMenu("bar")); + menuBar.add(new JMenu("baz")); + frame.setJMenuBar(menuBar); + + findJMenuBar(frame.getAccessibleContext()); + return foundJMenuBar; + } + + /* + * Finds the JMenuBar in the Accessibility hierarchy + */ + private static void findJMenuBar(AccessibleContext ac) { + if (ac != null) { + System.err.println("findJMenuBar: ac = "+ac.getClass()); + int num = ac.getAccessibleChildrenCount(); + System.err.println(" #children "+num); + + for (int i = 0; i < num; i++) { + System.err.println(" child #"+i); + Accessible a = ac.getAccessibleChild(i); + AccessibleContext child = a.getAccessibleContext(); + AccessibleRole role = child.getAccessibleRole(); + System.err.println(" role "+role); + if (role == AccessibleRole.MENU_BAR) { + foundJMenuBar = true; + return; + } + if (child.getAccessibleChildrenCount() > 0) { + findJMenuBar(child); + } + } + } + } +} diff -r 521644855745 -r 63e69aef6997 test/javax/swing/JComboBox/8032878/bug8032878.java --- a/test/javax/swing/JComboBox/8032878/bug8032878.java Tue May 25 05:53:13 2021 +0100 +++ b/test/javax/swing/JComboBox/8032878/bug8032878.java Wed May 26 18:02:22 2021 +0100 @@ -22,13 +22,10 @@ */ /* @test - * @bug 8032878 + * @bug 8032878 8078855 * @summary Checks that JComboBox as JTable cell editor processes key events * even where setSurrendersFocusOnKeystroke flag in JTable is false and * that it does not lose the first key press where the flag is true. - * @library ../../regtesthelpers - * @build Util - * @author Alexey Ivanov * @run main bug8032878 */ @@ -36,6 +33,7 @@ import java.awt.event.KeyEvent; import javax.swing.*; import javax.swing.text.JTextComponent; +import javax.swing.plaf.metal.MetalLookAndFeel; public class bug8032878 implements Runnable { private static final String ONE = "one"; @@ -53,6 +51,8 @@ private volatile String text; public static void main(String[] args) throws Exception { + UIManager.setLookAndFeel(new MetalLookAndFeel()); + final bug8032878 test = new bug8032878(); test.test(false); @@ -81,6 +81,7 @@ frame.pack(); frame.setVisible(true); + frame.setLocationRelativeTo(null); } private void test(final boolean flag) throws Exception { @@ -88,11 +89,13 @@ surrender = flag; SwingUtilities.invokeAndWait(this); + robot.waitForIdle(); + robot.delay(1000); runTest(); checkResult(); } finally { if (frame != null) { - frame.dispose(); + SwingUtilities.invokeAndWait(() -> frame.dispose()); } } } @@ -100,12 +103,20 @@ private void runTest() throws Exception { robot.waitForIdle(); // Select 'one' - Util.hitKeys(robot, KeyEvent.VK_TAB); + robot.keyPress(KeyEvent.VK_TAB); + robot.keyRelease(KeyEvent.VK_TAB); + robot.waitForIdle(); + robot.keyPress(KeyEvent.VK_1); + robot.keyRelease(KeyEvent.VK_1); robot.waitForIdle(); - Util.hitKeys(robot, KeyEvent.VK_1); - Util.hitKeys(robot, KeyEvent.VK_2); - Util.hitKeys(robot, KeyEvent.VK_3); - Util.hitKeys(robot, KeyEvent.VK_ENTER); + robot.keyPress(KeyEvent.VK_2); + robot.keyRelease(KeyEvent.VK_2); + robot.waitForIdle(); + robot.keyPress(KeyEvent.VK_3); + robot.keyRelease(KeyEvent.VK_3); + robot.waitForIdle(); + robot.keyPress(KeyEvent.VK_ENTER); + robot.keyRelease(KeyEvent.VK_ENTER); robot.waitForIdle(); } diff -r 521644855745 -r 63e69aef6997 test/javax/swing/JScrollBar/bug4202954/bug4202954.java --- a/test/javax/swing/JScrollBar/bug4202954/bug4202954.java Tue May 25 05:53:13 2021 +0100 +++ b/test/javax/swing/JScrollBar/bug4202954/bug4202954.java Wed May 26 18:02:22 2021 +0100 @@ -53,8 +53,8 @@ if (rightScrollButton == null || bottomScrollButton == null) { String errMessage = "Test can't be executed: "; - errMessage = errMessage + rightScrollButton == null ? "can't find right button for horizontal scroll bar; " : "" - + bottomScrollButton == null ? "can't find bottom scroll button for vertical scroll bar" : ""; + errMessage = errMessage + (rightScrollButton == null ? "can't find right button for horizontal scroll bar; " : "" + + (bottomScrollButton == null ? "can't find bottom scroll button for vertical scroll bar" : "")); throw new RuntimeException(errMessage); } @@ -105,15 +105,25 @@ JButton button = Util.invokeOnEDT(new java.util.concurrent.Callable() { @Override public JButton call() throws Exception { - for (Component c: scrollBar.getComponents()) { - if (c instanceof JButton) { - Point p = c.getLocationOnScreen(); - if (p.x > minX && p.y > minY) { - return (JButton) c; - } - } - } - return null; + int currentXorY = 0; + JButton scrollButton = null; + for (Component c: scrollBar.getComponents()) { + if (c instanceof JButton) { + Point p = c.getLocationOnScreen(); + if (scrollBar.getOrientation() == Adjustable.VERTICAL){ + if (currentXorY <= p.y){ + currentXorY = p.y; + scrollButton = (JButton)c; + } + }else if (scrollBar.getOrientation() == Adjustable.HORIZONTAL){ + if (currentXorY <= p.x){ + currentXorY = p.x; + scrollButton = (JButton)c; + } + } + } + } + return scrollButton; } }); return button; diff -r 521644855745 -r 63e69aef6997 test/javax/swing/plaf/aqua/CustomComboBoxFocusTest.java --- a/test/javax/swing/plaf/aqua/CustomComboBoxFocusTest.java Tue May 25 05:53:13 2021 +0100 +++ b/test/javax/swing/plaf/aqua/CustomComboBoxFocusTest.java Wed May 26 18:02:22 2021 +0100 @@ -22,9 +22,11 @@ */ /* @test - @bug 8073001 + @bug 8073001 8081764 @summary Test verifies that combo box with custom editor renders focus ring around arrow button correctly. + @library /lib/testlibrary + @build jdk.testlibrary.OSInfo @run main CustomComboBoxFocusTest */ @@ -50,12 +52,17 @@ import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.SwingUtilities; +import jdk.testlibrary.OSInfo; public class CustomComboBoxFocusTest { private static CustomComboBoxFocusTest test = null; public static void main(String[] args) { + if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) { + System.out.println("Only Mac platform test. Test is skipped for other OS."); + return; + } try { SwingUtilities.invokeAndWait(new Runnable() { diff -r 521644855745 -r 63e69aef6997 test/sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java --- a/test/sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java Tue May 25 05:53:13 2021 +0100 +++ b/test/sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java Wed May 26 18:02:22 2021 +0100 @@ -309,6 +309,7 @@ String className = JavaProcess.class.getName(); String classPath = System.getProperty("test.classes"); ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + "-XX:+UsePerfData", "-Dtest.timeout.factor=" + System.getProperty("test.timeout.factor", "1.0"), "-cp", classPath, className, mainArgsIdentifier); OutputBuffer ob = ProcessTools.getOutput(pb.start());