Mercurial > hg > icedtea8-forest > jdk
changeset 13947:d4f84e96821f icedtea-3.12.0pre01
Merge jdk8u202-ga
line wrap: on
line diff
--- a/.hgtags Mon Mar 04 16:45:37 2019 +0000 +++ b/.hgtags Fri Apr 12 21:32:38 2019 +0100 @@ -998,6 +998,7 @@ 444b4528c8ecdd39b5923820fa2ed6d583808b5e jdk8u192-b01 e56bb18a4dff4c234c5949c750f910a1ed92fafe jdk8u192-b02 cadea780bc765ccca4aa919522e876b368c58145 jdk8u192-b03 +cadea780bc765ccca4aa919522e876b368c58145 jdk8u202-b00 b17237c1ab9c4670d939fef09a6bbecdecad824a jdk8u192-b04 fde7fd2a2fd225c4e2d469943b14ea84d3772853 jdk8u192-b05 4a23ff05b4f9f8a6345e8ae6c25ce0010db71249 jdk8u192-b06 @@ -1030,3 +1031,10 @@ f0611120a4b7deae2219f72c5919712f1662ad9b jdk8u201-b77 21ffcdd4d850dd240338c211bbeecb79c38e5403 jdk8u201-b08 34ade0cd2dd5fd9adb24afddd24e6958c1f492d1 icedtea-3.11.0 +9da3ff5cd435240bc4941bc1c2ca170c567e012f jdk8u202-b01 +478a4add975beb90696a4ead5f8fcd9c17fc1a83 jdk8u202-b02 +03719dd7706173821b51f42b20ac3cb040696a56 jdk8u202-b03 +d1d759924a534328146368d9be0e49168ace93eb jdk8u202-b04 +620927565284a2cc75bbc3a9bf583997ffb4ea63 jdk8u202-b05 +a7d761df5f2b2a3506516c876381cfb1cdee9387 jdk8u202-b06 +eab55c31ad236f6c601deb5620dc029e9f1b9a72 jdk8u202-b07
--- a/THIRD_PARTY_README Mon Mar 04 16:45:37 2019 +0000 +++ b/THIRD_PARTY_README Fri Apr 12 21:32:38 2019 +0100 @@ -2880,35 +2880,6 @@ */ _____________________________ -Copyright notice for extutil.h: -Copyright 1989, 1998 The Open Group - -All Rights Reserved. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. -* -* Author: Jim Fulton, MIT The Open Group -* -* Xlib Extension-Writing Utilities -* -* This package contains utilities for writing the client API for various -* protocol extensions. THESE INTERFACES ARE NOT PART OF THE X STANDARD AND -* ARE SUBJECT TO CHANGE! -*/ - -_____________________________ Copyright notice for HPkeysym.h: /*
--- a/make/CompileJavaClasses.gmk Mon Mar 04 16:45:37 2019 +0000 +++ b/make/CompileJavaClasses.gmk Fri Apr 12 21:32:38 2019 +0100 @@ -170,10 +170,6 @@ EXCLUDES += sun/applet endif -ifdef OPENJDK - EXCLUDES += sun/java2d/cmm/kcms -endif - # Used on windows and macosx ifeq (, $(filter $(OPENJDK_TARGET_OS), windows macosx)) EXFILES += sun/awt/AWTCharset.java
--- a/make/CopyFiles.gmk Mon Mar 04 16:45:37 2019 +0000 +++ b/make/CopyFiles.gmk Fri Apr 12 21:32:38 2019 +0100 @@ -269,6 +269,15 @@ MACRO := copy-and-chmod)) COPY_FILES += $(COPY_MSVCR) $(COPY_MSVCP) + + ifneq ($(UCRT_DLL_DIR), ) + $(eval $(call SetupCopyFiles,COPY_UCRT_DLLS, \ + DEST := $(JDK_OUTPUTDIR)/bin, \ + FILES := $(wildcard $(UCRT_DLL_DIR)/*.dll), \ + MACRO := copy-and-chmod \ + )) + COPY_FILES += $(COPY_UCRT_DLLS) + endif endif ##########################################################################################
--- a/make/CopyIntoClasses.gmk Mon Mar 04 16:45:37 2019 +0000 +++ b/make/CopyIntoClasses.gmk Fri Apr 12 21:32:38 2019 +0100 @@ -179,22 +179,12 @@ ALL_META-INF_DIRS := $(ALL_META-INF_DIRS_share) endif -ifndef OPENJDK - ALL_META-INF_DIRS += $(JDK_TOPDIR)/src/closed/share/classes/sun/java2d/cmm/kcms/META-INF -endif - SRC_SERVICES_FILES := $(wildcard $(addsuffix /services/*, $(ALL_META-INF_DIRS))) ifdef OPENJDK SRC_SERVICES_FILES := $(filter-out %sun/dc/META-INF/services/sun.java2d.pipe.RenderingEngine, $(SRC_SERVICES_FILES)) - SRC_SERVICES_FILES := $(filter-out %sun/java2d/cmm/kcms/META-INF/services/sun.java2d.cmm.CMMServiceProvider, $(SRC_SERVICES_FILES)) else SRC_SERVICES_FILES := $(filter-out %sun/java2d/pisces/META-INF/services/sun.java2d.pipe.RenderingEngine, $(SRC_SERVICES_FILES)) - ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), linux-sparc) - SRC_SERVICES_FILES := $(filter-out %sun/java2d/cmm/kcms/META-INF/services/sun.java2d.cmm.CMMServiceProvider, $(SRC_SERVICES_FILES)) - else - SRC_SERVICES_FILES := $(filter-out %sun/java2d/cmm/lcms/META-INF/services/sun.java2d.cmm.CMMServiceProvider, $(SRC_SERVICES_FILES)) - endif endif # The number of services files are relatively few. If the increase in numbers, then
--- a/make/lib/Awt2dLibraries.gmk Mon Mar 04 16:45:37 2019 +0000 +++ b/make/lib/Awt2dLibraries.gmk Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2018, 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 @@ -606,9 +606,9 @@ debug_trace.c \ debug_util.c \ gnome_interface.c \ + gtk_interface.c \ gtk2_interface.c \ - gtk3_interface.c \ - gtk_interface.c \ + gtk3_interface.c \ swing_GTKEngine.c \ swing_GTKStyle.c \ rect.c \ @@ -1129,59 +1129,6 @@ ########################################################################################## ifndef OPENJDK - - BUILD_LIBKCMS_EXCLUDE_FILES := - ifeq ($(OPENJDK_TARGET_OS), windows) - BUILD_LIBKCMS_EXCLUDE_FILES += ukcpmgr.c unixmem.c - else - BUILD_LIBKCMS_EXCLUDE_FILES += cmmdll.c registry.c spxffile.c sysinfo.c winmem.c wkcpmgr.c - endif - - BUILD_LIBKCMS_FLAGS := $(CFLAGS_JDKLIB) - - ifeq ($(OPENJDK_TARGET_OS), solaris) - # This particular library uses a feature called PIC_CODE_SMALL (on solaris) - # implement it like this...since it's only used here - BUILD_LIBKCMS_FLAGS := $(patsubst -KPIC, -Kpic, $(BUILD_LIBKCMS_FLAGS)) - else ifeq ($(OPENJDK_TARGET_CPU_ARCH), ppc) - BUILD_LIBKCMS_FLAGS := $(patsubst -fPIC, -fpic, $(BUILD_LIBKCMS_FLAGS)) - endif - - $(eval $(call SetupNativeCompilation,BUILD_LIBKCMS, \ - LIBRARY := kcms, \ - OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \ - SRC := $(JDK_TOPDIR)/src/closed/share/native/sun/java2d/cmm/kcms, \ - LANG := C, \ - EXCLUDE_FILES := $(BUILD_LIBKCMS_EXCLUDE_FILES), \ - OPTIMIZATION := LOW, \ - CFLAGS := $(BUILD_LIBKCMS_FLAGS) \ - -DJAVACMM -DFUT_CALC_EX -DNO_FUT_GCONST, \ - CFLAGS_linux := -Wno-missing-field-initializers, \ - MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libkcms/mapfile-vers, \ - LDFLAGS := $(LDFLAGS_JDKLIB) \ - $(call SET_SHARED_LIBRARY_ORIGIN), \ - LDFLAGS_SUFFIX_linux := -lc -lpthread, \ - LDFLAGS_SUFFIX_solaris := -lc, \ - LDFLAGS_SUFFIX_windows := $(WIN_JAVA_LIB) advapi32.lib user32.lib version.lib, \ - LDFLAGS_SUFFIX_posix := -lm -ljava -ljvm, \ - VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/closed/share/native/sun/java2d/cmm/kcms/cmm.rc, \ - VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/closed/share/native/sun/java2d/cmm/kcms/cmm.rc, \ - RC_FLAGS := $(RC_FLAGS) \ - -D "JDK_FNAME=kcms.dll" \ - -D "JDK_INTERNAL_NAME=kcms" \ - -D "JDK_FTYPE=0x2L", \ - OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libkcms, \ - DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES))) - - $(BUILD_LIBKCMS): $(BUILD_LIBJAVA) - - BUILD_LIBRARIES += $(BUILD_LIBKCMS) - -endif - -########################################################################################## - -ifndef OPENJDK ifeq ($(OPENJDK_TARGET_OS), solaris) ifneq ($(OPENJDK_TARGET_CPU), x86_64)
--- a/make/lib/SoundLibraries.gmk Mon Mar 04 16:45:37 2019 +0000 +++ b/make/lib/SoundLibraries.gmk Fri Apr 12 21:32:38 2019 +0100 @@ -183,6 +183,10 @@ ifeq ($(OPENJDK_TARGET_CPU), aarch32) LIBJSOUND_CFLAGS += -DX_ARCH=X_AARCH32 endif + + ifeq ($(OPENJDK_TARGET_CPU), ppc64le) + LIBJSOUND_CFLAGS += -DX_ARCH=X_PPC64LE + endif endif LIBJSOUND_CFLAGS += -DEXTRA_SOUND_JNI_LIBS='"$(EXTRA_SOUND_JNI_LIBS)"'
--- a/make/mapfiles/libawt_xawt/mapfile-vers Mon Mar 04 16:45:37 2019 +0000 +++ b/make/mapfiles/libawt_xawt/mapfile-vers Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 2018, 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
--- a/make/mapfiles/libkcms/mapfile-vers Mon Mar 04 16:45:37 2019 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -# -# Copyright (c) 1997, 2013, 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. Oracle designates this -# particular file as subject to the "Classpath" exception as provided -# by Oracle in the LICENSE file that accompanied this code. -# -# 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. -# - -# Define public interface. - -SUNWprivate_1.1 { - global: - Java_sun_java2d_cmm_kcms_CMM_cmmGetTagSize; - Java_sun_java2d_cmm_kcms_CMM_cmmGetNumComponents; - Java_sun_java2d_cmm_kcms_CMM_cmmColorConvert; - Java_sun_java2d_cmm_kcms_CMM_cmmInit; - Java_sun_java2d_cmm_kcms_CMM_cmmCombineTransforms; - Java_sun_java2d_cmm_kcms_CMM_cmmGetTagData; - Java_sun_java2d_cmm_kcms_CMM_cmmSetTagData; - Java_sun_java2d_cmm_kcms_CMM_cmmGetProfileData; - Java_sun_java2d_cmm_kcms_CMM_cmmFreeProfile; - Java_sun_java2d_cmm_kcms_CMM_cmmTerminate; - Java_sun_java2d_cmm_kcms_CMM_cmmLoadProfile; - Java_sun_java2d_cmm_kcms_CMM_cmmGetTransform; - Java_sun_java2d_cmm_kcms_CMM_cmmFreeTransform; - Java_sun_java2d_cmm_kcms_CMM_cmmGetProfileSize; - - local: - *; -};
--- a/make/profile-includes.txt Mon Mar 04 16:45:37 2019 +0000 +++ b/make/profile-includes.txt Fri Apr 12 21:32:38 2019 +0100 @@ -321,7 +321,6 @@ jpeg \ jsound \ jsoundalsa \ - kcms \ mlib_image \ splashscreen \ t2k \
--- a/src/macosx/classes/java/util/prefs/MacOSXPreferences.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/macosx/classes/java/util/prefs/MacOSXPreferences.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2018, 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 @@ -47,27 +47,39 @@ private final String path; // User root and system root nodes - private static MacOSXPreferences userRoot = null; - private static MacOSXPreferences systemRoot = null; + private static volatile MacOSXPreferences userRoot; + private static volatile MacOSXPreferences systemRoot; // Returns user root node, creating it if necessary. // Called by MacOSXPreferencesFactory - static synchronized Preferences getUserRoot() { - if (userRoot == null) { - userRoot = new MacOSXPreferences(true); + static Preferences getUserRoot() { + MacOSXPreferences root = userRoot; + if (root == null) { + synchronized (MacOSXPreferences.class) { + root = userRoot; + if (root == null) { + userRoot = root = new MacOSXPreferences(true); + } + } } - return userRoot; + return root; } // Returns system root node, creating it if necessary. // Called by MacOSXPreferencesFactory - static synchronized Preferences getSystemRoot() { - if (systemRoot == null) { - systemRoot = new MacOSXPreferences(false); + static Preferences getSystemRoot() { + MacOSXPreferences root = systemRoot; + if (root == null) { + synchronized (MacOSXPreferences.class) { + root = systemRoot; + if (root == null) { + systemRoot = root = new MacOSXPreferences(false); + } + } } - return systemRoot; + return root; }
--- a/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java Fri Apr 12 21:32:38 2019 +0100 @@ -163,8 +163,6 @@ : this; } } - // ignore focus "lost" native request as it may mistakenly - // deactivate active window (see 8001161) if (globalFocusedWindow == this) { responder.handleWindowFocusEvent(parentWindowActive, null); } @@ -179,4 +177,18 @@ // another window. return globalFocusedWindow != null ? !globalFocusedWindow.isParentWindowActive() : true; } + + public void synthesizeWindowActivation(boolean doActivate) { + if (isParentWindowActive() != doActivate) { + handleWindowFocusEvent(doActivate); + } + } + + public static void updateGlobalFocusedWindow(CEmbeddedFrame newGlobalFocusedWindow) { + synchronized (classLock) { + if (newGlobalFocusedWindow.isParentWindowActive()) { + globalFocusedWindow = newGlobalFocusedWindow; + } + } + } }
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java Fri Apr 12 21:32:38 2019 +0100 @@ -146,6 +146,8 @@ @Override public boolean requestWindowFocus() { + CEmbeddedFrame.updateGlobalFocusedWindow(target); + target.synthesizeWindowActivation(true); return true; }
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2018, 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 @@ -1131,17 +1131,27 @@ } private void orderAboveSiblings() { - // Recursively pop up the windows from the very bottom, (i.e. root owner) so that - // the windows are ordered above their nearest owner; ancestors of the window, - // which is going to become 'main window', are placed above their siblings. CPlatformWindow rootOwner = getRootOwner(); - if (rootOwner.isVisible() && !rootOwner.isIconified()) { - rootOwner.execute(CWrapper.NSWindow::orderFront); - } + // Do not order child windows of iconified owner. if (!rootOwner.isIconified()) { final WindowAccessor windowAccessor = AWTAccessor.getWindowAccessor(); - orderAboveSiblingsImpl(windowAccessor.getOwnedWindows(rootOwner.target)); + Window[] windows = windowAccessor.getOwnedWindows(rootOwner.target); + + // No need to order windows if it doesn't own other windows and hence return + if (windows.length == 0) { + return; + } + + // Recursively pop up the windows from the very bottom, (i.e. root owner) so that + // the windows are ordered above their nearest owner; ancestors of the window, + // which is going to become 'main window', are placed above their siblings. + if (rootOwner.isVisible()) { + rootOwner.execute(CWrapper.NSWindow::orderFront); + } + + // Order child windows. + orderAboveSiblingsImpl(windows); } } @@ -1197,6 +1207,21 @@ } } + private Window getOwnerFrameOrDialog(Window window) { + Window owner = window.getOwner(); + while (owner != null && !(owner instanceof Frame || owner instanceof Dialog)) { + owner = owner.getOwner(); + } + return owner; + } + + private boolean isSimpleWindowOwnedByEmbeddedFrame() { + if (peer != null && peer.isSimpleWindow()) { + return (getOwnerFrameOrDialog(target) instanceof CEmbeddedFrame); + } + return false; + } + // ---------------------------------------------------------------------- // NATIVE CALLBACKS // ----------------------------------------------------------------------
--- a/src/macosx/native/sun/awt/AWTView.m Mon Mar 04 16:45:37 2019 +0000 +++ b/src/macosx/native/sun/awt/AWTView.m Fri Apr 12 21:32:38 2019 +0100 @@ -544,10 +544,14 @@ } -(BOOL) isCodePointInUnicodeBlockNeedingIMEvent: (unichar) codePoint { - if (((codePoint >= 0x3000) && (codePoint <= 0x303F)) || + if ((codePoint == 0x0024) || (codePoint == 0x00A3) || + (codePoint == 0x00A5) || + ((codePoint >= 0x20A3) && (codePoint <= 0x20BF)) || + ((codePoint >= 0x3000) && (codePoint <= 0x303F)) || ((codePoint >= 0xFF00) && (codePoint <= 0xFFEF))) { // Code point is in 'CJK Symbols and Punctuation' or - // 'Halfwidth and Fullwidth Forms' Unicode block. + // 'Halfwidth and Fullwidth Forms' Unicode block or + // currency symbols unicode return YES; } return NO;
--- a/src/macosx/native/sun/awt/AWTWindow.m Mon Mar 04 16:45:37 2019 +0000 +++ b/src/macosx/native/sun/awt/AWTWindow.m Fri Apr 12 21:32:38 2019 +0100 @@ -477,6 +477,20 @@ return isBlocked; } +- (BOOL) isSimpleWindowOwnedByEmbeddedFrame { + BOOL isSimpleWindowOwnedByEmbeddedFrame = NO; + + JNIEnv *env = [ThreadUtilities getJNIEnv]; + jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env]; + if (platformWindow != NULL) { + static JNF_MEMBER_CACHE(jm_isBlocked, jc_CPlatformWindow, "isSimpleWindowOwnedByEmbeddedFrame", "()Z"); + isSimpleWindowOwnedByEmbeddedFrame = JNFCallBooleanMethod(env, platformWindow, jm_isBlocked) == JNI_TRUE ? YES : NO; + (*env)->DeleteLocalRef(env, platformWindow); + } + + return isSimpleWindowOwnedByEmbeddedFrame; +} + // Tests whether the corresponding Java platform window is visible or not + (BOOL) isJavaPlatformWindowVisible:(NSWindow *)window { BOOL isVisible = NO; @@ -543,7 +557,7 @@ // NSWindow overrides - (BOOL) canBecomeKeyWindow { AWT_ASSERT_APPKIT_THREAD; - return self.isEnabled && IS(self.styleBits, SHOULD_BECOME_KEY); + return self.isEnabled && (IS(self.styleBits, SHOULD_BECOME_KEY) || [self isSimpleWindowOwnedByEmbeddedFrame]); } - (BOOL) canBecomeMainWindow {
--- a/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, 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 @@ -915,6 +915,7 @@ throw new IIOException(I18N.getString("BMPImageReader1")); } + break; case VERSION_4_8_BIT: switch((int)compression) {
--- a/src/share/classes/com/sun/java/swing/plaf/gtk/GTKEngine.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/share/classes/com/sun/java/swing/plaf/gtk/GTKEngine.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2018, 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 @@ -513,7 +513,7 @@ state = GTKLookAndFeel.synthStateToGTKStateType(state).ordinal(); int widget = getWidgetType(context.getComponent(), id).ordinal(); native_paint_slider(widget, state, shadowType.ordinal(), detail, - x - x0, y - y0, w, h, orientation.ordinal(), hasFocus); + x - x0, y - y0, w, h, orientation.ordinal(), hasFocus); } public void paintVline(Graphics g, SynthContext context, @@ -587,8 +587,8 @@ * Convenience method that delegates to finishPainting() with * caching enabled. */ - public void finishPainting() { - finishPainting(true); + public BufferedImage finishPainting() { + return finishPainting(true); } /** @@ -596,7 +596,7 @@ * BufferedImage from the offscreen buffer, (optionally) cache it, * and paint it. */ - public void finishPainting(boolean useCache) { + public BufferedImage finishPainting(boolean useCache) { DataBufferInt dataBuffer = new DataBufferInt(w0 * h0); // Note that stealData() requires a markDirty() afterwards // since we modify the data in it. @@ -610,11 +610,12 @@ dataBuffer, w0, h0, w0, bands, null); ColorModel cm = COLOR_MODELS[transparency - 1]; - Image img = new BufferedImage(cm, raster, false, null); + BufferedImage img = new BufferedImage(cm, raster, false, null); if (useCache) { cache.setImage(getClass(), null, w0, h0, cacheArgs, img); } graphics.drawImage(img, x0, y0, null); + return img; } /**
--- a/src/share/classes/com/sun/java/swing/plaf/gtk/GTKGraphicsUtils.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/share/classes/com/sun/java/swing/plaf/gtk/GTKGraphicsUtils.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2018, 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 @@ -47,32 +47,15 @@ return; } int componentState = context.getComponentState(); - if ((componentState & SynthConstants.DISABLED) == - SynthConstants.DISABLED){ - Color orgColor = g.getColor(); - g.setColor(context.getStyle().getColor(context, - GTKColorType.WHITE)); - x += 1; - y += 1; - super.paintText(context, g, text, x, y, mnemonicIndex); + String themeName = GTKLookAndFeel.getGtkThemeName(); + if (themeName != null && themeName.startsWith("blueprint") && + shouldShadowText(context.getRegion(), componentState)) { - g.setColor(orgColor); - x -= 1; - y -= 1; - super.paintText(context, g, text, x, y, mnemonicIndex); + g.setColor(Color.BLACK); + super.paintText(context, g, text, x+1, y+1, mnemonicIndex); + g.setColor(Color.WHITE); } - else { - String themeName = GTKLookAndFeel.getGtkThemeName(); - if (themeName != null && themeName.startsWith("blueprint") && - shouldShadowText(context.getRegion(), componentState)) { - - g.setColor(Color.BLACK); - super.paintText(context, g, text, x+1, y+1, mnemonicIndex); - g.setColor(Color.WHITE); - } - - super.paintText(context, g, text, x, y, mnemonicIndex); - } + super.paintText(context, g, text, x, y, mnemonicIndex); } /**
--- a/src/share/classes/com/sun/java/swing/plaf/gtk/GTKIconFactory.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/share/classes/com/sun/java/swing/plaf/gtk/GTKIconFactory.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2018, 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 @@ -214,6 +214,18 @@ Region region = context.getRegion(); GTKStyle style = (GTKStyle) context.getStyle(); + if (GTKLookAndFeel.is3() && region == Region.MENU) { + Object value = style.getClassSpecificValue("arrow-scaling"); + if (value instanceof Number) { + iconDimension = (int)(((Number) value).floatValue() * + (style.getFont(context).getSize2D() + + 2 * style.getClassSpecificIntValue(context, + "indicator-spacing", DEFAULT_ICON_SPACING))); + if (iconDimension > 0) { + return iconDimension; + } + } + } iconDimension = style.getClassSpecificIntValue(context, "indicator-size", (region == Region.CHECK_BOX_MENU_ITEM ||
--- a/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2018, 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 @@ -547,7 +547,7 @@ public Object createValue(UIDefaults table) { GTKStyleFactory factory = (GTKStyleFactory)getStyleFactory(); GTKStyle style = (GTKStyle)factory.getStyle(null, region); - return style.getFontForState(null); + return style.getDefaultFont(); } }
--- a/src/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2018, 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 @@ -26,6 +26,8 @@ import sun.awt.UNIXToolkit; +import sun.awt.ModalExclude; +import sun.awt.SunToolkit; import javax.swing.plaf.synth.*; import java.awt.*; import javax.swing.*; @@ -36,6 +38,7 @@ import com.sun.java.swing.plaf.gtk.GTKConstants.Orientation; import com.sun.java.swing.plaf.gtk.GTKConstants.PositionType; import com.sun.java.swing.plaf.gtk.GTKConstants.ShadowType; +import java.awt.image.BufferedImage; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -567,8 +570,10 @@ Region id = context.getRegion(); int gtkState = GTKLookAndFeel.synthStateToGTKState( id, context.getComponentState()); + boolean isHW = SunToolkit.getHeavyweightComponent( + context.getComponent()) instanceof ModalExclude; synchronized (UNIXToolkit.GTK_LOCK) { - if (ENGINE.paintCachedImage(g, x, y, w, h, id, gtkState)) { + if (ENGINE.paintCachedImage(g, x, y, w, h, id, gtkState, isHW)) { return; } ENGINE.startPainting(g, x, y, w, h, id, gtkState); @@ -582,7 +587,25 @@ style.getGTKColor(context, gtkState, GTKColorType.BACKGROUND), x + xThickness, y + yThickness, w - xThickness - xThickness, h - yThickness - yThickness); - ENGINE.finishPainting(); + BufferedImage img = ENGINE.finishPainting(); + if(!isHW) { + int border = img.getRGB(0, h / 2); + if (img != null && border == img.getRGB(w / 2, h / 2)) { + // fix no menu borders in Adwaita theme + Graphics g2 = img.getGraphics(); + Color c = new Color(border); + g2.setColor(new Color(Math.max((int) (c.getRed() * 0.8), 0), + Math.max((int) (c.getGreen() * 0.8), 0), + Math.max((int) (c.getBlue() * 0.8), 0))); + g2.drawLine(0, 0, w - 1, 0); + g2.drawLine(w - 1, 0, w - 1, h - 1); + g2.drawLine(0, h - 1, 0, 1); + g2.setColor(c.darker()); + g2.drawLine(w - 1, h - 1, 0, h - 1); + g2.dispose(); + g.drawImage(img, x, y, null); + } + } } } @@ -699,6 +722,17 @@ } else { h -= (insets.top + insets.bottom); } + if (GTKLookAndFeel.is3()) { + if (id == Region.POPUP_MENU_SEPARATOR) { + detail = "menuitem"; + h -= (insets.top + insets.bottom); + } else { + detail = "separator"; + } + } else { + detail = orientation == JSeparator.HORIZONTAL ? + "hseparator" : "vseparator"; + } } synchronized (UNIXToolkit.GTK_LOCK) { @@ -788,16 +822,14 @@ boolean hasFocus = GTKLookAndFeel.is3() && ((context.getComponentState() & SynthConstants.FOCUSED) != 0); synchronized (UNIXToolkit.GTK_LOCK) { - if (! ENGINE.paintCachedImage(g, x, y, w, h, id, gtkState, dir, - hasFocus)) { + if (! ENGINE.paintCachedImage(g, x, y, w, h, id, gtkState, dir, hasFocus)) { Orientation orientation = (dir == JSlider.HORIZONTAL ? Orientation.HORIZONTAL : Orientation.VERTICAL); String detail = (dir == JSlider.HORIZONTAL ? "hscale" : "vscale"); ENGINE.startPainting(g, x, y, w, h, id, gtkState, dir); ENGINE.paintSlider(g, context, id, gtkState, - ShadowType.OUT, detail, x, y, w, h, orientation, - hasFocus); + ShadowType.OUT, detail, x, y, w, h, orientation, hasFocus); ENGINE.finishPainting(); } } @@ -1157,8 +1189,8 @@ Orientation orientation = (dir == JScrollBar.HORIZONTAL ? Orientation.HORIZONTAL : Orientation.VERTICAL); ENGINE.setRangeValue(context, id, value, min, max, visible); - ENGINE.paintSlider(g, context, id, gtkState, ShadowType.OUT, - "slider", x, y, w, h, orientation, false); + ENGINE.paintSlider(g, context, id, gtkState, + ShadowType.OUT, "slider", x, y, w, h, orientation, false); ENGINE.finishPainting(); } } @@ -1314,14 +1346,14 @@ Graphics g, int state, int x, int y, int w, int h) { ENGINE.paintExpander(g, context, Region.TREE, GTKLookAndFeel.synthStateToGTKState(context.getRegion(), state), - ExpanderStyle.EXPANDED, "treeview", x, y, w, h); + ExpanderStyle.EXPANDED, "expander", x, y, w, h); } public void paintTreeCollapsedIcon(SynthContext context, Graphics g, int state, int x, int y, int w, int h) { ENGINE.paintExpander(g, context, Region.TREE, GTKLookAndFeel.synthStateToGTKState(context.getRegion(), state), - ExpanderStyle.COLLAPSED, "treeview", x, y, w, h); + ExpanderStyle.COLLAPSED, "expander", x, y, w, h); } public void paintCheckBoxIcon(SynthContext context, @@ -1356,8 +1388,13 @@ if (gtkState == SynthConstants.MOUSE_OVER) { shadow = ShadowType.IN; } + if (!GTKLookAndFeel.is3()) { + x += 3; + y += 3; + w = h = 7; + } ENGINE.paintArrow(g, context, Region.MENU_ITEM, gtkState, shadow, - dir, "menuitem", x + 3, y + 3, 7, 7); + dir, "menuitem", x, y, w, h); } public void paintCheckBoxMenuItemCheckIcon(SynthContext context,
--- a/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2018, 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 @@ -277,7 +277,17 @@ return getColorForState(context, type); } + Font getDefaultFont() { + return font; + } + protected Font getFontForState(SynthContext context) { + Font propFont = UIManager + .getFont(context.getRegion().getName() + ".font"); + if (propFont != null) { + // if font property got a value then return it + return propFont; + } return font; } @@ -834,6 +844,12 @@ return indicatorSpacing + focusSize + focusPad; } else if (GTKLookAndFeel.is3() && "ComboBox.forceOpaque".equals(key)) { return true; + } else if ("Tree.expanderSize".equals(key)) { + Object value = getClassSpecificValue("expander-size"); + if (value instanceof Integer) { + return (Integer)value + 4; + } + return null; } // Is it a stock icon ? @@ -1116,7 +1132,6 @@ CLASS_SPECIFIC_MAP.put("Slider.thumbWidth", "slider-length"); CLASS_SPECIFIC_MAP.put("Slider.trackBorder", "trough-border"); CLASS_SPECIFIC_MAP.put("SplitPane.size", "handle-size"); - CLASS_SPECIFIC_MAP.put("Tree.expanderSize", "expander-size"); CLASS_SPECIFIC_MAP.put("ScrollBar.thumbHeight", "slider-width"); CLASS_SPECIFIC_MAP.put("ScrollBar.width", "slider-width"); CLASS_SPECIFIC_MAP.put("TextArea.caretForeground", "cursor-color");
--- a/src/share/classes/com/sun/jdi/connect/ListeningConnector.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/share/classes/com/sun/jdi/connect/ListeningConnector.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2018, 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 @@ -43,8 +43,8 @@ * {@link #startListening} may allow * multiple target VM to become connected. * - * @return <code>true</code> if multiple connections are supported; - * <code>false</code> otherwise. + * @return {@code true} if multiple connections are supported; + * {@code false} otherwise. */ boolean supportsMultipleConnections(); @@ -69,7 +69,7 @@ * {@link #accept} (using the same argument map as is passed to this * method). * <p> - * If <code>arguments</code> contains addressing information. and + * If {@code arguments} contains addressing information and * only one connection will be accepted, the {@link #accept accept} method * can be called immediately without calling this method. *
--- a/src/share/classes/com/sun/media/sound/DirectAudioDevice.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/share/classes/com/sun/media/sound/DirectAudioDevice.java Fri Apr 12 21:32:38 2019 +0100 @@ -557,14 +557,15 @@ getEventDispatcher().addLineMonitor(this); } - doIO = true; - - // need to set Active and Started - // note: the current API always requires that - // Started and Active are set at the same time... - if (isSource && stoppedWritten) { - setStarted(true); - setActive(true); + synchronized(lock) { + doIO = true; + // need to set Active and Started + // note: the current API always requires that + // Started and Active are set at the same time... + if (isSource && stoppedWritten) { + setStarted(true); + setActive(true); + } } if (Printer.trace) Printer.trace("<< DirectDL: implStart() succeeded"); @@ -591,10 +592,10 @@ // read/write thread, that's why isStartedRunning() // cannot be used doIO = false; + setActive(false); + setStarted(false); lock.notifyAll(); } - setActive(false); - setStarted(false); stoppedWritten = false; if (Printer.trace) Printer.trace(" << DirectDL: implStop() succeeded"); @@ -739,12 +740,14 @@ if ((long)off + (long)len > (long)b.length) { throw new ArrayIndexOutOfBoundsException(b.length); } - - if (!isActive() && doIO) { - // this is not exactly correct... would be nicer - // if the native sub system sent a callback when IO really starts - setActive(true); - setStarted(true); + synchronized(lock) { + if (!isActive() && doIO) { + // this is not exactly correct... would be nicer + // if the native sub system sent a callback when IO really + // starts + setActive(true); + setStarted(true); + } } int written = 0; while (!flushing) { @@ -969,11 +972,14 @@ if ((long)off + (long)len > (long)b.length) { throw new ArrayIndexOutOfBoundsException(b.length); } - if (!isActive() && doIO) { - // this is not exactly correct... would be nicer - // if the native sub system sent a callback when IO really starts - setActive(true); - setStarted(true); + synchronized(lock) { + if (!isActive() && doIO) { + // this is not exactly correct... would be nicer + // if the native sub system sent a callback when IO really + // starts + setActive(true); + setStarted(true); + } } int read = 0; while (doIO && !flushing) {
--- a/src/share/classes/com/sun/media/sound/EventDispatcher.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/share/classes/com/sun/media/sound/EventDispatcher.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2018, 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 @@ -319,7 +319,12 @@ * called from auto-closing clips when their closed() method is called */ void autoClosingClipClosed(AutoClosingClip clip) { - // nothing to do -- is removed from arraylist above + synchronized(autoClosingClips) { + int index = getAutoClosingClipIndex(clip); + if (index != -1) { + autoClosingClips.remove(index); + } + } }
--- a/src/share/classes/com/sun/media/sound/JavaSoundAudioClip.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/share/classes/com/sun/media/sound/JavaSoundAudioClip.java Fri Apr 12 21:32:38 2019 +0100 @@ -149,29 +149,31 @@ if (DEBUG || Printer.debug) Printer.debug("JavaSoundAudioClip.startImpl(loop="+loop+")"); try { if (clip != null) { - if (!clip.isOpen()) { - if (DEBUG || Printer.trace)Printer.trace("JavaSoundAudioClip: clip.open()"); - clip.open(loadedAudioFormat, loadedAudio, 0, loadedAudioByteLength); - } else { - if (DEBUG || Printer.trace)Printer.trace("JavaSoundAudioClip: clip.flush()"); - clip.flush(); - if (loop != clipLooping) { - // need to stop in case the looped status changed - if (DEBUG || Printer.trace)Printer.trace("JavaSoundAudioClip: clip.stop()"); - clip.stop(); + // We need to disable autoclosing mechanism otherwise the clip + // can be closed after "!clip.isOpen()" check, because of + // previous inactivity. + clip.setAutoClosing(false); + try { + if (!clip.isOpen()) { + clip.open(loadedAudioFormat, loadedAudio, 0, + loadedAudioByteLength); + } else { + clip.flush(); + if (loop != clipLooping) { + // need to stop in case the looped status changed + clip.stop(); + } } + clip.setFramePosition(0); + if (loop) { + clip.loop(Clip.LOOP_CONTINUOUSLY); + } else { + clip.start(); + } + clipLooping = loop; + } finally { + clip.setAutoClosing(true); } - clip.setFramePosition(0); - if (loop) { - if (DEBUG || Printer.trace)Printer.trace("JavaSoundAudioClip: clip.loop()"); - clip.loop(Clip.LOOP_CONTINUOUSLY); - } else { - if (DEBUG || Printer.trace)Printer.trace("JavaSoundAudioClip: clip.start()"); - clip.start(); - } - clipLooping = loop; - if (DEBUG || Printer.debug)Printer.debug("Clip should be playing/looping"); - } else if (datapusher != null ) { datapusher.start(loop); if (DEBUG || Printer.debug)Printer.debug("Stream should be playing/looping");
--- a/src/share/classes/com/sun/tools/jdi/GenericListeningConnector.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/share/classes/com/sun/tools/jdi/GenericListeningConnector.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, 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 @@ -109,8 +109,8 @@ throw new IllegalConnectorArgumentsException("Already listening", new ArrayList<String>(args.keySet())); } - listener = transportService.startListening(address); + updateArgumentMapIfRequired(args, listener); listenMap.put(args, listener); return listener.address(); } @@ -180,4 +180,8 @@ return transport; } + protected void updateArgumentMapIfRequired( + Map<String, ? extends Connector.Argument> args, TransportService.ListenKey listener) { + } + }
--- a/src/share/classes/com/sun/tools/jdi/InvokableTypeImpl.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/share/classes/com/sun/tools/jdi/InvokableTypeImpl.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2018, 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 @@ -236,15 +236,7 @@ final MethodImpl method, final ValueImpl[] args, final int options) { - /* - * Cache the values of args when TRACE_SENDS is enabled, for later printing. - * If not cached, printing causes a remote call while synchronized, and deadlock. - */ - if ((vm.traceFlags & VirtualMachineImpl.TRACE_SENDS) != 0) { - for (ValueImpl arg: args) { - arg.toString(); - } - } + CommandSender sender = getInvokeMethodSender(thread, method, args, options); PacketStream stream; if ((options & ClassType.INVOKE_SINGLE_THREADED) != 0) {
--- a/src/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2018, 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 @@ -1111,7 +1111,7 @@ this.genericSignatureGotten = true; } - private static boolean isPrimitiveArray(String signature) { + private static boolean isOneDimensionalPrimitiveArray(String signature) { int i = signature.lastIndexOf('['); /* * TO DO: Centralize JNI signature knowledge. @@ -1120,7 +1120,7 @@ * jdk1.4/doc/guide/jpda/jdi/com/sun/jdi/doc-files/signature.html */ boolean isPA; - if (i < 0) { + if (i < 0 || signature.startsWith("[[")) { isPA = false; } else { char c = signature.charAt(i + 1); @@ -1144,7 +1144,7 @@ ClassLoaderReferenceImpl loader = (ClassLoaderReferenceImpl)classLoader(); if ((loader == null) || - (isPrimitiveArray(signature)) //Work around 4450091 + (isOneDimensionalPrimitiveArray(signature)) //Work around 4450091 ) { // Caller wants type of boot class field type = vm.findBootType(signature);
--- a/src/share/classes/com/sun/tools/jdi/SocketListeningConnector.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/share/classes/com/sun/tools/jdi/SocketListeningConnector.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2018, 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 @@ -29,6 +29,7 @@ import java.util.Map; import java.util.HashMap; import java.io.IOException; +import com.sun.jdi.connect.spi.TransportService; /* * An ListeningConnector that uses the SocketTransportService @@ -92,4 +93,21 @@ public String description() { return getString("socket_listening.description"); } + + // If the port is auto detected update the argument map with the bound port number. + @Override + protected void updateArgumentMapIfRequired( + Map<String, ? extends Connector.Argument> args, TransportService.ListenKey listener) { + if (isWildcardPort(args)) { + String[] address = listener.address().split(":"); + if (address.length > 1) { + args.get(ARG_PORT).setValue(address[1]); + } + } + } + + private boolean isWildcardPort(Map<String, ? extends Connector.Argument> args) { + String port = args.get(ARG_PORT).value(); + return port.isEmpty() || Integer.valueOf(port) == 0; + } }
--- a/src/share/classes/com/sun/tools/jdi/VMState.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/share/classes/com/sun/tools/jdi/VMState.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2018, 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 @@ -39,12 +39,10 @@ /* * Certain information can be cached only when the entire VM is - * suspended and there are no pending resumes. The fields below - * are used to track whether there are pending resumes. (There - * is an assumption that JDWP command ids are increasing over time.) + * suspended and there are no pending resumes. The field below + * is used to track whether there are pending resumes. */ - private int lastCompletedCommandId = 0; // synchronized (this) - private int lastResumeCommandId = 0; // synchronized (this) + private final Set<Integer> pendingResumeCommands = Collections.synchronizedSet(new HashSet<>()); // This is cached only while the VM is suspended private static class Cache { @@ -92,12 +90,12 @@ * A JDWP command has been completed (reply has been received). * Update data that tracks pending resume commands. */ - synchronized void notifyCommandComplete(int id) { - lastCompletedCommandId = id; + void notifyCommandComplete(int id) { + pendingResumeCommands.remove(id); } synchronized void freeze() { - if (cache == null && (lastCompletedCommandId >= lastResumeCommandId)) { + if (cache == null && (pendingResumeCommands.isEmpty())) { /* * No pending resumes to worry about. The VM is suspended * and additional state can be cached. Notify all @@ -110,7 +108,7 @@ synchronized PacketStream thawCommand(CommandSender sender) { PacketStream stream = sender.send(); - lastResumeCommandId = stream.id(); + pendingResumeCommands.add(stream.id()); thaw(); return stream; }
--- a/src/share/classes/java/util/ResourceBundle.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/share/classes/java/util/ResourceBundle.java Fri Apr 12 21:32:38 2019 +0100 @@ -1398,10 +1398,18 @@ bundle = baseBundle; } + keepAlive(loader); return bundle; } /** + * Keeps the argument ClassLoader alive. + */ + private static void keepAlive(ClassLoader loader){ + // Do nothing. + } + + /** * Checks if the given <code>List</code> is not null, not empty, * not having null in its elements. */
--- a/src/share/classes/javax/swing/text/html/ImageView.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/share/classes/javax/swing/text/html/ImageView.java Fri Apr 12 21:32:38 2019 +0100 @@ -734,20 +734,6 @@ newState |= HEIGHT_FLAG; } - if (newWidth <= 0) { - newWidth = newImage.getWidth(imageObserver); - if (newWidth <= 0) { - newWidth = DEFAULT_WIDTH; - } - } - - if (newHeight <= 0) { - newHeight = newImage.getHeight(imageObserver); - if (newHeight <= 0) { - newHeight = DEFAULT_HEIGHT; - } - } - // Make sure the image starts loading: if ((newState & (WIDTH_FLAG | HEIGHT_FLAG)) != 0) { Toolkit.getDefaultToolkit().prepareImage(newImage, newWidth, @@ -909,6 +895,34 @@ changed |= 2; } + /** + * If the image properties (height and width) have been loaded, + * tehn figure out if scaling is necessary based on the + * specified HTML attributes. + */ + if (((flags & ImageObserver.HEIGHT) != 0) && + ((flags & ImageObserver.WIDTH) != 0)) { + double proportion = 0.0; + final int specifiedWidth = getIntAttr(HTML.Attribute.WIDTH, -1 ); + final int specifiedHeight = getIntAttr(HTML.Attribute.HEIGHT, -1); + /** + * If either of the attributes are not specified, then calculate the + * proportion for the specified dimension wrt actual value, and then + * apply the same proportion to the unspecified dimension as well, + * so that the aspect ratio of the image is maintained. + */ + if (specifiedWidth != -1 ^ specifiedHeight != -1) { + if (specifiedWidth <= 0) { + proportion = specifiedHeight / ((double)newHeight); + newWidth = (int)(proportion * newWidth); + } + if (specifiedHeight <= 0) { + proportion = specifiedWidth / ((double)newWidth); + newHeight = (int)(proportion * newHeight); + } + changed |= 3; + } + } synchronized(ImageView.this) { if ((changed & 1) == 1 && (state & HEIGHT_FLAG) == 0) { height = newHeight;
--- a/src/share/classes/sun/font/SunLayoutEngine.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/share/classes/sun/font/SunLayoutEngine.java Fri Apr 12 21:32:38 2019 +0100 @@ -35,6 +35,7 @@ import java.lang.ref.SoftReference; import java.util.concurrent.ConcurrentHashMap; import java.util.Locale; +import java.util.WeakHashMap; /* * different ways to do this @@ -149,12 +150,40 @@ this.key = key; } + static WeakHashMap<Font2D, Boolean> aatInfo = new WeakHashMap<>(); + + private boolean isAAT(Font2D font) { + Boolean aatObj; + synchronized (aatInfo) { + aatObj = aatInfo.get(font); + } + if (aatObj != null) { + return aatObj.booleanValue(); + } + boolean aat = false; + if (font instanceof TrueTypeFont) { + TrueTypeFont ttf = (TrueTypeFont)font; + aat = ttf.getDirectoryEntry(TrueTypeFont.morxTag) != null || + ttf.getDirectoryEntry(TrueTypeFont.mortTag) != null; + } else if (font instanceof PhysicalFont) { + PhysicalFont pf = (PhysicalFont)font; + aat = pf.getTableBytes(TrueTypeFont.morxTag) != null || + pf.getTableBytes(TrueTypeFont.mortTag) != null; + } + synchronized (aatInfo) { + aatInfo.put(font, Boolean.valueOf(aat)); + } + return aat; + } + public void layout(FontStrikeDesc desc, float[] mat, int gmask, int baseIndex, TextRecord tr, int typo_flags, Point2D.Float pt, GVData data) { Font2D font = key.font(); FontStrike strike = font.getStrike(desc); - long layoutTables = font.getLayoutTableCache(); + // Ignore layout tables for RTL AAT fonts due to lack of support in ICU + long layoutTables = (((typo_flags & 0x80000000) != 0) && isAAT(font)) ? 0 : + font.getLayoutTableCache(); nativeLayout(font, strike, mat, gmask, baseIndex, tr.text, tr.start, tr.limit, tr.min, tr.max, key.script(), key.lang(), typo_flags, pt, data,
--- a/src/share/classes/sun/font/TrueTypeFont.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/share/classes/sun/font/TrueTypeFont.java Fri Apr 12 21:32:38 2019 +0100 @@ -79,6 +79,7 @@ public static final int GPOSTag = 0x47504F53; // 'GPOS' public static final int GSUBTag = 0x47535542; // 'GSUB' public static final int mortTag = 0x6D6F7274; // 'mort' + public static final int morxTag = 0x6D6F7278; // 'morx' /* -- Tags for non-standard tables */ public static final int fdscTag = 0x66647363; // 'fdsc' - gxFont descriptor
--- a/src/share/classes/sun/security/jgss/krb5/Krb5InitCredential.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/share/classes/sun/security/jgss/krb5/Krb5InitCredential.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2018, 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 @@ -234,14 +234,13 @@ * @exception GSSException may be thrown */ public int getInitLifetime() throws GSSException { - int retVal = 0; Date d = getEndTime(); if (d == null) { return 0; } - retVal = (int)(d.getTime() - (new Date().getTime())); - return retVal/1000; + long retVal = d.getTime() - System.currentTimeMillis(); + return (int)(retVal/1000); } /**
--- a/src/share/classes/sun/security/krb5/KrbKdcRep.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/share/classes/sun/security/krb5/KrbKdcRep.java Fri Apr 12 21:32:38 2019 +0100 @@ -75,10 +75,11 @@ } } - // XXX Can renew a ticket but not ask for a renewable renewed ticket - // See impl of Credentials.renew(). - if (req.reqBody.kdcOptions.get(KDCOptions.RENEWABLE) != - rep.encKDCRepPart.flags.get(KDCOptions.RENEWABLE)) { + // Reply to a renewable request should be renewable, but if request does + // not contain renewable, KDC is free to issue a renewable ticket (for + // example, if ticket_lifetime is too big). + if (req.reqBody.kdcOptions.get(KDCOptions.RENEWABLE) && + !rep.encKDCRepPart.flags.get(KDCOptions.RENEWABLE)) { throw new KrbApErrException(Krb5.KRB_AP_ERR_MODIFIED); } if ((req.reqBody.from == null) || req.reqBody.from.isZero())
--- a/src/share/native/com/sun/media/sound/SoundDefs.h Mon Mar 04 16:45:37 2019 +0000 +++ b/src/share/native/com/sun/media/sound/SoundDefs.h Fri Apr 12 21:32:38 2019 +0100 @@ -43,17 +43,17 @@ #define X_ZERO 6 #define X_ARM 7 #define X_PPC 8 -#define X_ALPHA 9 -#define X_M68K 10 -#define X_MIPS 11 -#define X_MIPSEL 12 -#define X_PPC64 13 -#define X_S390 14 -#define X_S390X 15 -#define X_SH 16 -#define X_AARCH64 17 -#define X_PPC64LE 18 -#define X_AARCH32 19 +#define X_PPC64 9 +#define X_PPC64LE 10 +#define X_ALPHA 11 +#define X_M68K 12 +#define X_MIPS 13 +#define X_MIPSEL 14 +#define X_S390 15 +#define X_S390X 16 +#define X_SH 17 +#define X_AARCH64 18 +#define X_AARCH32 19 // ********************************** // Make sure you set X_PLATFORM and X_ARCH defines correctly.
--- a/src/solaris/bin/ppc64le/jvm.cfg Mon Mar 04 16:45:37 2019 +0000 +++ b/src/solaris/bin/ppc64le/jvm.cfg Fri Apr 12 21:32:38 2019 +0100 @@ -31,3 +31,4 @@ # and may not be available in a future release. # -server KNOWN +-client IGNORE
--- a/src/solaris/classes/java/util/prefs/FileSystemPreferences.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/solaris/classes/java/util/prefs/FileSystemPreferences.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2018, 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 @@ -88,14 +88,20 @@ /** * The user root. */ - static Preferences userRoot = null; + private static volatile Preferences userRoot; - static synchronized Preferences getUserRoot() { - if (userRoot == null) { - setupUserRoot(); - userRoot = new FileSystemPreferences(true); + static Preferences getUserRoot() { + Preferences root = userRoot; + if (root == null) { + synchronized (FileSystemPreferences.class) { + root = userRoot; + if (root == null) { + setupUserRoot(); + userRoot = root = new FileSystemPreferences(true); + } + } } - return userRoot; + return root; } private static void setupUserRoot() { @@ -149,14 +155,20 @@ /** * The system root. */ - static Preferences systemRoot; + private static volatile Preferences systemRoot; - static synchronized Preferences getSystemRoot() { - if (systemRoot == null) { - setupSystemRoot(); - systemRoot = new FileSystemPreferences(false); + static Preferences getSystemRoot() { + Preferences root = systemRoot; + if (root == null) { + synchronized (FileSystemPreferences.class) { + root = systemRoot; + if (root == null) { + setupSystemRoot(); + systemRoot = root = new FileSystemPreferences(false); + } + } } - return systemRoot; + return root; } private static void setupSystemRoot() {
--- a/src/solaris/classes/sun/awt/UNIXToolkit.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/solaris/classes/sun/awt/UNIXToolkit.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2018, 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
--- a/src/solaris/classes/sun/awt/X11/XDesktopPeer.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/solaris/classes/sun/awt/X11/XDesktopPeer.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2018, 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 @@ -25,6 +25,7 @@ package sun.awt.X11; +import sun.awt.UNIXToolkit; import sun.awt.UNIXToolkit; @@ -60,7 +61,7 @@ try { if (!initExecuted) { nativeLibraryLoaded = init(UNIXToolkit.getEnabledGtkVersion() - .ordinal(), UNIXToolkit.isGtkVerbose()); + .getNumber(), UNIXToolkit.isGtkVerbose()); } } finally { initExecuted = true;
--- a/src/solaris/classes/sun/awt/X11/XMenuBarPeer.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/solaris/classes/sun/awt/X11/XMenuBarPeer.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2018, 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 @@ -248,9 +248,11 @@ XMenuItemPeer.TextMetrics[] itemMetrics = new XMenuItemPeer.TextMetrics[itemCnt]; for (int i = 0; i < itemCnt; i++) { itemMetrics[i] = itemVector[i].getTextMetrics(); - Dimension dim = itemMetrics[i].getTextDimension(); - if (dim != null) { - maxHeight = Math.max(maxHeight, dim.height); + if (itemMetrics[i] != null) { + Dimension dim = itemMetrics[i].getTextDimension(); + if (dim != null) { + maxHeight = Math.max(maxHeight, dim.height); + } } } //Calculate bounds @@ -260,6 +262,9 @@ for (int i = 0; i < itemCnt; i++) { XMenuItemPeer item = itemVector[i]; XMenuItemPeer.TextMetrics metrics = itemMetrics[i]; + if (metrics == null) { + continue; + } Dimension dim = metrics.getTextDimension(); if (dim != null) { int itemWidth = BAR_ITEM_MARGIN_LEFT + dim.width + BAR_ITEM_MARGIN_RIGHT; @@ -280,9 +285,6 @@ Point textOrigin = new Point(nextOffset + BAR_ITEM_MARGIN_LEFT, BAR_SPACING_TOP + BAR_ITEM_MARGIN_TOP + y); nextOffset += itemWidth + BAR_ITEM_SPACING; item.map(bounds, textOrigin); - } else { - Rectangle bounds = new Rectangle(nextOffset, BAR_SPACING_TOP, 0, 0); - Point textOrigin = new Point(nextOffset + BAR_ITEM_MARGIN_LEFT, BAR_SPACING_TOP + BAR_ITEM_MARGIN_TOP); } } XMenuItemPeer mappedVector[] = new XMenuItemPeer[mappedCnt];
--- a/src/solaris/classes/sun/awt/X11/XToolkit.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/solaris/classes/sun/awt/X11/XToolkit.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2018, 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 @@ -115,6 +115,12 @@ static long awt_defaultFg; // Pixel private static XMouseInfoPeer xPeer; + /** + * Should we check "_NET_WM_STRUT/_NET_WM_STRUT_PARTIAL" during insets + * calculation. + */ + private static Boolean checkSTRUT; + static { initSecurityWarning(); if (GraphicsEnvironment.isHeadless()) { @@ -726,13 +732,26 @@ } /* - * If we're running in non-Xinerama environment and the current - * window manager supports _NET protocol then the screen insets - * are calculated using _NET_WM_WORKAREA property of the root - * window. - * Otherwise, i. e. if Xinerama is on or _NET_WM_WORKAREA is - * not set, we try to calculate the insets ourselves using - * getScreenInsetsManually method. + * If the current window manager supports _NET protocol then the screen + * insets are calculated using _NET_WORKAREA property of the root window. + * <p> + * Note that _NET_WORKAREA is a rectangular area and it does not work + * well in the Xinerama mode. + * <p> + * We will trust the part of this rectangular area only if it starts at the + * requested graphics configuration. Below is an example when the + * _NET_WORKAREA intersects with the requested graphics configuration but + * produces wrong result. + * + * //<-x1,y1/////// + * // // //////////////// + * // SCREEN1 // // SCREEN2 // + * // ********** // // x2,y2->// + * //////////////// // // + * //////////////// + * + * When two screens overlap and the first contains a dock(*****), then + * _NET_WORKAREA may start at point x1,y1 and end at point x2,y2. */ public Insets getScreenInsets(GraphicsConfiguration gc) { @@ -745,27 +764,34 @@ XToolkit.awtLock(); try { - X11GraphicsConfig x11gc = (X11GraphicsConfig)gc; - X11GraphicsDevice x11gd = x11gc.getDevice(); - long root = XlibUtil.getRootWindow(x11gd.getScreen()); + X11GraphicsEnvironment x11ge = (X11GraphicsEnvironment) + GraphicsEnvironment.getLocalGraphicsEnvironment(); + X11GraphicsConfig x11gc = (X11GraphicsConfig) gc; + long root = XlibUtil.getRootWindow(x11gc.getDevice().getScreen()); int scale = x11gc.getScale(); - Rectangle rootBounds = XlibUtil.getWindowGeometry(root, scale); - - X11GraphicsEnvironment x11ge = (X11GraphicsEnvironment) - GraphicsEnvironment.getLocalGraphicsEnvironment(); - if (!x11ge.runningXinerama()) - { - Rectangle workArea = XToolkit.getWorkArea(root, scale); - if (workArea != null) - { - return new Insets(workArea.y, - workArea.x, - rootBounds.height - workArea.height - workArea.y, - rootBounds.width - workArea.width - workArea.x); + if (x11ge.runningXinerama() && checkSTRUT()) { + // implementation based on _NET_WM_STRUT/_NET_WM_STRUT_PARTIAL + Rectangle rootBounds = XlibUtil.getWindowGeometry(root, scale); + Insets insets = getScreenInsetsManually(root, rootBounds, + gc.getBounds(), scale); + if ((insets.left | insets.top | insets.bottom | insets.right) != 0 + || rootBounds == null) { + return insets; } } + Rectangle workArea = XToolkit.getWorkArea(root, scale); + Rectangle screen = gc.getBounds(); + if (workArea != null && screen.contains(workArea.getLocation())) { + workArea = workArea.intersection(screen); + int top = workArea.y - screen.y; + int left = workArea.x - screen.x; + int bottom = screen.height - workArea.height - top; + int right = screen.width - workArea.width - left; + return new Insets(top, left, bottom, right); + } - return getScreenInsetsManually(root, rootBounds, gc.getBounds(), scale); + // Note that it is better to return zeros than inadequate values + return new Insets(0, 0, 0, 0); } finally { @@ -773,12 +799,32 @@ } } + /** + * Returns the value of "sun.awt.X11.checkSTRUT" property. Default value is + * {@code false}. + */ + private static boolean checkSTRUT() { + if (checkSTRUT == null) { + checkSTRUT = AccessController.doPrivileged( + new GetBooleanAction("sun.awt.X11.checkSTRUT")); + } + return checkSTRUT; + } + /* * Manual calculation of screen insets: get all the windows with * _NET_WM_STRUT/_NET_WM_STRUT_PARTIAL hints and add these * hints' values to screen insets. * * This method should be called under XToolkit.awtLock() + * + * This method is unused by default because of two reasons: + * - Iteration over windows may be extremely slow, and execution of + * getScreenInsets() can be x100 slower than in one monitor config. + * - _NET_WM_STRUT/_NET_WM_STRUT_PARTIAL are hints for the applications. + * WM should take into account these hints when "_NET_WORKAREA" is + * calculated, but the system panels do not necessarily contain these + * hints(Gnome 3 for example). */ private Insets getScreenInsetsManually(long root, Rectangle rootBounds, Rectangle screenBounds, int scale)
--- a/src/solaris/classes/sun/nio/fs/LinuxFileStore.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/solaris/classes/sun/nio/fs/LinuxFileStore.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2018, 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 @@ -66,6 +66,8 @@ } // step 2: find mount point + List<UnixMountEntry> procMountsEntries = + fs.getMountEntries("/proc/mounts"); UnixPath parent = path.getParent(); while (parent != null) { UnixFileAttributes attrs = null; @@ -75,11 +77,10 @@ x.rethrowAsIOException(parent); } if (attrs.dev() != dev()) { - - // step 3: lookup mounted file systems (use /proc/mounts to ensure we - // find the file system even when not in /etc/mtab) + // step 3: lookup mounted file systems (use /proc/mounts to + // ensure we find the file system even when not in /etc/mtab) byte[] dir = path.asByteArray(); - for (UnixMountEntry entry: fs.getMountEntries("/proc/mounts")) { + for (UnixMountEntry entry : procMountsEntries) { if (Arrays.equals(dir, entry.dir())) return entry; } @@ -88,10 +89,10 @@ parent = parent.getParent(); } - // step 3: lookup mounted file systems (use /proc/mounts to ensure we - // find the file system even when not in /etc/mtab) + // step 3: lookup mounted file systems (use /proc/mounts to + // ensure we find the file system even when not in /etc/mtab) byte[] dir = path.asByteArray(); - for (UnixMountEntry entry: fs.getMountEntries("/proc/mounts")) { + for (UnixMountEntry entry : procMountsEntries) { if (Arrays.equals(dir, entry.dir())) return entry; }
--- a/src/solaris/classes/sun/nio/fs/LinuxFileSystem.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/solaris/classes/sun/nio/fs/LinuxFileSystem.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2018, 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 @@ -75,7 +75,7 @@ /** * Returns object to iterate over the mount entries in the given fstab file. */ - Iterable<UnixMountEntry> getMountEntries(String fstab) { + List<UnixMountEntry> getMountEntries(String fstab) { ArrayList<UnixMountEntry> entries = new ArrayList<>(); try { long fp = setmntent(Util.toBytes(fstab), Util.toBytes("r")); @@ -101,7 +101,7 @@ * Returns object to iterate over the mount entries in /etc/mtab */ @Override - Iterable<UnixMountEntry> getMountEntries() { + List<UnixMountEntry> getMountEntries() { return getMountEntries("/etc/mtab"); }
--- a/src/solaris/classes/sun/security/provider/NativePRNG.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/solaris/classes/sun/security/provider/NativePRNG.java Fri Apr 12 21:32:38 2019 +0100 @@ -469,7 +469,8 @@ try { seedOut.write(seed); } catch (IOException e) { - throw new ProviderException("setSeed() failed", e); + // Ignored. On Mac OS X, /dev/urandom can be opened + // for write, but actual write is not permitted. } } getMixRandom().engineSetSeed(seed);
--- a/src/solaris/native/java/net/net_util_md.c Mon Mar 04 16:45:37 2019 +0000 +++ b/src/solaris/native/java/net/net_util_md.c Fri Apr 12 21:32:38 2019 +0100 @@ -103,7 +103,9 @@ } int defaultIndex; struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)him; - if (sin6->sin6_family == AF_INET6 && (sin6->sin6_scope_id == 0)) { + if (sin6->sin6_family == AF_INET6 && (sin6->sin6_scope_id == 0) && + (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) || + IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))) { defaultIndex = (*env)->GetStaticIntField(env, ni_class, ni_defaultIndexID); sin6->sin6_scope_id = defaultIndex;
--- a/src/solaris/native/sun/awt/awt_InputMethod.c Mon Mar 04 16:45:37 2019 +0000 +++ b/src/solaris/native/sun/awt/awt_InputMethod.c Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2018, 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 @@ -30,6 +30,7 @@ #include <stdio.h> #include <stdlib.h> #include <X11/Xlib.h> +#include <X11/keysym.h> #include <sys/time.h> #include "awt.h"
--- a/src/solaris/native/sun/awt/awt_UNIXToolkit.c Mon Mar 04 16:45:37 2019 +0000 +++ b/src/solaris/native/sun/awt/awt_UNIXToolkit.c Fri Apr 12 21:32:38 2019 +0100 @@ -97,6 +97,7 @@ "loadIconCallback", "([BIIIIIZ)V"); CHECK_NULL_RETURN(icon_upcall_method, JNI_FALSE); } + return JNI_TRUE; } @@ -129,6 +130,7 @@ return JNI_FALSE; } if (!init_method(env, this) ) { + free(filename_str); return JNI_FALSE; } (*env)->GetStringUTFRegion(env, filename, 0, len, filename_str); @@ -202,6 +204,7 @@ { free(detail_str); } + return result; #else /* HEADLESS */ return JNI_FALSE;
--- a/src/solaris/native/sun/awt/extutil.h Mon Mar 04 16:45:37 2019 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,251 +0,0 @@ -/* - * 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * 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. - */ - -/* - * This file is available under and governed by the GNU General Public - * License version 2 only, as published by the Free Software Foundation. - * However, the following notice accompanied the original version of this - * file: - * - * $Xorg: extutil.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $ - * -Copyright 1989, 1998 The Open Group - -All Rights Reserved. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - * - * Author: Jim Fulton, MIT The Open Group - * - * Xlib Extension-Writing Utilities - * - * This package contains utilities for writing the client API for various - * protocol extensions. THESE INTERFACES ARE NOT PART OF THE X STANDARD AND - * ARE SUBJECT TO CHANGE! - */ -/* $XFree86: xc/include/extensions/extutil.h,v 1.5 2001/01/17 17:53:20 dawes Exp $ */ - -#if defined(__linux__) || defined(MACOSX) - -#ifndef _EXTUTIL_H_ -#define _EXTUTIL_H_ - -/* - * We need to keep a list of open displays since the Xlib display list isn't - * public. We also have to per-display info in a separate block since it isn't - * stored directly in the Display structure. - */ -typedef struct _XExtDisplayInfo { - struct _XExtDisplayInfo *next; /* keep a linked list */ - Display *display; /* which display this is */ - XExtCodes *codes; /* the extension protocol codes */ - XPointer data; /* extra data for extension to use */ -} XExtDisplayInfo; - -typedef struct _XExtensionInfo { - XExtDisplayInfo *head; /* start of list */ - XExtDisplayInfo *cur; /* most recently used */ - int ndisplays; /* number of displays */ -} XExtensionInfo; - -typedef struct _XExtensionHooks { - int (*create_gc)( -#if NeedNestedPrototypes - Display* /* display */, - GC /* gc */, - XExtCodes* /* codes */ -#endif -); - int (*copy_gc)( -#if NeedNestedPrototypes - Display* /* display */, - GC /* gc */, - XExtCodes* /* codes */ -#endif -); - int (*flush_gc)( -#if NeedNestedPrototypes - Display* /* display */, - GC /* gc */, - XExtCodes* /* codes */ -#endif -); - int (*free_gc)( -#if NeedNestedPrototypes - Display* /* display */, - GC /* gc */, - XExtCodes* /* codes */ -#endif -); - int (*create_font)( -#if NeedNestedPrototypes - Display* /* display */, - XFontStruct* /* fs */, - XExtCodes* /* codes */ -#endif -); - int (*free_font)( -#if NeedNestedPrototypes - Display* /* display */, - XFontStruct* /* fs */, - XExtCodes* /* codes */ -#endif -); - int (*close_display)( -#if NeedNestedPrototypes - Display* /* display */, - XExtCodes* /* codes */ -#endif -); - Bool (*wire_to_event)( -#if NeedNestedPrototypes - Display* /* display */, - XEvent* /* re */, - xEvent* /* event */ -#endif -); - Status (*event_to_wire)( -#if NeedNestedPrototypes - Display* /* display */, - XEvent* /* re */, - xEvent* /* event */ -#endif -); - int (*error)( -#if NeedNestedPrototypes - Display* /* display */, - xError* /* err */, - XExtCodes* /* codes */, - int* /* ret_code */ -#endif -); - char *(*error_string)( -#if NeedNestedPrototypes - Display* /* display */, - int /* code */, - XExtCodes* /* codes */, - char* /* buffer */, - int /* nbytes */ -#endif -); -} XExtensionHooks; - -extern XExtensionInfo *XextCreateExtension( -#if NeedFunctionPrototypes - void -#endif -); -extern void XextDestroyExtension( -#if NeedFunctionPrototypes - XExtensionInfo* /* info */ -#endif -); -extern XExtDisplayInfo *XextAddDisplay( -#if NeedFunctionPrototypes - XExtensionInfo* /* extinfo */, - Display* /* dpy */, - char* /* ext_name */, - XExtensionHooks* /* hooks */, - int /* nevents */, - XPointer /* data */ -#endif -); -extern int XextRemoveDisplay( -#if NeedFunctionPrototypes - XExtensionInfo* /* extinfo */, - Display* /* dpy */ -#endif -); -extern XExtDisplayInfo *XextFindDisplay( -#if NeedFunctionPrototypes - XExtensionInfo* /* extinfo */, - Display* /* dpy */ -#endif -); - -#define XextHasExtension(i) ((i) && ((i)->codes)) -#define XextCheckExtension(dpy,i,name,val) \ - if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return val; } -#define XextSimpleCheckExtension(dpy,i,name) \ - if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return; } - - -/* - * helper macros to generate code that is common to all extensions; caller - * should prefix it with static if extension source is in one file; this - * could be a utility function, but have to stack 6 unused arguments for - * something that is called many, many times would be bad. - */ -#define XEXT_GENERATE_FIND_DISPLAY(proc,extinfo,extname,hooks,nev,data) \ -XExtDisplayInfo *proc (Display *dpy) \ -{ \ - XExtDisplayInfo *dpyinfo; \ - if (!extinfo) { if (!(extinfo = XextCreateExtension())) return NULL; } \ - if (!(dpyinfo = XextFindDisplay (extinfo, dpy))) \ - dpyinfo = XextAddDisplay (extinfo,dpy,extname,hooks,nev,data); \ - return dpyinfo; \ -} - -#define XEXT_FIND_DISPLAY_PROTO(proc) \ - XExtDisplayInfo *proc(Display *dpy) - -#define XEXT_GENERATE_CLOSE_DISPLAY(proc,extinfo) \ -int proc (Display *dpy, XExtCodes *codes) \ -{ \ - return XextRemoveDisplay (extinfo, dpy); \ -} - -#define XEXT_CLOSE_DISPLAY_PROTO(proc) \ - int proc(Display *dpy, XExtCodes *codes) - -#define XEXT_GENERATE_ERROR_STRING(proc,extname,nerr,errl) \ -char *proc (Display *dpy, int code, XExtCodes *codes, char *buf, int n) \ -{ \ - code -= codes->first_error; \ - if (code >= 0 && code < nerr) { \ - char tmp[256]; \ - sprintf (tmp, "%s.%d", extname, code); \ - XGetErrorDatabaseText (dpy, "XProtoError", tmp, errl[code], buf, n); \ - return buf; \ - } \ - return (char *)0; \ -} - -#define XEXT_ERROR_STRING_PROTO(proc) \ - char *proc(Display *dpy, int code, XExtCodes *codes, char *buf, int n) -#endif - -#endif /* __linux__ || MACOSX */
--- a/src/solaris/native/sun/awt/gtk2_interface.c Mon Mar 04 16:45:37 2019 +0000 +++ b/src/solaris/native/sun/awt/gtk2_interface.c Fri Apr 12 21:32:38 2019 +0100 @@ -35,9 +35,6 @@ #include <jni_util.h> #include "awt.h" -#define GTHREAD_LIB_VERSIONED VERSIONED_JNI_LIB_NAME("gthread-2.0", "0") -#define GTHREAD_LIB JNI_LIB_NAME("gthread-2.0") - #define GTK_TYPE_BORDER ((*fp_gtk_border_get_type)()) #define G_TYPE_FUNDAMENTAL_SHIFT (2) @@ -71,7 +68,6 @@ static gboolean new_combo = TRUE; const char ENV_PREFIX[] = "GTK_MODULES="; - static GtkWidget *gtk2_widgets[_GTK_WIDGET_TYPE_SIZE]; /************************* @@ -319,7 +315,6 @@ return TRUE; } else { void *lib = NULL; - #ifdef RTLD_NOLOAD /* Just check if gtk libs are already in the process space */ lib = dlopen(lib_name, RTLD_LAZY | RTLD_NOLOAD); @@ -335,6 +330,7 @@ #endif lib = dlopen(lib_name, RTLD_LAZY | RTLD_LOCAL); + if (lib == NULL) { return FALSE; } @@ -846,6 +842,7 @@ { gtk2_widgets[i] = NULL; } + if (result) { GtkApi* gtk = (GtkApi*)malloc(sizeof(GtkApi)); gtk2_init(gtk); @@ -2460,14 +2457,14 @@ static jobject get_integer_property(JNIEnv *env, GtkSettings* settings, const gchar* key) { - gint intval = NULL; + gint intval = 0; (*fp_g_object_get)(settings, key, &intval, NULL); return create_Integer(env, intval); } static jobject get_boolean_property(JNIEnv *env, GtkSettings* settings, const gchar* key) { - gint intval = NULL; + gint intval = 0; (*fp_g_object_get)(settings, key, &intval, NULL); return create_Boolean(env, intval); } @@ -2493,65 +2490,6 @@ return NULL; } -static gboolean gtk2_get_drawable_data(JNIEnv *env, jintArray pixelArray, jint x, - jint y, jint width, jint height, jint jwidth, int dx, int dy, jint scale) { - GdkPixbuf *pixbuf; - jint *ary; - - GdkWindow *root = (*fp_gdk_get_default_root_window)(); - - pixbuf = (*fp_gdk_pixbuf_get_from_drawable)(NULL, root, NULL, x, y, - 0, 0, width, height); - if (pixbuf && scale != 1) { - GdkPixbuf *scaledPixbuf; - x /= scale; - y /= scale; - width /= scale; - height /= scale; - dx /= scale; - dy /= scale; - scaledPixbuf = (*fp_gdk_pixbuf_scale_simple)(pixbuf, width, height, - GDK_INTERP_BILINEAR); - (*fp_g_object_unref)(pixbuf); - pixbuf = scaledPixbuf; - } - - if (pixbuf) { - int nchan = (*fp_gdk_pixbuf_get_n_channels)(pixbuf); - int stride = (*fp_gdk_pixbuf_get_rowstride)(pixbuf); - - if ((*fp_gdk_pixbuf_get_width)(pixbuf) == width - && (*fp_gdk_pixbuf_get_height)(pixbuf) == height - && (*fp_gdk_pixbuf_get_bits_per_sample)(pixbuf) == 8 - && (*fp_gdk_pixbuf_get_colorspace)(pixbuf) == GDK_COLORSPACE_RGB - && nchan >= 3 - ) { - guchar *p, *pix = (*fp_gdk_pixbuf_get_pixels)(pixbuf); - - ary = (*env)->GetPrimitiveArrayCritical(env, pixelArray, NULL); - if (ary) { - jint _x, _y; - int index; - for (_y = 0; _y < height; _y++) { - for (_x = 0; _x < width; _x++) { - p = pix + _y * stride + _x * nchan; - - index = (_y + dy) * jwidth + (_x + dx); - ary[index] = 0xff000000 - | (p[0] << 16) - | (p[1] << 8) - | (p[2]); - - } - } - (*env)->ReleasePrimitiveArrayCritical(env, pixelArray, ary, 0); - } - } - (*fp_g_object_unref)(pixbuf); - } - return JNI_FALSE; -} - static GdkWindow* gtk2_get_window(void *widget) { return ((GtkWidget*)widget)->window; } @@ -2596,7 +2534,6 @@ gtk->gdk_threads_enter = fp_gdk_threads_enter; gtk->gdk_threads_leave = fp_gdk_threads_leave; gtk->gtk_show_uri = fp_gtk_show_uri; - gtk->get_drawable_data = >k2_get_drawable_data; gtk->g_free = fp_g_free; gtk->gtk_file_chooser_get_filename = fp_gtk_file_chooser_get_filename; @@ -2632,4 +2569,7 @@ gtk->get_window = >k2_get_window; gtk->g_object_unref = fp_g_object_unref; + gtk->g_list_append = fp_g_list_append; + gtk->g_list_free = fp_g_list_free; + gtk->g_list_free_full = fp_g_list_free_full; }
--- a/src/solaris/native/sun/awt/gtk2_interface.h Mon Mar 04 16:45:37 2019 +0000 +++ b/src/solaris/native/sun/awt/gtk2_interface.h Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2018, 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 @@ -350,9 +350,6 @@ guint ellipsize : 3; }; - -typedef struct _GThreadFunctions GThreadFunctions; - /** * Returns : * NULL if the GLib library is compatible with the given version, or a string @@ -361,7 +358,7 @@ * so you should use GLIB_CHECK_VERSION macro instead. */ static gchar* (*fp_glib_check_version)(guint required_major, guint required_minor, - guint required_micro); + guint required_micro); /** * Returns : @@ -376,10 +373,9 @@ * describing the version mismatch. */ static gchar* (*fp_gtk_check_version)(guint required_major, guint required_minor, - guint required_micro); + guint required_micro); static void gtk2_init(GtkApi* gtk); - static void (*fp_g_free)(gpointer mem); static void (*fp_g_object_unref)(gpointer object); static GdkWindow *(*fp_gdk_get_default_root_window) (void); @@ -443,16 +439,9 @@ static guint (*fp_gtk_main_level)(void); static gchar* (*fp_g_path_get_dirname) (const gchar *file_name); -/** - * This function is available for GLIB > 2.20, so it MUST be - * called within GLIB_CHECK_VERSION(2, 20, 0) check. - */ -static gboolean (*fp_g_thread_get_initialized)(void); - -static void (*fp_g_thread_init)(GThreadFunctions *vtable); -static void (*fp_gdk_threads_init)(void); -static void (*fp_gdk_threads_enter)(void); -static void (*fp_gdk_threads_leave)(void); +static GList* (*fp_g_list_append) (GList *list, gpointer data); +static void (*fp_g_list_free) (GList *list); +static void (*fp_g_list_free_full) (GList *list, GDestroyNotify free_func); static gboolean (*fp_gtk_show_uri)(GdkScreen *screen, const gchar *uri, guint32 timestamp, GError **error);
--- a/src/solaris/native/sun/awt/gtk3_interface.c Mon Mar 04 16:45:37 2019 +0000 +++ b/src/solaris/native/sun/awt/gtk3_interface.c Fri Apr 12 21:32:38 2019 +0100 @@ -35,6 +35,7 @@ #include "awt.h" static void *gtk3_libhandle = NULL; +static void *gthread_libhandle = NULL; static jmp_buf j; @@ -87,6 +88,15 @@ return result; } +static void* dl_symbol_gthread(const char* name) +{ + void* result = dlsym(gthread_libhandle, name); + if (!result) + longjmp(j, NO_SYMBOL_EXCEPTION); + + return result; +} + gboolean gtk3_check(const char* lib_name, gboolean load) { if (gtk3_libhandle != NULL) { @@ -261,6 +271,13 @@ return FALSE; } + gthread_libhandle = dlopen(GTHREAD_LIB_VERSIONED, RTLD_LAZY | RTLD_LOCAL); + if (gthread_libhandle == NULL) { + gthread_libhandle = dlopen(GTHREAD_LIB, RTLD_LAZY | RTLD_LOCAL); + if (gthread_libhandle == NULL) + return FALSE; + } + if (setjmp(j) == 0) { fp_gtk_check_version = dl_symbol("gtk_check_version"); @@ -530,8 +547,9 @@ fp_g_path_get_dirname = dl_symbol("g_path_get_dirname"); - fp_gdk_threads_enter = ∅ - fp_gdk_threads_leave = ∅ + fp_gdk_threads_init = dl_symbol("gdk_threads_init"); + fp_gdk_threads_enter = dl_symbol("gdk_threads_enter"); + fp_gdk_threads_leave = dl_symbol("gdk_threads_leave"); /** * Functions for sun_awt_X11_GtkFileDialogPeer.c @@ -544,6 +562,9 @@ fp_gtk_separator_tool_item_new = dlsym(gtk3_libhandle, "gtk_separator_tool_item_new"); + fp_g_list_append = dl_symbol("g_list_append"); + fp_g_list_free = dl_symbol("g_list_free"); + fp_g_list_free_full = dl_symbol("g_list_free_full"); } /* Now we have only one kind of exceptions: NO_SYMBOL_EXCEPTION * Otherwise we can check the return value of setjmp method. @@ -553,45 +574,45 @@ dlclose(gtk3_libhandle); gtk3_libhandle = NULL; + dlclose(gthread_libhandle); + gthread_libhandle = NULL; + return NULL; } /* - * Strip the AT-SPI GTK_MODULEs if present + * Strip the AT-SPI GTK_MODULES if present */ gtk_modules_env = getenv ("GTK_MODULES"); - if (gtk_modules_env && strstr (gtk_modules_env, "atk-bridge") || - gtk_modules_env && strstr (gtk_modules_env, "gail")) - { - /* the new env will be smaller than the old one */ - gchar *s, *new_env = SAFE_SIZE_STRUCT_ALLOC(malloc, - sizeof(ENV_PREFIX), 1, strlen (gtk_modules_env)); - - if (new_env != NULL ) - { - /* careful, strtok modifies its args */ - gchar *tmp_env = strdup (gtk_modules_env); - strcpy(new_env, ENV_PREFIX); - - /* strip out 'atk-bridge' and 'gail' */ - size_t PREFIX_LENGTH = strlen(ENV_PREFIX); - while (s = strtok(tmp_env, ":")) - { - if ((!strstr (s, "atk-bridge")) && (!strstr (s, "gail"))) - { - if (strlen (new_env) > PREFIX_LENGTH) { - new_env = strcat (new_env, ":"); - } - new_env = strcat(new_env, s); - } - if (tmp_env) - { - free (tmp_env); - tmp_env = NULL; /* next call to strtok arg1==NULL */ - } - } - putenv (new_env); - free (new_env); + if ((gtk_modules_env && strstr(gtk_modules_env, "atk-bridge")) || + (gtk_modules_env && strstr(gtk_modules_env, "gail"))) { + /* careful, strtok modifies its args */ + gchar *tmp_env = strdup(gtk_modules_env); + if (tmp_env) { + /* the new env will be smaller than the old one */ + gchar *s, *new_env = SAFE_SIZE_STRUCT_ALLOC(malloc, + sizeof(ENV_PREFIX), 1, strlen (gtk_modules_env)); + + if (new_env) { + strcpy(new_env, ENV_PREFIX); + + /* strip out 'atk-bridge' and 'gail' */ + size_t PREFIX_LENGTH = strlen(ENV_PREFIX); + gchar *tmp_ptr = NULL; + for (s = strtok_r(tmp_env, ":", &tmp_ptr); s; + s = strtok_r(NULL, ":", &tmp_ptr)) { + if ((!strstr(s, "atk-bridge")) && (!strstr(s, "gail"))) { + if (strlen(new_env) > PREFIX_LENGTH) { + new_env = strcat(new_env, ":"); + } + new_env = strcat(new_env, s); + } + } + if (putenv(new_env) != 0) { + /* no free() on success, putenv() doesn't copy string */ + free(new_env); + } + } free (tmp_env); } } @@ -606,10 +627,16 @@ AWT_LOCK(); handler = XSetErrorHandler(NULL); io_handler = XSetIOErrorHandler(NULL); + + //According the GTK documentation, gdk_threads_init() should be + //called before gtk_init() or gtk_init_check() + fp_gdk_threads_init(); result = (*fp_gtk_init_check)(NULL, NULL); + XSetErrorHandler(handler); XSetIOErrorHandler(io_handler); AWT_UNLOCK(); + /* Initialize widget array. */ for (i = 0; i < _GTK_WIDGET_TYPE_SIZE; i++) { @@ -648,6 +675,7 @@ dlerror(); dlclose(gtk3_libhandle); + dlclose(gthread_libhandle); if ((gtk3_error = dlerror()) != NULL) { return FALSE; @@ -1583,13 +1611,17 @@ fp_gtk_style_context_save (context); GtkStateFlags flags = get_gtk_flags(state_type); + if (expander_style == GTK_EXPANDER_EXPANDED) { + flags |= GTK_STATE_FLAG_ACTIVE; + } + fp_gtk_style_context_set_state(context, flags); if (detail != 0) { transform_detail_string(detail, context); } - fp_gtk_render_expander (context, cr, x, y, width, height); + fp_gtk_render_expander (context, cr, x + 2, y + 2, width - 4, height - 4); fp_gtk_style_context_restore (context); } @@ -1986,9 +2018,7 @@ static guint8 recode_color(gdouble channel) { guint16 result = (guint16)(channel * 65535); - if (result < 0) { - result = 0; - } else if (result > 65535) { + if (result > 65535) { result = 65535; } return (guint8)( result >> 8); @@ -2190,6 +2220,7 @@ static GdkRGBA gtk3_get_color_for_flags(GtkStyleContext* context, GtkStateFlags flags, ColorType color_type) { GdkRGBA c, color; + color.alpha = 1; switch (color_type) { @@ -2238,7 +2269,6 @@ { gint result = 0; - GdkRGBA color; GtkStateFlags flags = gtk3_get_state_flags(state_type); @@ -2257,7 +2287,7 @@ | GTK_STATE_FLAG_INSENSITIVE | GTK_STATE_FLAG_FOCUSED; } - color = gtk3_get_color_for_flags(context, flags, color_type); + GdkRGBA color = gtk3_get_color_for_flags(context, flags, color_type); if (recode_color(color.alpha) == 0) { color = gtk3_get_color_for_flags( @@ -2556,14 +2586,14 @@ static jobject get_integer_property(JNIEnv *env, GtkSettings* settings, const gchar* key) { - gint intval = NULL; + gint intval = 0; (*fp_g_object_get)(settings, key, &intval, NULL); return create_Integer(env, intval); } static jobject get_boolean_property(JNIEnv *env, GtkSettings* settings, const gchar* key) { - gint intval = NULL; + gint intval = 0; (*fp_g_object_get)(settings, key, &intval, NULL); return create_Boolean(env, intval); } @@ -2750,62 +2780,6 @@ } } -static gboolean gtk3_get_drawable_data(JNIEnv *env, jintArray pixelArray, - int x, jint y, jint width, jint height, jint jwidth, int dx, int dy, - jint scale) { - GdkPixbuf *pixbuf; - jint *ary; - - GdkWindow *root = (*fp_gdk_get_default_root_window)(); - pixbuf = (*fp_gdk_pixbuf_get_from_drawable)(root, x, y, width, height); - if (pixbuf && scale != 1) { - GdkPixbuf *scaledPixbuf; - x /= scale; - y /= scale; - width /= scale; - height /= scale; - dx /= scale; - dy /= scale; - scaledPixbuf = (*fp_gdk_pixbuf_scale_simple)(pixbuf, width, height, - GDK_INTERP_BILINEAR); - (*fp_g_object_unref)(pixbuf); - pixbuf = scaledPixbuf; - } - - if (pixbuf) { - int nchan = (*fp_gdk_pixbuf_get_n_channels)(pixbuf); - int stride = (*fp_gdk_pixbuf_get_rowstride)(pixbuf); - if ((*fp_gdk_pixbuf_get_width)(pixbuf) == width - && (*fp_gdk_pixbuf_get_height)(pixbuf) == height - && (*fp_gdk_pixbuf_get_bits_per_sample)(pixbuf) == 8 - && (*fp_gdk_pixbuf_get_colorspace)(pixbuf) == GDK_COLORSPACE_RGB - && nchan >= 3 - ) { - guchar *p, *pix = (*fp_gdk_pixbuf_get_pixels)(pixbuf); - ary = (*env)->GetPrimitiveArrayCritical(env, pixelArray, NULL); - if (ary) { - jint _x, _y; - int index; - for (_y = 0; _y < height; _y++) { - for (_x = 0; _x < width; _x++) { - p = pix + _y * stride + _x * nchan; - - index = (_y + dy) * jwidth + (_x + dx); - ary[index] = 0xff000000 - | (p[0] << 16) - | (p[1] << 8) - | (p[2]); - - } - } - (*env)->ReleasePrimitiveArrayCritical(env, pixelArray, ary, 0); - } - } - (*fp_g_object_unref)(pixbuf); - } - return JNI_FALSE; -} - static GdkWindow* gtk3_get_window(void *widget) { return fp_gtk_widget_get_window((GtkWidget*)widget); } @@ -2850,7 +2824,6 @@ gtk->gdk_threads_enter = fp_gdk_threads_enter; gtk->gdk_threads_leave = fp_gdk_threads_leave; gtk->gtk_show_uri = fp_gtk_show_uri; - gtk->get_drawable_data = >k3_get_drawable_data; gtk->g_free = fp_g_free; gtk->gtk_file_chooser_get_filename = fp_gtk_file_chooser_get_filename; @@ -2879,7 +2852,6 @@ gtk->gtk_main = fp_gtk_main; gtk->gtk_main_level = fp_gtk_main_level; gtk->g_path_get_dirname = fp_g_path_get_dirname; - gtk->gdk_x11_drawable_get_xid = fp_gdk_x11_drawable_get_xid; gtk->gtk_widget_destroy = fp_gtk_widget_destroy; gtk->gtk_window_present = fp_gtk_window_present; gtk->gtk_window_move = fp_gtk_window_move; @@ -2887,4 +2859,7 @@ gtk->get_window = >k3_get_window; gtk->g_object_unref = fp_g_object_unref; + gtk->g_list_append = fp_g_list_append; + gtk->g_list_free = fp_g_list_free; + gtk->g_list_free_full = fp_g_list_free_full; }
--- a/src/solaris/native/sun/awt/gtk3_interface.h Mon Mar 04 16:45:37 2019 +0000 +++ b/src/solaris/native/sun/awt/gtk3_interface.h Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2018, 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 @@ -315,6 +315,10 @@ static gchar* (*fp_g_path_get_dirname) (const gchar *file_name); static XID (*fp_gdk_x11_drawable_get_xid) (GdkWindow *drawable); +static GList* (*fp_g_list_append) (GList *list, gpointer data); +static void (*fp_g_list_free) (GList *list); +static void (*fp_g_list_free_full) (GList *list, GDestroyNotify free_func); + static void (*fp_gdk_threads_enter)(void); static void (*fp_gdk_threads_leave)(void);
--- a/src/solaris/native/sun/awt/gtk_interface.c Mon Mar 04 16:45:37 2019 +0000 +++ b/src/solaris/native/sun/awt/gtk_interface.c Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2018, 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 @@ -43,7 +43,7 @@ gboolean (*check)(const char* lib_name, gboolean load); } GtkLib; -static GtkLib libs[] = { +static GtkLib gtk_libs[] = { { GTK_2, JNI_LIB_NAME("gtk-x11-2.0"), @@ -57,26 +57,42 @@ VERSIONED_JNI_LIB_NAME("gtk-3", "0"), >k3_load, >k3_check - }, - { - 0, - NULL, - NULL, - NULL, - NULL } }; +static GtkLib** get_libs_order(GtkVersion version) { + static GtkLib** load_order; + static int n_libs = 0; + if (!n_libs) { + n_libs = sizeof(gtk_libs) / sizeof(GtkLib); + load_order = calloc(n_libs + 1, sizeof(GtkLib *)); + } + int i, first = 0; + for (i = 0; i < n_libs; i++) { + load_order[i] = >k_libs[i]; + if (load_order[i]->version == version) { + first = i; + } + } + if (first) { + for (i = first; i > 0; i--) { + load_order[i] = load_order[i - 1]; + } + load_order[0] = >k_libs[first]; + } + return load_order; +} + static GtkLib* get_loaded() { - GtkLib* lib = libs; - while(!gtk && lib->version) { + GtkLib** libs = get_libs_order(GTK_ANY); + while(!gtk && *libs) { + GtkLib* lib = *libs++; if (lib->check(lib->vname, /* load = */FALSE)) { return lib; } if (lib->check(lib->name, /* load = */FALSE)) { return lib; } - lib++; } return NULL; } @@ -85,23 +101,18 @@ if (gtk == NULL) { GtkLib* lib = get_loaded(); if (lib) { - if (version != GTK_ANY && lib->version != version) { - if (verbose) { - fprintf(stderr, "WARNING: Cannot load GTK%d library: \ - GTK%d has already been loaded\n", version, lib->version); - } - return FALSE; - } if (verbose) { - fprintf(stderr, "Looking for GTK%d library...\n", version); + fprintf(stderr, "Looking for GTK%d library...\n", + lib->version); } gtk = lib->load(env, lib->vname); if (!gtk) { gtk = lib->load(env, lib->name); } } else { - lib = libs; - while (!gtk && lib->version) { + GtkLib** libs = get_libs_order(version); + while (!gtk && *libs) { + lib = *libs++; if (version == GTK_ANY || lib->version == version) { if (verbose) { fprintf(stderr, "Looking for GTK%d library...\n", @@ -115,9 +126,7 @@ fprintf(stderr, "Not found.\n"); } } - lib++; } - lib--; } if (verbose) { if (gtk) { @@ -131,25 +140,22 @@ } static gboolean check_version(GtkVersion version) { - GtkLib* lib = libs; - while (lib->version) { - if (version == GTK_ANY || lib->version == version) { - if (lib->check(lib->vname, /* load = */TRUE)) { - return TRUE; - } - if (lib->check(lib->name, /* load = */TRUE)) { - return TRUE; - } + GtkLib** libs = get_libs_order(version); + while (*libs) { + GtkLib* lib = *libs++; + if (lib->check(lib->vname, /* load = */TRUE)) { + return TRUE; } - lib++; - } + if (lib->check(lib->name, /* load = */TRUE)) { + return TRUE; + } + } return FALSE; } gboolean gtk_check_version(GtkVersion version) { - if (gtk) { + if (gtk || get_loaded()) { return TRUE; } return check_version(version); } -
--- a/src/solaris/native/sun/awt/gtk_interface.h Mon Mar 04 16:45:37 2019 +0000 +++ b/src/solaris/native/sun/awt/gtk_interface.h Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2018, 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 @@ -33,6 +33,9 @@ #define TRUE (!FALSE) #endif +#define GTHREAD_LIB_VERSIONED VERSIONED_JNI_LIB_NAME("gthread-2.0", "0") +#define GTHREAD_LIB JNI_LIB_NAME("gthread-2.0") + #define _G_TYPE_CIC(ip, gt, ct) ((ct*) ip) #define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) \ (_G_TYPE_CIC ((instance), (g_type), c_type)) @@ -106,6 +109,14 @@ typedef unsigned long long guint64; typedef gulong GType; +typedef struct _GList GList; +struct _GList +{ + gpointer data; + GList *next; + GList *prev; +}; + typedef struct _GSList GSList; struct _GSList { gpointer data; @@ -493,9 +504,6 @@ void (*gdk_threads_leave)(void); gboolean (*gtk_show_uri)(GdkScreen *screen, const gchar *uri, guint32 timestamp, GError **error); - gboolean (*get_drawable_data)(JNIEnv *env, jintArray pixelArray, - jint x, jint y, jint width, jint height, - jint jwidth, int dx, int dy, jint scale); void (*g_free)(gpointer mem); @@ -540,11 +548,21 @@ GdkWindow *(*get_window)(void *widget); void (*g_object_unref)(gpointer object); + GList* (*g_list_append) (GList *list, gpointer data); + void (*g_list_free) (GList *list); + void (*g_list_free_full) (GList *list, GDestroyNotify free_func); } GtkApi; gboolean gtk_load(JNIEnv *env, GtkVersion version, gboolean verbose); gboolean gtk_check_version(GtkVersion version); +typedef struct _GThreadFunctions GThreadFunctions; +static gboolean (*fp_g_thread_get_initialized)(void); +static void (*fp_g_thread_init)(GThreadFunctions *vtable); +static void (*fp_gdk_threads_init)(void); +static void (*fp_gdk_threads_enter)(void); +static void (*fp_gdk_threads_leave)(void); + extern GtkApi* gtk; #endif /* !_GTK_INTERFACE_H */
--- a/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c Mon Mar 04 16:45:37 2019 +0000 +++ b/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2018, 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
--- a/src/solaris/native/sun/awt/swing_GTKEngine.c Mon Mar 04 16:45:37 2019 +0000 +++ b/src/solaris/native/sun/awt/swing_GTKEngine.c Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2018, 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
--- a/src/solaris/native/sun/awt/swing_GTKStyle.c Mon Mar 04 16:45:37 2019 +0000 +++ b/src/solaris/native/sun/awt/swing_GTKStyle.c Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2018, 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
--- a/src/solaris/native/sun/xawt/XToolkit.c Mon Mar 04 16:45:37 2019 +0000 +++ b/src/solaris/native/sun/xawt/XToolkit.c Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2018, 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 @@ -579,7 +579,7 @@ */ static uint32_t get_poll_timeout(jlong nextTaskTime) { - uint32_t ret_timeout; + uint32_t ret_timeout = 0; uint32_t timeout; uint32_t taskTimeout; uint32_t flushTimeout;
--- a/src/solaris/native/sun/xawt/awt_Desktop.c Mon Mar 04 16:45:37 2019 +0000 +++ b/src/solaris/native/sun/xawt/awt_Desktop.c Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2018, 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
--- a/src/solaris/native/sun/xawt/gnome_interface.h Mon Mar 04 16:45:37 2019 +0000 +++ b/src/solaris/native/sun/xawt/gnome_interface.h Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, 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
--- a/src/windows/classes/java/util/prefs/WindowsPreferences.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/windows/classes/java/util/prefs/WindowsPreferences.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2018, 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 @@ -82,14 +82,40 @@ /** * User root node. */ - static final Preferences userRoot = - new WindowsPreferences(USER_ROOT_NATIVE_HANDLE, WINDOWS_ROOT_PATH); + private static volatile Preferences userRoot; + + static Preferences getUserRoot() { + Preferences root = userRoot; + if (root == null) { + synchronized (WindowsPreferences.class) { + root = userRoot; + if (root == null) { + root = new WindowsPreferences(USER_ROOT_NATIVE_HANDLE, WINDOWS_ROOT_PATH); + userRoot = root; + } + } + } + return root; + } /** * System root node. */ - static final Preferences systemRoot = - new WindowsPreferences(SYSTEM_ROOT_NATIVE_HANDLE, WINDOWS_ROOT_PATH); + private static volatile Preferences systemRoot; + + static Preferences getSystemRoot() { + Preferences root = systemRoot; + if (root == null) { + synchronized (WindowsPreferences.class) { + root = systemRoot; + if (root == null) { + root = new WindowsPreferences(SYSTEM_ROOT_NATIVE_HANDLE, WINDOWS_ROOT_PATH); + systemRoot = root; + } + } + } + return root; + } /* Windows error codes. */ private static final int ERROR_SUCCESS = 0;
--- a/src/windows/classes/java/util/prefs/WindowsPreferencesFactory.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/windows/classes/java/util/prefs/WindowsPreferencesFactory.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2018, 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 @@ -39,13 +39,13 @@ * Returns WindowsPreferences.userRoot */ public Preferences userRoot() { - return WindowsPreferences.userRoot; + return WindowsPreferences.getUserRoot(); } /** * Returns WindowsPreferences.systemRoot */ public Preferences systemRoot() { - return WindowsPreferences.systemRoot; + return WindowsPreferences.getSystemRoot(); } }
--- a/src/windows/classes/sun/nio/fs/WindowsSecurity.java Mon Mar 04 16:45:37 2019 +0000 +++ b/src/windows/classes/sun/nio/fs/WindowsSecurity.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2018, 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 @@ -102,9 +102,8 @@ final boolean stopImpersontating = impersontating; final boolean needToRevert = elevated; - return new Privilege() { - @Override - public void drop() { + return () -> { + try { if (token != 0L) { try { if (stopImpersontating) @@ -118,6 +117,8 @@ CloseHandle(token); } } + } finally { + LocalFree(pLuid); } }; }
--- a/src/windows/native/java/io/WinNTFileSystem_md.c Mon Mar 04 16:45:37 2019 +0000 +++ b/src/windows/native/java/io/WinNTFileSystem_md.c Fri Apr 12 21:32:38 2019 +0100 @@ -626,6 +626,7 @@ jstring name; jclass str_class; WCHAR *pathbuf; + DWORD err; str_class = JNU_ClassString(env); CHECK_NULL_RETURN(str_class, NULL); @@ -687,8 +688,10 @@ len = 0; maxlen = 16; rv = (*env)->NewObjectArray(env, maxlen, str_class, NULL); - if (rv == NULL) // Couldn't allocate an array + if (rv == NULL) { // Couldn't allocate an array + FindClose(handle); return NULL; + } /* Scan the directory */ do { if (!wcscmp(find_data.cFileName, L".") @@ -696,13 +699,17 @@ continue; name = (*env)->NewString(env, find_data.cFileName, (jsize)wcslen(find_data.cFileName)); - if (name == NULL) - return NULL; // error; + if (name == NULL) { + FindClose(handle); + return NULL; // error + } if (len == maxlen) { old = rv; rv = (*env)->NewObjectArray(env, maxlen <<= 1, str_class, NULL); - if (rv == NULL || JNU_CopyObjectArray(env, rv, old, len) < 0) + if (rv == NULL || JNU_CopyObjectArray(env, rv, old, len) < 0) { + FindClose(handle); return NULL; // error + } (*env)->DeleteLocalRef(env, old); } (*env)->SetObjectArrayElement(env, rv, len++, name); @@ -710,9 +717,11 @@ } while (FindNextFileW(handle, &find_data)); - if (GetLastError() != ERROR_NO_MORE_FILES) + err = GetLastError(); + FindClose(handle); + if (err != ERROR_NO_MORE_FILES) { return NULL; // error - FindClose(handle); + } /* Copy the final results into an appropriately-sized array */ old = rv;
--- a/src/windows/native/java/io/io_util_md.c Mon Mar 04 16:45:37 2019 +0000 +++ b/src/windows/native/java/io/io_util_md.c Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2018, 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 @@ -169,9 +169,6 @@ pathbuf = (WCHAR*)malloc((pathlen + 6) * sizeof(WCHAR)); if (pathbuf != 0) { wcscpy(pathbuf, ps); - } else { - JNU_ThrowOutOfMemoryError(env, "native memory allocation failed"); - return NULL; } } } else { @@ -199,9 +196,6 @@ pathbuf = (WCHAR*)malloc((pathlen + 6) * sizeof(WCHAR)); if (pathbuf != 0) { wcscpy(pathbuf, ps); - } else { - JNU_ThrowOutOfMemoryError(env, "native memory allocation failed"); - return NULL; } } } @@ -218,9 +212,6 @@ pathbuf = (WCHAR*)malloc(sizeof(WCHAR)); if (pathbuf != NULL) { pathbuf[0] = L'\0'; - } else { - JNU_ThrowOutOfMemoryError(env, "native memory allocation failed"); - return NULL; } } } @@ -228,7 +219,6 @@ if (!(*env)->ExceptionCheck(env)) { JNU_ThrowOutOfMemoryError(env, "native memory allocation failed"); } - return NULL; } return pathbuf; }
--- a/src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c Mon Mar 04 16:45:37 2019 +0000 +++ b/src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2018, 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 @@ -1074,8 +1074,11 @@ if (pLuid == NULL) { JNU_ThrowInternalError(env, "Unable to allocate LUID structure"); } else { - if (LookupPrivilegeValueW(NULL, lpName, pLuid) == 0) + if (LookupPrivilegeValueW(NULL, lpName, pLuid) == 0) { + LocalFree(pLuid); throwWindowsException(env, GetLastError()); + return (jlong)0; + } } return ptr_to_jlong(pLuid); }
--- a/test/ProblemList.txt Mon Mar 04 16:45:37 2019 +0000 +++ b/test/ProblemList.txt Fri Apr 12 21:32:38 2019 +0100 @@ -289,9 +289,6 @@ # 8043951 sun/security/pkcs11/MessageDigest/TestCloning.java solaris-all -# 8156709 -sun/security/provider/SecureRandom/StrongSecureRandom.java macosx-x64 - # 8163498 sun/security/provider/NSASuiteB/TestDSAGenParameterSpec.java linux-i586 @@ -308,9 +305,6 @@ # 8206909 com/sun/crypto/provider/CICO/PBEFunc/CICOPBEFuncTest.java solaris-sparcv9 -# 8206911 -javax/xml/crypto/dsig/GenerationTests.java solaris-all - # 8206912 sun/security/krb5/auto/ReplayCacheTestProc.java solaris-sparcv9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/com/sun/jdi/MethodInvokeWithTraceOnTest.java Fri Apr 12 21:32:38 2019 +0100 @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2018, 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. + */ + +/** + * @test + * @bug 8193879 8193801 8129348 + * @summary Invokes static and instance methods when debugger trace + * mode is on. + * @library /lib/testlibrary + * @run build TestScaffold VMConnection TargetListener TargetAdapter + * @run compile -g MethodInvokeWithTraceOnTest.java + * @run driver MethodInvokeWithTraceOnTest + */ + +import com.sun.jdi.*; +import com.sun.jdi.event.*; +import com.sun.jdi.request.*; + +import java.util.*; + +import jdk.testlibrary.Utils; + +/********** target program **********/ +class MethodInvokeWithTraceOnTestTarg { + public static void main(String[] args) { + new MethodInvokeWithTraceOnTestTarg().test(); + } + + private void test() { + Thread thread = Thread.currentThread(); + print(thread); // @1 breakpoint + String str = "test"; + printStatic(str); // @2 breakpoint + + } + + public void print(Object obj) { + System.out.println(obj); + } + + public static void printStatic(Object obj) { + System.out.println(obj); + } + +} + + +/********** test program **********/ + +public class MethodInvokeWithTraceOnTest extends TestScaffold { + + MethodInvokeWithTraceOnTest(String args[]) { + super(args); + } + + public static void main(String[] args) + throws Exception { + new MethodInvokeWithTraceOnTest(args).startTests(); + } + + /********** test core **********/ + + protected void runTests() throws Exception { + init(); + + // Test with suspend policy set to SUSPEND_EVENT_THREAD + BreakpointEvent be = resumeToBreakpoint(true, 1); + System.out.println("Breakpoint 1 is hit, suspendPolicy:" + be.request().suspendPolicy()); + testMethods(be); + + // Test with suspend policy set to SUSPEND_ALL + be = resumeToBreakpoint(false, 2); + System.out.println("Breakpoint 2 is hit, suspendPolicy:" + be.request().suspendPolicy()); + testMethods(be); + + listenUntilVMDisconnect(); + } + + private void init() throws Exception { + startToMain("MethodInvokeWithTraceOnTestTarg"); + vm().setDebugTraceMode(VirtualMachine.TRACE_ALL); + } + + private BreakpointEvent resumeToBreakpoint(boolean suspendThread, int breakpointId) throws Exception { + int bkpLine = Utils.parseBreakpoints(Utils.getTestSourcePath("MethodInvokeWithTraceOnTest.java"), breakpointId).get(0); + System.out.println("Running to line: " + bkpLine); + return resumeTo("MethodInvokeWithTraceOnTestTarg", bkpLine, suspendThread); + } + + private void testMethods(BreakpointEvent be) throws Exception { + System.out.println("Testing methods..."); + ThreadReference thread = be.thread(); + StackFrame frame = thread.frame(0); + ObjectReference thisObj = frame.thisObject(); + LocalVariable threadVar = frame.visibleVariableByName("thread"); + ThreadReference threadObj = (ThreadReference) frame.getValue(threadVar); + StringReference stringObj = vm().mirrorOf("test string"); + int invokeOptions = getMethodInvokeOptions(be); + + testInstanceMethod1(thread, thisObj, stringObj, threadObj, invokeOptions); + testStaticMethod1(thread, thisObj, stringObj, threadObj, invokeOptions); + testStaticMethod2(thread, invokeOptions); + } + + private void testInstanceMethod1(ThreadReference thread, ObjectReference thisObj, StringReference stringObj, + ThreadReference threadObj, int invokeOptions) throws Exception { + ClassType classType = (ClassType) thisObj.referenceType(); + Method printMethod = classType.methodsByName("print", + "(Ljava/lang/Object;)V").get(0); + + System.out.println("Passing StringReference to instance method..."); + thisObj.invokeMethod(thread, printMethod, Collections.singletonList(stringObj), invokeOptions); + + System.out.println("Passing ThreadReference to instance method..."); + thisObj.invokeMethod(thread, printMethod, Collections.singletonList(threadObj), invokeOptions); + } + + private void testStaticMethod1(ThreadReference thread, ObjectReference thisObj, StringReference stringObj, + ThreadReference threadObj, int invokeOptions) throws Exception { + ClassType classType = (ClassType) thisObj.referenceType(); + Method printMethod = classType.methodsByName("printStatic", + "(Ljava/lang/Object;)V").get(0); + + System.out.println("Passing StringReference to static method..."); + classType.invokeMethod(thread, printMethod, Collections.singletonList(stringObj), invokeOptions); + + System.out.println("Passing ThreadReference to static method..."); + classType.invokeMethod(thread, printMethod, Collections.singletonList(threadObj), invokeOptions); + } + + private void testStaticMethod2(ThreadReference thread, int invokeOptions) throws Exception { + ClassType classType = getClassType("java.lang.Class"); + Method forNameMethod = classType.methodsByName("forName", + "(Ljava/lang/String;)Ljava/lang/Class;").get(0); + StringReference classNameParam = vm().mirrorOf("java.lang.String"); + classType.invokeMethod(thread, forNameMethod, Collections.singletonList(classNameParam), invokeOptions); + } + + private ClassType getClassType(String className) { + List classes = vm().classesByName(className); + return (ClassType) classes.get(0); + } + + private int getMethodInvokeOptions(BreakpointEvent be) { + return be.request().suspendPolicy() == EventRequest.SUSPEND_EVENT_THREAD ? + ObjectReference.INVOKE_SINGLE_THREADED : 0; + } +}
--- a/test/com/sun/jdi/TestScaffold.java Mon Mar 04 16:45:37 2019 +0000 +++ b/test/com/sun/jdi/TestScaffold.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2018, 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 @@ -780,9 +780,16 @@ } public BreakpointEvent resumeTo(Location loc) { + return resumeTo(loc, false); + } + + public BreakpointEvent resumeTo(Location loc, boolean suspendThread) { final BreakpointRequest request = requestManager.createBreakpointRequest(loc); request.addCountFilter(1); + if (suspendThread) { + request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); + } request.enable(); return (BreakpointEvent)waitForRequestedEvent(request); } @@ -841,12 +848,16 @@ } public BreakpointEvent resumeTo(String clsName, int lineNumber) throws AbsentInformationException { + return resumeTo(clsName, lineNumber, false); + } + + public BreakpointEvent resumeTo(String clsName, int lineNumber, boolean suspendThread) throws AbsentInformationException { ReferenceType rt = findReferenceType(clsName); if (rt == null) { rt = resumeToPrepareOf(clsName).referenceType(); } - return resumeTo(findLocation(rt, lineNumber)); + return resumeTo(findLocation(rt, lineNumber), suspendThread); } public ClassPrepareEvent resumeToPrepareOf(String className) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/com/sun/jdi/connect/WildcardPortSupport.java Fri Apr 12 21:32:38 2019 +0100 @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2018, 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. + */ + +/* @test + * @bug 8163083 + * @summary verifies that multiple listeners could be started using wildcard port number + */ + + +import com.sun.jdi.*; +import com.sun.jdi.connect.*; + +import java.io.IOException; +import java.io.PrintStream; + +import java.util.Map; + +public class WildcardPortSupport { + + private static final String PORT_ARG = "port"; + + public static void main(String argv[]) throws Exception { + WildcardPortSupport test = new WildcardPortSupport(); + test.runAllTests(); + } + + public void runAllTests() throws Exception { + ListeningConnector connector = + Bootstrap.virtualMachineManager().listeningConnectors().stream(). + filter(c -> c.name().equals("com.sun.jdi.SocketListen")).findFirst().get(); + + if (connector == null) { + throw new RuntimeException("FAILURE: no com.sun.jdi.SocketListen connectors found!"); + } + + testWithDefaultArgs1(connector); + testWithDefaultArgs2(connector); + testWithWildcardPort1(connector); + testWithWildcardPort2(connector); + testWithDefaultArgsNegative(connector); + } + + + // Start listeners with unspecified port number and use their bound port numbers to stop them + private void testWithDefaultArgs1(ListeningConnector connector) throws IOException, + IllegalConnectorArgumentsException { + int port1 = startListening(connector, connector.defaultArguments()); + int port2 = startListening(connector, connector.defaultArguments()); + connector.stopListening(getArgumentsMap(connector, port1)); + connector.stopListening(getArgumentsMap(connector, port2)); + } + + // Start listeners with unspecified port number and use the original argument map instances to stop them + private void testWithDefaultArgs2(ListeningConnector connector) throws IOException, + IllegalConnectorArgumentsException { + Map<String, Connector.Argument> args1 = connector.defaultArguments(); + startListening(connector, args1); + Map<String, Connector.Argument> args2 = connector.defaultArguments(); + startListening(connector, args2); + connector.stopListening(args1); + connector.stopListening(args2); + } + + // Start listeners with wildcard port number ("0") and use their bound port numbers to stop them + private void testWithWildcardPort1(ListeningConnector connector) throws IOException, + IllegalConnectorArgumentsException { + int port1 = startListening(connector, getArgumentsMap(connector, 0)); + int port2 = startListening(connector, getArgumentsMap(connector, 0)); + connector.stopListening(getArgumentsMap(connector, port1)); + connector.stopListening(getArgumentsMap(connector, port2)); + } + + // Start listeners with wildcard port number ("0") and use the original argument map instances to stop them + private void testWithWildcardPort2(ListeningConnector connector) throws IOException, + IllegalConnectorArgumentsException { + Map<String, Connector.Argument> args1 = getArgumentsMap(connector, 0); + startListening(connector, args1); + Map<String, Connector.Argument> args2 = getArgumentsMap(connector, 0); + startListening(connector, args2); + connector.stopListening(args1); + connector.stopListening(args2); + } + + // Tries to start two listeners using the same instance of default argument map + private void testWithDefaultArgsNegative(ListeningConnector connector) throws IOException, + IllegalConnectorArgumentsException { + Map<String, Connector.Argument> args = connector.defaultArguments(); + connector.startListening(args); + String port = args.get(PORT_ARG).value(); + if (port.isEmpty() || "0".equals(port)) { + throw new RuntimeException("Test testWithDefaultArgsNegative failed." + + " The argument map was not updated with the bound port number."); + } + try { + // This call should fail since the previous the argument map is + // already updated with the port number of the started listener + connector.startListening(args); + } catch (IllegalConnectorArgumentsException ex) { + System.out.println("Expected exception caught" + ex.getMessage()); + return; + } finally { + connector.stopListening(args); + } + throw new RuntimeException("Test testWithDefaultArgsNegative failed. No expected " + + "com.sun.jdi.IllegalConnectorArgumentsException exception was thrown."); + } + + private int startListening(ListeningConnector connector, Map<String, Connector.Argument> args) + throws IOException, IllegalConnectorArgumentsException { + String address = connector.startListening(args); + return Integer.valueOf(address.split(":")[1]); + } + + + private Map<String, Connector.Argument> getArgumentsMap(ListeningConnector connector, int port) { + Map<String, Connector.Argument> args = connector.defaultArguments(); + Connector.Argument arg = args.get(PORT_ARG); + arg.setValue(String.valueOf(port)); + return args; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/Desktop/DesktopGtkLoadTest/DesktopGtkLoadTest.java Fri Apr 12 21:32:38 2019 +0100 @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2018, 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. + */ + +/* @test + * @bug 8157827 + * @summary AWT_Desktop/Automated/Exceptions/BasicTest loads incorrect GTK + * version when jdk.gtk.version=3 + * @requires (os.family == "linux") + * @run main DesktopGtkLoadTest + */ + + +import java.awt.*; +import java.io.*; + +public class DesktopGtkLoadTest { + public static class RunDesktop { + public static void main(String[] args) { + Desktop.getDesktop(); + } + } + + public static void main(String[] args) throws Exception { + Process p = Runtime.getRuntime().exec(System.getProperty("java.home") + + "/bin/java -Djdk.gtk.version=3 -Djdk.gtk.verbose=true " + + "-cp " + System.getProperty("java.class.path", ".") + + " DesktopGtkLoadTest$RunDesktop"); + p.waitFor(); + try (BufferedReader br = new BufferedReader( + new InputStreamReader(p.getErrorStream()))) { + String line; + while ((line = br.readLine()) != null) { + System.out.println(line); + if (line.contains("Looking for GTK2 library")) { + break; + } + if (line.contains("Looking for GTK3 library")) { + return; + } + } + throw new RuntimeException("Wrong GTK library version: \n" + line); + } + + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/Frame/CycleThroughFrameTest/CycleThroughFrameTest.java Fri Apr 12 21:32:38 2019 +0100 @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2018, 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. + */ + +/* + @test + @bug 8206392 + @requires (os.family == "mac") + @summary Cycle through frames using keyboard shortcut doesn't work on Mac + @compile CycleThroughFrameTest.java + @run main/manual CycleThroughFrameTest +*/ + +import java.awt.Frame; +import java.awt.Button; +import java.awt.TextArea; +import java.awt.FlowLayout; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; + +public class CycleThroughFrameTest { + + public static final int maxFrames = 5; + private static JFrame[] frame; + private static Frame instructionFrame; + private static volatile boolean testContinueFlag = true; + + private static final String TEST_INSTRUCTIONS = + " This is a manual test\n\n" + + " 1) Configure Keyboard shortcut if not done in your system:\n" + + " 2) Open System Preferences, go to -> Keyboard -> Shortcuts -> Keyboard\n" + + " 3) Enable 'Move focus to next window' if disabled\n" + + " 4) Enable 'Move focus to next window drawer' if disabled\n" + + " 5) Close System Preferences\n" + + " 5) Press COMMAND + ` keys to cycle through frames in forward order\n" + + " 6) Press FAIL if focus doesn't move to next frame\n" + + " 7) Press COMMAND + SHIFT + ` to cycle through frames in reverse order\n" + + " 8) Press FAIL if focus doesn't move to next frame in reverse order\n" + + " 9) Press PASS otherwise"; + + private static final String FAIL_MESSAGE = "Focus doesn't move to next frame"; + + public void showJFrame(int frameNumber) { + + String title = "Frame " + frameNumber; + frame[frameNumber] = new JFrame(title); + frame[frameNumber].setSize(300, 200); + frame[frameNumber].setLocation(50+(frameNumber*20), 50+(frameNumber*20)); + frame[frameNumber].setVisible(true); + } + + private void createAndShowFrame() throws Exception { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame = new JFrame[maxFrames]; + for (int i = 0; i < maxFrames; i++) { + showJFrame(i); + } + } + }); + } + + public void createAndShowInstructionFrame() { + Button passButton = new Button("Pass"); + passButton.setEnabled(true); + + Button failButton = new Button("Fail"); + failButton.setEnabled(true); + + TextArea instructions = new TextArea(12, 70); + instructions.setText(TEST_INSTRUCTIONS); + + instructionFrame = new Frame("Test Instructions"); + instructionFrame.add(passButton); + instructionFrame.add(failButton); + instructionFrame.add(instructions); + instructionFrame.setSize(200,200); + instructionFrame.setLayout(new FlowLayout()); + instructionFrame.pack(); + instructionFrame.setVisible(true); + + passButton.addActionListener(ae -> { + dispose(); + testContinueFlag = false; + }); + + failButton.addActionListener(ae -> { + dispose(); + testContinueFlag = false; + throw new RuntimeException(FAIL_MESSAGE); + }); + } + + private static void dispose() { + for (int i = 0; i < maxFrames; i++) { + frame[i].dispose(); + } + instructionFrame.dispose(); + } + + public static void main(String[] args) throws Exception { + + CycleThroughFrameTest testObj = new CycleThroughFrameTest(); + testObj.createAndShowFrame(); + testObj.createAndShowInstructionFrame(); + + final int sleepTime = 300000; + final int sleepLoopTime = 1000; + int remainingSleepTime = sleepTime; + while(remainingSleepTime > 0 && testContinueFlag) { + Thread.sleep(sleepLoopTime); + remainingSleepTime -= sleepLoopTime; + } + + if (testContinueFlag) { + dispose(); + throw new RuntimeException("Timed out after " + + (sleepTime - remainingSleepTime) / 1000 + " seconds"); + } + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/Gtk/GtkVersionTest/GtkVersionTest.java Fri Apr 12 21:32:38 2019 +0100 @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2018, 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. + */ + +/* @test + * @bug 8156121 + * @summary "Fail forward" fails for GTK3 if no GTK2 available + * @modules java.desktop/sun.awt + * @requires (os.family == "linux") + * @run main GtkVersionTest + */ + +import sun.awt.UNIXToolkit; + +import java.awt.*; +import java.io.*; + +public class GtkVersionTest { + public static class LoadGtk { + public static void main(String[] args) { + ((UNIXToolkit)Toolkit.getDefaultToolkit()).loadGTK(); + } + } + + public static void main(String[] args) throws Exception { + test(null, "2"); + test("2", "2"); + test("2.2", "2"); + test("3", "3"); + } + + private static void test(String version, String expect) throws Exception { + System.out.println( "Test " + + (version == null ? "no" : " GTK" + version) + " preference."); + System.out.println("java home "+System.getProperty("java.home")); + Process p = Runtime.getRuntime().exec(System.getProperty("java.home") + + "/bin/java " + + (version == null ? "" : "-Djdk.gtk.version=" + version) + + " -Djdk.gtk.verbose=true " + + "-cp " + System.getProperty("java.class.path", ".") + + " GtkVersionTest$LoadGtk"); + p.waitFor(); + + try (BufferedReader br = new BufferedReader( + new InputStreamReader(p.getErrorStream()))) { + String line; + while ((line = br.readLine()) != null) { + System.out.println(line); + if (line.contains("Looking for GTK" + expect + " library")) { + return; + } else if (line.contains("Looking for GTK")) { + break; + } + } + throw new RuntimeException("Wrong GTK library version: expected: " + expect + " actual: " + line + " version: " + version); + } + } + +}
--- a/test/java/awt/Toolkit/ScreenInsetsTest/ScreenInsetsTest.java Mon Mar 04 16:45:37 2019 +0000 +++ b/test/java/awt/Toolkit/ScreenInsetsTest/ScreenInsetsTest.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2018, 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 @@ -32,8 +32,13 @@ @run main ScreenInsetsTest */ -import java.awt.*; -import java.awt.event.*; +import java.awt.Frame; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; +import java.awt.Insets; +import java.awt.Rectangle; +import java.awt.Toolkit; import test.java.awt.regtesthelpers.Util; @@ -41,21 +46,33 @@ { public static void main(String[] args) { - if (!Toolkit.getDefaultToolkit().isFrameStateSupported(Frame.MAXIMIZED_BOTH)) - { - // this state is used in the test - sorry - return; - } - boolean passed = true; GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gds = ge.getScreenDevices(); - for (GraphicsDevice gd : gds) - { + for (GraphicsDevice gd : gds) { + GraphicsConfiguration gc = gd.getDefaultConfiguration(); Rectangle gcBounds = gc.getBounds(); Insets gcInsets = Toolkit.getDefaultToolkit().getScreenInsets(gc); + int left = gcInsets.left; + int right = gcInsets.right; + int bottom = gcInsets.bottom; + int top = gcInsets.top; + if (left < 0 || right < 0 || bottom < 0 || top < 0) { + throw new RuntimeException("Negative value: " + gcInsets); + } + int maxW = gcBounds.width / 3; + int maxH = gcBounds.height / 3; + if (left > maxW || right > maxW || bottom > maxH || top > maxH) { + throw new RuntimeException("Big value: " + gcInsets); + } + + if (!Toolkit.getDefaultToolkit().isFrameStateSupported(Frame.MAXIMIZED_BOTH)) + { + // this state is used in the test - sorry + continue; + } Frame f = new Frame("Test", gc); f.setUndecorated(true);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/awt/Window/WindowOwnedByEmbeddedFrameTest/WindowOwnedByEmbeddedFrameTest.java Fri Apr 12 21:32:38 2019 +0100 @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2018, 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. + */ + +/* @test + * @bug 8130655 + * @summary Tests that window owned by EmbeddedFrame can receive keyboard input + * @requires (os.family == "mac") + * @library ../../regtesthelpers + * @build Util + * @run main WindowOwnedByEmbeddedFrameTest + */ + +import sun.awt.EmbeddedFrame; + +import java.awt.Robot; +import java.awt.TextField; +import java.awt.Window; +import java.awt.event.KeyEvent; + +import test.java.awt.regtesthelpers.Util; + +public class WindowOwnedByEmbeddedFrameTest { + private static TextField textField; + private static EmbeddedFrame embeddedFrame; + private static Window window; + + public static void main(String[] args) { + try { + Robot robot = Util.createRobot(); + robot.setAutoDelay(50); + + embeddedFrame = createEmbeddedFrame(); + + textField = new TextField(""); + + window = new Window(embeddedFrame); + window.setSize(200, 200); + window.setLocationRelativeTo(null); + window.add(textField); + window.setVisible(true); + + Util.waitForIdle(robot); + + Util.clickOnComp(textField, robot); + Util.waitForIdle(robot); + + robot.keyPress(KeyEvent.VK_T); + robot.keyRelease(KeyEvent.VK_T); + Util.waitForIdle(robot); + + robot.keyPress(KeyEvent.VK_E); + robot.keyRelease(KeyEvent.VK_E); + Util.waitForIdle(robot); + + robot.keyPress(KeyEvent.VK_S); + robot.keyRelease(KeyEvent.VK_S); + Util.waitForIdle(robot); + + robot.keyPress(KeyEvent.VK_T); + robot.keyRelease(KeyEvent.VK_T); + Util.waitForIdle(robot); + + if ("".equals(textField.getText())) { + throw new RuntimeException("Keyboard input in text field isn't possible"); + } + } finally { + if (embeddedFrame != null) { + embeddedFrame.dispose(); + } + if (window != null) { + window.dispose(); + } + } + } + + private static EmbeddedFrame createEmbeddedFrame() { + try { + return (EmbeddedFrame) Class.forName("sun.lwawt.macosx.CEmbeddedFrame").newInstance(); + } catch (Exception e) { + throw new RuntimeException("Cannot create EmbeddedFrame", e); + } + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/security/SecureRandom/MacNativePRNGSetSeed.java Fri Apr 12 21:32:38 2019 +0100 @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2016, 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 java.security.SecureRandom; + +/* @test + * @bug 8156709 + * @summary Cannot call setSeed on NativePRNG on Mac if EGD is /dev/urandom + * @requires os.name == "Mac OS X" + * @run main/othervm -Djava.security.egd=file:/dev/urandom MacNativePRNGSetSeed + */ +public class MacNativePRNGSetSeed { + public static void main(String[] args) throws Exception { + SecureRandom sr = SecureRandom.getInstance("NativePRNG"); + sr.setSeed(1); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/imageio/plugins/bmp/BMP8BPPLoadTest.java Fri Apr 12 21:32:38 2019 +0100 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2018, 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. + */ + +/** + * @test + * @bug 8182461 + * @summary Test verifies that the 8BPP indexed color BMP image file is read properly + * @requires BMP8BPPLoadTest.PNG + * @run main BMP8BPPLoadTest + * @author fairoz.matte + */ +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import javax.imageio.ImageIO; + + +public class BMP8BPPLoadTest { + + public BMP8BPPLoadTest() throws IOException { + try { + BufferedImage image = ImageIO.read(new File("BMP8BPPLoadTest.bmp")); + System.out.println("Test Passed ImageIO.read able to read the file"); + } catch (IndexOutOfBoundsException iobe) { + System.out.println("Test Failed with ImageIO.read throwing IndexOutOfBoundsException"); + } + } + + + public static void main(String args[]) throws IOException{ + BMP8BPPLoadTest test = new BMP8BPPLoadTest(); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/sound/sampled/Clip/AutoCloseTimeCheck.java Fri Apr 12 21:32:38 2019 +0100 @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2018, 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 java.applet.AudioClip; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; +import java.util.concurrent.TimeUnit; + +import javax.sound.sampled.AudioFileFormat.Type; +import javax.sound.sampled.AudioFormat; +import javax.sound.sampled.AudioInputStream; +import javax.sound.sampled.AudioSystem; + +import static javax.sound.sampled.AudioFormat.Encoding.PCM_SIGNED; +import static javax.sound.sampled.AudioSystem.NOT_SPECIFIED; + +/** + * @test + * @bug 8202264 + */ +public final class AutoCloseTimeCheck { + + public static void main(final String[] args) throws Exception { + // Prepare the audio file + File file = new File("audio.wav"); + try { + AudioFormat format = + new AudioFormat(PCM_SIGNED, 44100, 8, 1, 1, 44100, false); + AudioSystem.write(getStream(format), Type.WAVE, file); + } catch (final Exception ignored) { + return; // the test is not applicable + } + try { + testSmallDelay(file); + testBigDelay(file); + } finally { + Files.delete(file.toPath()); + } + } + + /** + * Checks that after a big period of non-activity the clip will be closed + * and the "Direct Clip" thread will stop. + */ + private static void testBigDelay(final File file) throws Exception { + AudioClip clip = (AudioClip) file.toURL().getContent(); + clip.loop(); + clip.stop(); + sleep(20000); // 20 sec for slow systems + if (count() != 0) { + throw new RuntimeException("Thread was found"); + } + } + + /** + * Checks that after small period of non-activity the clip will not be + * closed and the "Direct Clip" thread will alive. + */ + private static void testSmallDelay(final File file) throws IOException { + AudioClip clip = (AudioClip) file.toURL().getContent(); + long threadID = 0; + // Will run the test no more than 15 seconds + long endtime = System.nanoTime() + TimeUnit.SECONDS.toNanos(15); + while (endtime - System.nanoTime() > 0) { + clip.loop(); + sleep(500); + + long data = count(); + if (data != threadID) { + System.out.println("Playing on new thread: " + data + " at " + + new java.util.Date()); + if (threadID == 0) { + threadID = data; + } else { + throw new RuntimeException("Thread was changed"); + } + } + + clip.stop(); + sleep(500); + } + } + + private static void sleep(int millis) { + try { + Thread.sleep(millis); + } catch (InterruptedException ignored) { + } + } + + private static long count() { + for (final Thread t : Thread.getAllStackTraces().keySet()) { + if (t.getName().equals("Direct Clip")) { + return t.getId(); + } + } + return 0; + } + + private static AudioInputStream getStream(final AudioFormat format) { + final int dataSize = 5000 * format.getFrameSize(); + final InputStream in = new ByteArrayInputStream(new byte[dataSize]); + return new AudioInputStream(in, format, NOT_SPECIFIED); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/sound/sampled/Clip/ClipIsRunningAfterStop.java Fri Apr 12 21:32:38 2019 +0100 @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2018, 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 java.util.concurrent.TimeUnit; + +import javax.sound.sampled.AudioFormat; +import javax.sound.sampled.AudioSystem; +import javax.sound.sampled.Clip; +import javax.sound.sampled.DataLine; +import javax.sound.sampled.LineUnavailableException; + +import static javax.sound.sampled.AudioFormat.Encoding.PCM_SIGNED; + +/** + * @test + * @bug 8207150 + * @summary Clip.isRunning() may return true after Clip.stop() was called + */ +public final class ClipIsRunningAfterStop { + + private static volatile Exception failed; + + public static void main(final String[] args) throws Exception { + final Runnable r = () -> { + try { + test(); + } catch (LineUnavailableException | IllegalArgumentException ignored) { + // the test is not applicable + } catch (Exception ex) { + failed = ex; + } + }; + Thread t1 = new Thread(r); + Thread t2 = new Thread(r); + Thread t3 = new Thread(r); + t1.start(); + t2.start(); + t3.start(); + t1.join(); + t2.join(); + t3.join(); + if (failed != null) { + throw new RuntimeException(failed); + } + } + + private static void test() throws Exception { + // Will run the test no more than 15 seconds + long endtime = System.nanoTime() + TimeUnit.SECONDS.toNanos(15); + while (failed == null && endtime - System.nanoTime() > 0) { + Clip clip = createClip(); + clip.loop(Clip.LOOP_CONTINUOUSLY); + clip.stop(); + if (clip.isRunning()) { + if (clip.isRunning()) { + throw new RuntimeException("Clip is running"); + } + } + if (clip.isActive()) { + if (clip.isActive()) { + throw new RuntimeException("Clip is active"); + } + } + clip.close(); + } + } + + private static Clip createClip() throws LineUnavailableException { + AudioFormat format = + new AudioFormat(PCM_SIGNED, 44100, 8, 1, 1, 44100, false); + DataLine.Info info = new DataLine.Info(Clip.class, format); + Clip clip = (Clip) AudioSystem.getLine(info); + clip.open(format, new byte[2], 0, 2); + return clip; + } +}
--- a/test/javax/swing/JEditorPane/8195095/ImageViewTest.java Mon Mar 04 16:45:37 2019 +0000 +++ b/test/javax/swing/JEditorPane/8195095/ImageViewTest.java Fri Apr 12 21:32:38 2019 +0100 @@ -23,7 +23,7 @@ /** * @test - * @bug 8195095 + * @bug 8195095 8208638 * @summary Tests if Images are scaled correctly in JEditorPane. * @run main ImageViewTest */ @@ -39,25 +39,23 @@ public class ImageViewTest { - private static final int WIDTH = 200; - private static final int HEIGHT = 200; private static JFrame f; - private static JEditorPane editorPane1; - private static JEditorPane editorPane2; - private static JEditorPane editorPane3; - private static JEditorPane editorPane4; - - private static void test(Robot r, JEditorPane editorPane) throws Exception { + private static void test(Robot r, JEditorPane editorPane, + final int WIDTH, final int HEIGHT ) throws Exception { SwingUtilities.invokeAndWait(() -> { f = new JFrame(); editorPane.setEditable(false); f.add(editorPane); - f.setSize(220,240); + f.setSize(WIDTH + 20, HEIGHT + 40); f.setLocationRelativeTo(null); f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + //This line will trigger the imageupdate, and consequently, the view + //will be populated with the appropriate color when the pixel color + //is queried by robot. + editorPane.getUI().getPreferredSize(editorPane); f.setVisible(true); }); @@ -108,34 +106,78 @@ Robot r = new Robot(); + final JEditorPane[] editorPanes = new JEditorPane[11]; + SwingUtilities.invokeAndWait(() -> { - editorPane1 = new JEditorPane("text/html", + editorPanes[0] = new JEditorPane("text/html", "<img height=\"200\" src=\"file:///" + ABSOLUTE_FILE_PATH + "\""); - editorPane2 = new JEditorPane("text/html", + editorPanes[1] = new JEditorPane("text/html", "<img width=\"200\" src=\"file:///" + ABSOLUTE_FILE_PATH + "\""); - editorPane3 = new JEditorPane("text/html", + editorPanes[2] = new JEditorPane("text/html", "<img width=\"200\" height=\"200\" src=\"file:///" + ABSOLUTE_FILE_PATH + "\""); - editorPane4 = new JEditorPane("text/html", + editorPanes[3] = new JEditorPane("text/html", "<img src=\"file:///" + ABSOLUTE_FILE_PATH + "\""); + editorPanes[4] = new JEditorPane("text/html", + "<img width=\"100\" src =\"file:///" + ABSOLUTE_FILE_PATH + "\""); + + editorPanes[5] = new JEditorPane("text/html", + "<img height=\"100\" src =\"file:///" + ABSOLUTE_FILE_PATH + "\""); + + editorPanes[6] = new JEditorPane("text/html", + "<img width=\"100\" height=\"100\" src =\"file:///" + ABSOLUTE_FILE_PATH + "\""); + + editorPanes[7] = new JEditorPane("text/html", + "<img width=\"50\" src =\"file:///" + ABSOLUTE_FILE_PATH + "\""); + + editorPanes[8] = new JEditorPane("text/html", + "<img height=\"50\" src =\"file:///" + ABSOLUTE_FILE_PATH + "\""); + + editorPanes[9] = new JEditorPane("text/html", + "<img width=\"300\" src =\"file:///" + ABSOLUTE_FILE_PATH + "\""); + + editorPanes[10] = new JEditorPane("text/html", + "<img height=\"300\" src =\"file:///" + ABSOLUTE_FILE_PATH + "\""); + }); r.waitForIdle(); System.out.println("Test with only height set to 200"); - test(r, editorPane1); + test(r, editorPanes[0], 200, 200); System.out.println("Test with only width set to 200"); - test(r, editorPane2); + test(r, editorPanes[1], 200, 200); + + System.out.println("Test with both of them set"); + test(r, editorPanes[2], 200, 200); + + System.out.println("Test with none of them set to 200"); + test(r, editorPanes[3], 200, 200); + + System.out.println("Test with only width set to 100"); + test(r, editorPanes[4], 100, 100); + + System.out.println("Test with only height set to 100"); + test(r, editorPanes[5], 100, 100); - System.out.println("Test with none of them set"); - test(r, editorPane3); + System.out.println("Test with both width and height set to 100"); + test(r, editorPanes[6], 100, 100); + + System.out.println("Test with only width set to 50"); + test(r, editorPanes[7], 50, 50); - System.out.println("Test with both of them set to 200"); - test(r, editorPane4); + System.out.println("Test with only height set to 50"); + test(r, editorPanes[8], 50, 50); + + System.out.println("Test with only width set to 300"); + test(r, editorPanes[9], 300, 300); + + System.out.println("Test with only height set to 300"); + test(r, editorPanes[10], 300, 300); System.out.println("Test Passed."); }
--- a/test/javax/swing/LookAndFeel/8145547/DemandGTK.java Mon Mar 04 16:45:37 2019 +0000 +++ b/test/javax/swing/LookAndFeel/8145547/DemandGTK.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 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 @@ -69,4 +69,3 @@ } } -
--- a/test/javax/swing/LookAndFeel/8145547/DemandGTK2.sh Mon Mar 04 16:45:37 2019 +0000 +++ b/test/javax/swing/LookAndFeel/8145547/DemandGTK2.sh Fri Apr 12 21:32:38 2019 +0100 @@ -1,7 +1,7 @@ #!/bin/ksh -p # -# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2018, 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 @@ -86,5 +86,3 @@ echo "Failed. Examine logs." exit 3 fi - -
--- a/test/javax/swing/LookAndFeel/8145547/DemandGTK2.txt Mon Mar 04 16:45:37 2019 +0000 +++ b/test/javax/swing/LookAndFeel/8145547/DemandGTK2.txt Fri Apr 12 21:32:38 2019 +0100 @@ -34,3 +34,4 @@ sudo mv /usr/lib/x86_64-linux-gnu/bak.libgtk-x11-2.0.so.0.2400.23 /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.23 Needless to say, you should substitute your own library path and however you run jtreg. +
--- a/test/javax/swing/LookAndFeel/8145547/DemandGTK3.sh Mon Mar 04 16:45:37 2019 +0000 +++ b/test/javax/swing/LookAndFeel/8145547/DemandGTK3.sh Fri Apr 12 21:32:38 2019 +0100 @@ -1,7 +1,7 @@ #!/bin/ksh -p # -# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2018, 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 @@ -79,4 +79,3 @@ echo "Failed. Examine logs." exit 3 fi -
--- a/test/javax/swing/LookAndFeel/8145547/ProvokeGTK.java Mon Mar 04 16:45:37 2019 +0000 +++ b/test/javax/swing/LookAndFeel/8145547/ProvokeGTK.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 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 @@ -54,4 +54,3 @@ } } -
--- a/test/javax/xml/crypto/dsig/GenerationTests.java Mon Mar 04 16:45:37 2019 +0000 +++ b/test/javax/xml/crypto/dsig/GenerationTests.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2018, 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 @@ -23,11 +23,12 @@ /** * @test - * @bug 4635230 6283345 6303830 6824440 6867348 7094155 8038184 8038349 8074784 + * @bug 4635230 6283345 6303830 6824440 6867348 7094155 8038184 + * 8038349 8074784 8210736 * @summary Basic unit tests for generating XML Signatures with JSR 105 * @compile -XDignore.symbol.file KeySelectors.java SignatureValidator.java * X509KeySelector.java GenerationTests.java - * @run main/othervm GenerationTests + * @run main/othervm -Dsun.net.httpserver.nodelay=true GenerationTests * @author Sean Mullan */ @@ -46,6 +47,7 @@ import java.security.PrivateKey; import java.security.PublicKey; import java.security.SecureRandom; +import java.security.Security; import java.security.cert.Certificate; import java.security.cert.CertificateFactory; import java.security.cert.X509CRL; @@ -120,6 +122,9 @@ private static final String BOGUS = "bogus"; + private static final String OS = System.getProperty("os.name"); + private static boolean secondChanceGranted = false; + private static final String xslt = "" + "<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'\n" + " xmlns='http://www.w3.org/TR/xhtml1/strict' \n" @@ -1312,7 +1317,7 @@ } } - System.out.println("Test case passed"); + if (result) System.out.println("Test case passed"); } static boolean test_create_detached_signature(String canonicalizationMethod, @@ -1442,7 +1447,15 @@ boolean success = signature.validate(vc); if (!success) { System.out.println("Core signature validation failed"); - return false; + if (!secondChanceGranted && OS.contains("SunOS")) { + removePKCS11Provider(); + // set up the test again + return test_create_detached_signature(canonicalizationMethod, + signatureMethod, digestMethod, transform, + keyInfo, contentType, port); + } else { + return false; + } } success = signature.getSignatureValue().validate(vc); @@ -1454,6 +1467,18 @@ return true; } + /* + * Helper method for cases where we're running on unpatched + * solaris systems where PKCS11 native libraries are unpatched + */ + private static void removePKCS11Provider() throws Exception { + secondChanceGranted = true; + Security.removeProvider("SunPKCS11-Solaris"); + System.out.println("Second chance granted. Provider list: " + + Arrays.toString(Security.getProviders())); + setup(); + } + private static final String DSA_Y = "070662842167565771936588335128634396171789331656318483584455493822" + "400811200853331373030669235424928346190274044631949560438023934623" +
--- a/test/lib/testlibrary/jdk/testlibrary/Utils.java Mon Mar 04 16:45:37 2019 +0000 +++ b/test/lib/testlibrary/jdk/testlibrary/Utils.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, 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 @@ -37,12 +37,15 @@ import java.util.ArrayList; import java.util.List; import java.util.Arrays; +import java.util.LinkedList; +import java.nio.file.Paths; import java.util.Collections; import java.util.Objects; import java.util.regex.Pattern; import java.util.regex.Matcher; import java.util.concurrent.TimeUnit; import java.util.function.Function; +import java.nio.file.Files; /** * Common library for various test helper functions. @@ -411,4 +414,30 @@ } return transferred; } + + // Parses the specified source file for "@{id} breakpoint" tags and returns + // list of the line numbers containing the tag. + // Example: + // System.out.println("BP is here"); // @1 breakpoint + public static List<Integer> parseBreakpoints(String filePath, int id) { + final String pattern = "@" + id + " breakpoint"; + int lineNum = 1; + List<Integer> result = new LinkedList<>(); + try { + for (String line: Files.readAllLines(Paths.get(filePath))) { + if (line.contains(pattern)) { + result.add(lineNum); + } + lineNum++; + } + } catch (IOException ex) { + throw new RuntimeException("failed to parse " + filePath, ex); + } + return result; + } + + // gets full test source path for the given test filename + public static String getTestSourcePath(String fileName) { + return Paths.get(System.getProperty("test.src")).resolve(fileName).toString(); + } }
--- a/test/sun/security/krb5/auto/KDC.java Mon Mar 04 16:45:37 2019 +0000 +++ b/test/sun/security/krb5/auto/KDC.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2018, 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 @@ -28,6 +28,10 @@ import java.io.*; import java.lang.reflect.Method; import java.security.SecureRandom; +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import java.time.temporal.TemporalAmount; +import java.time.temporal.TemporalUnit; import java.util.*; import java.util.concurrent.*; @@ -41,6 +45,8 @@ import sun.security.util.DerInputStream; import sun.security.util.DerOutputStream; import sun.security.util.DerValue; +import java.util.regex.Matcher; +import java.util.regex.Pattern; /** * A KDC server. @@ -123,6 +129,9 @@ // Under the hood. + public static final int DEFAULT_LIFETIME = 39600; + public static final int DEFAULT_RENEWTIME = 86400; + // The random generator to generate random keys (including session keys) private static SecureRandom secureRandom = new SecureRandom(); @@ -620,6 +629,15 @@ } /** + * Returns a KerberosTime. + * + * @param offset offset from NOW in seconds + */ + private static KerberosTime timeAfter(int offset) { + return new KerberosTime(new Date().getTime() + offset * 1000L); + } + + /** * Processes an incoming request and generates a response. * @param in the request * @return the response @@ -919,11 +937,27 @@ EncryptionKey key = generateRandomKey(eType); // Check time, TODO KerberosTime till = body.till; + KerberosTime rtime = body.rtime; if (till == null) { throw new KrbException(Krb5.KDC_ERR_NEVER_VALID); // TODO } else if (till.isZero()) { - till = new KerberosTime(new Date().getTime() + 1000 * 3600 * 11); + String ttlsVal = System.getProperty("test.kdc.ttl.value"); + if (ttlsVal != null){ + till = timeAfter(duration(ttlsVal)); + if (till.greaterThan(timeAfter(24 * 3600)) && + (System.getProperty("test.kdc.force.till") == null)) { + till = timeAfter(DEFAULT_LIFETIME); + body.kdcOptions.set(KDCOptions.RENEWABLE, true); + } + } else { + till = timeAfter(DEFAULT_LIFETIME); + } } + + if (rtime == null && body.kdcOptions.get(KDCOptions.RENEWABLE)) { + rtime = timeAfter(DEFAULT_RENEWTIME); + } + //body.from boolean[] bFlags = new boolean[Krb5.TKT_OPTS_MAX+1]; if (body.kdcOptions.get(KDCOptions.FORWARDABLE)) { @@ -1079,7 +1113,7 @@ new TransitedEncoding(1, new byte[0]), new KerberosTime(new Date()), body.from, - till, body.rtime, + till, rtime, body.addresses, null); Ticket t = new Ticket( @@ -1097,7 +1131,7 @@ tFlags, new KerberosTime(new Date()), body.from, - till, body.rtime, + till, rtime, service, body.addresses ); @@ -1169,6 +1203,72 @@ } /** + * Translates a duration value into seconds. + * + * The format can be one of "h:m[:s]", "NdNhNmNs", and "N". See + * http://web.mit.edu/kerberos/krb5-devel/doc/basic/date_format.html#duration + * for definitions. + * + * @param s the string duration + * @return time in seconds + * @throw KrbException if format is illegal + */ + public static int duration(String s) throws KrbException { + + if (s.isEmpty()) { + throw new KrbException("Duration cannot be empty"); + } + + // N + if (s.matches("\\d+")) { + return Integer.parseInt(s); + } + + // h:m[:s] + Matcher m = Pattern.compile("(\\d+):(\\d+)(:(\\d+))?").matcher(s); + if (m.matches()) { + int hr = Integer.parseInt(m.group(1)); + int min = Integer.parseInt(m.group(2)); + if (min >= 60) { + throw new KrbException("Illegal duration format " + s); + } + int result = hr * 3600 + min * 60; + if (m.group(4) != null) { + int sec = Integer.parseInt(m.group(4)); + if (sec >= 60) { + throw new KrbException("Illegal duration format " + s); + } + result += sec; + } + return result; + } + + // NdNhNmNs + // 120m allowed. Maybe 1h120m is not good, but still allowed + m = Pattern.compile( + "((\\d+)d)?\\s*((\\d+)h)?\\s*((\\d+)m)?\\s*((\\d+)s)?", + Pattern.CASE_INSENSITIVE).matcher(s); + if (m.matches()) { + int result = 0; + if (m.group(2) != null) { + result += 86400 * Integer.parseInt(m.group(2)); + } + if (m.group(4) != null) { + result += 3600 * Integer.parseInt(m.group(4)); + } + if (m.group(6) != null) { + result += 60 * Integer.parseInt(m.group(6)); + } + if (m.group(8) != null) { + result += Integer.parseInt(m.group(8)); + } + return result; + } + + throw new KrbException("Illegal duration format " + s); + } + + /** * Generates a line for a KDC to put inside [realms] of krb5.conf * @return REALM.NAME = { kdc = host:port etc } */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/security/krb5/auto/LongLife.java Fri Apr 12 21:32:38 2019 +0100 @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2018, 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. + */ + +/* + * @test + * @bug 8131051 8187218 + * @summary KDC might issue a renewable ticket even if not requested + * @compile -XDignore.symbol.file LongLife.java + * @run main/othervm -Dsun.net.spi.nameservice.provider.1=ns,mock LongLife + */ + +import org.ietf.jgss.GSSCredential; +import org.ietf.jgss.GSSManager; +import sun.security.krb5.Config; +import javax.security.auth.Subject; +import javax.security.auth.kerberos.KerberosTicket; +import java.security.PrivilegedExceptionAction; + +public class LongLife { + + public static void main(String[] args) throws Exception { + + OneKDC kdc = new OneKDC(null).writeJAASConf(); + + test(kdc, "10h", false, 36000, false); + test(kdc, "2d", false, KDC.DEFAULT_LIFETIME, true); + test(kdc, "2d", true, 2 * 24 * 3600, false); + + // 8187218: getRemainingLifetime() is negative if lifetime + // is longer than 30 days. + test(kdc, "30d", true, 30 * 24 * 3600, false); + } + + static void test( + KDC kdc, + String ticketLifetime, + boolean forceTill, // if true, KDC will not try RENEWABLE + int expectedLifeTime, + boolean expectedRenewable) throws Exception { + + KDC.saveConfig(OneKDC.KRB5_CONF, kdc); + Config.refresh(); + + System.setProperty("test.kdc.ttl.value", ticketLifetime); + + if (forceTill) { + System.setProperty("test.kdc.force.till", ""); + } else { + System.clearProperty("test.kdc.force.till"); + } + + Context c = Context.fromJAAS("client"); + + GSSCredential cred = Subject.doAs(c.s(), + (PrivilegedExceptionAction<GSSCredential>) + ()-> { + GSSManager m = GSSManager.getInstance(); + return m.createCredential(GSSCredential.INITIATE_ONLY); + }); + + KerberosTicket tgt = c.s().getPrivateCredentials(KerberosTicket.class) + .iterator().next(); + System.out.println(tgt); + + int actualLifeTime = cred.getRemainingLifetime(); + if (actualLifeTime < (expectedLifeTime - 60 ) + || actualLifeTime > (expectedLifeTime + 60)) { + throw new Exception("actualLifeTime is " + actualLifeTime + + " ExpectedLifeTime is " + expectedLifeTime); + } + + if (tgt.isRenewable() != expectedRenewable) { + throw new Exception("TGT's RENEWABLE flag is " + tgt.isRenewable()); + } + } +}
--- a/test/sun/security/pkcs11/PKCS11Test.java Mon Mar 04 16:45:37 2019 +0000 +++ b/test/sun/security/pkcs11/PKCS11Test.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, 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 @@ -32,6 +32,7 @@ import java.io.InputStreamReader; import java.io.StringReader; import java.lang.reflect.Constructor; +import java.nio.charset.StandardCharsets; import java.security.AlgorithmParameters; import java.security.InvalidAlgorithmParameterException; import java.security.KeyPairGenerator; @@ -346,8 +347,15 @@ getNSSInfo(nss_library); } + // Try to parse the version for the specified library. + // Assuming the library contains either of the following patterns: + // $Header: NSS <version> + // Version: NSS <version> + // Here, <version> stands for NSS version. static double getNSSInfo(String library) { - String nssHeader = "$Header: NSS"; + // look for two types of headers in NSS libraries + String nssHeader1 = "$Header: NSS"; + String nssHeader2 = "Version: NSS"; boolean found = false; String s = null; int i = 0; @@ -374,16 +382,17 @@ read = 100 + is.read(data, 100, 900); } - s = new String(data, 0, read); - if ((i = s.indexOf(nssHeader)) > 0) { - found = true; - // If the nssHeader is before 920 we can break, otherwise - // we may not have the whole header so do another read. If - // no bytes are in the stream, that is ok, found is true. - if (i < 920) { - break; - } - } + s = new String(data, 0, read, StandardCharsets.US_ASCII); + i = s.indexOf(nssHeader1); + if (i > 0 || (i = s.indexOf(nssHeader2)) > 0) { + found = true; + // If the nssHeader is before 920 we can break, otherwise + // we may not have the whole header so do another read. If + // no bytes are in the stream, that is ok, found is true. + if (i < 920) { + break; + } + } } } } catch (Exception e) { @@ -399,7 +408,12 @@ // the index after whitespace after nssHeader int afterheader = s.indexOf("NSS", i) + 4; - String version = s.substring(afterheader, s.indexOf(' ', afterheader)); + String version = String.valueOf(s.charAt(afterheader)); + for (char c = s.charAt(++afterheader); + c == '.' || (c >= '0' && c <= '9'); + c = s.charAt(++afterheader)) { + version += c; + } // If a "dot dot" release, strip the extra dots for double parsing String[] dot = version.split("\\."); @@ -414,6 +428,9 @@ try { nss_version = Double.parseDouble(version); } catch (NumberFormatException e) { + System.out.println("===== Content start ====="); + System.out.println(s); + System.out.println("===== Content end ====="); System.out.println("Failed to parse lib" + library + " version. Set to 0.0"); e.printStackTrace(); @@ -578,6 +595,8 @@ osMap.put("Linux-amd64-64", new String[]{ "/usr/lib/x86_64-linux-gnu/", "/usr/lib/x86_64-linux-gnu/nss/", "/usr/lib64/"}); + osMap.put("Linux-ppc64-64", new String[]{"/usr/lib64/"}); + osMap.put("Linux-ppc64le-64", new String[]{"/usr/lib64/"}); osMap.put("Windows-x86-32", new String[]{ PKCS11_BASE + "/nss/lib/windows-i586/".replace('/', SEP)}); osMap.put("Windows-amd64-64", new String[]{
--- a/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java Mon Mar 04 16:45:37 2019 +0000 +++ b/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java Fri Apr 12 21:32:38 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, 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 @@ -111,7 +111,7 @@ data = new byte[2048]; // keypair generation is very slow, test only a few short keys int[] keyLengths = {512, 512, 1024}; - BigInteger[] pubExps = {null, BigInteger.valueOf(3), null}; + BigInteger[] pubExps = {null, RSAKeyGenParameterSpec.F4, null}; KeyPair[] keyPairs = new KeyPair[3]; new Random().nextBytes(data); KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA", provider);
--- a/test/tools/launcher/Settings.java Mon Mar 04 16:45:37 2019 +0000 +++ b/test/tools/launcher/Settings.java Fri Apr 12 21:32:38 2019 +0100 @@ -74,7 +74,7 @@ static void runTestOptionDefault() throws IOException { String stackSize = "256"; // in kb - if (getArch().equals("ppc64")) { + if (getArch().equals("ppc64") || getArch().equals("ppc64le")) { stackSize = "800"; } TestResult tr = null;