diff --git a/.hgtags b/.hgtags index 4935ca857678cb6b538328b96460df145c533a9d..70d9485e8f6f00063b0345a87a27c0d22d3c62b5 100644 --- a/.hgtags +++ b/.hgtags @@ -152,3 +152,5 @@ c68342532e2e7deb3a25fc04ed3e4c142278f747 jdk8-b27 1e1d41daaded291ab3a370ca6a27f7325701978e jdk8-b28 c5b882dce0fe27e05dc64debc92b1fb9ebf880ec jdk8-b29 cdbb33303ea344d5e9013e2dd642e7a6e7768db6 jdk8-b30 +27f0c08c427c65fcab6917edf646f59058e59524 jdk8-b31 +ddfe5562f61f54ed2121ac0c73b688b94f3e66b5 jdk8-b32 diff --git a/make/common/shared/Sanity.gmk b/make/common/shared/Sanity.gmk index b9f4d2b0c480472f58b88543c418dbeaaa4bee66..27af4fa2e6699681c730c6b25a62657d85a3e53e 100644 --- a/make/common/shared/Sanity.gmk +++ b/make/common/shared/Sanity.gmk @@ -348,7 +348,13 @@ ifneq ($(PLATFORM), windows) " Try setting LANG to 'C'. \n" \ "" >> $(WARNING_FILE) ; \ fi +ifeq ($(PLATFORM), macosx) + @if [ "$(LANG)" = "" ]; then \ + $(ECHO) "ERROR: LANG must be set on Mac OS X. Recommended value is \"C\"" >> $(ERROR_FILE) ; \ + fi endif +endif + ###################################################### # Check the Windows cygwin version diff --git a/make/docs/CORE_PKGS.gmk b/make/docs/CORE_PKGS.gmk index 84c8986370c3ce15464433ff4d01879091b35f96..6b5f4af797ab8e2931303707adca2a73fe2ce160 100644 --- a/make/docs/CORE_PKGS.gmk +++ b/make/docs/CORE_PKGS.gmk @@ -64,7 +64,7 @@ ACTIVE_JSR_PKGS= \ javax.management.* \ javax.script \ javax.sql.* \ - javax.tools \ + javax.tools.* \ javax.xml.* \ org.w3c.* \ org.xml.sax @@ -218,6 +218,7 @@ CORE_PKGS = \ javax.swing.plaf.nimbus \ javax.swing.plaf.synth \ javax.tools \ + javax.tools.annotation \ javax.transaction \ javax.transaction.xa \ javax.xml.parsers \ diff --git a/make/sun/security/ec/Makefile b/make/sun/security/ec/Makefile index 146a24e7a9b1e5306a267145aef3c9ef813a2970..841fc3716d2af1b7acae0c66a5d2ca12bd3783a6 100644 --- a/make/sun/security/ec/Makefile +++ b/make/sun/security/ec/Makefile @@ -159,7 +159,9 @@ ifeq ($(NATIVE_ECC_AVAILABLE), true) $(PKGDIR)/ECDSASignature.java \ $(PKGDIR)/ECKeyPairGenerator.java - JAVAHFLAGS += -Xbootclasspath/p:$(CLASSDESTDIR) + JAVAHFLAGS = -bootclasspath \ + "$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)" + # # C and C++ files diff --git a/make/sun/security/mscapi/Makefile b/make/sun/security/mscapi/Makefile index 389d5a1a01644bcfbcdf125e3afb5c1b1accca00..65eef7826547446663b3cc376e0d4566cd730874 100644 --- a/make/sun/security/mscapi/Makefile +++ b/make/sun/security/mscapi/Makefile @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2012, 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 @@ -149,7 +149,8 @@ OTHER_INCLUDES += \ # Rules # CLASSDESTDIR = $(TEMPDIR)/classes -JAVAHFLAGS += -Xbootclasspath/p:$(CLASSDESTDIR) +JAVAHFLAGS = -bootclasspath \ + "$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)" include $(BUILDDIR)/common/Mapfile-vers.gmk diff --git a/make/sun/security/pkcs11/Makefile b/make/sun/security/pkcs11/Makefile index 7b31f20b550ff67b8d6b9512e3d89758f4058393..d7e049d9e1fd1543620b20cf14e46d14ec7e6538 100644 --- a/make/sun/security/pkcs11/Makefile +++ b/make/sun/security/pkcs11/Makefile @@ -150,7 +150,8 @@ OTHER_INCLUDES += \ # Rules # CLASSDESTDIR = $(TEMPDIR)/classes -JAVAHFLAGS = -bootclasspath "$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)" +JAVAHFLAGS = -bootclasspath \ + "$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)" include $(BUILDDIR)/common/Mapfile-vers.gmk diff --git a/src/macosx/classes/sun/lwawt/LWToolkit.java b/src/macosx/classes/sun/lwawt/LWToolkit.java index b9f4641ba5a358dad89a4e59b21108a5d51e1b3d..f41a944b17c1370226f097b2d1e2ea6ba349da92 100644 --- a/src/macosx/classes/sun/lwawt/LWToolkit.java +++ b/src/macosx/classes/sun/lwawt/LWToolkit.java @@ -522,11 +522,6 @@ public abstract class LWToolkit extends SunToolkit implements Runnable { postEvent(targetToAppContext(event.getSource()), event); } - /* - * Returns true if the application (one of its windows) owns keyboard focus. - */ - public abstract boolean isApplicationActive(); - // use peer's back buffer to implement non-opaque windows. @Override public boolean needUpdateWindow() { diff --git a/src/macosx/classes/sun/lwawt/LWWindowPeer.java b/src/macosx/classes/sun/lwawt/LWWindowPeer.java index bfdd10cdd4ea9f1d2d570199824aacc7ab208b91..3b9ee106e758a3997ff9673a5ddb70b7cc1a41c4 100644 --- a/src/macosx/classes/sun/lwawt/LWWindowPeer.java +++ b/src/macosx/classes/sun/lwawt/LWWindowPeer.java @@ -1067,11 +1067,7 @@ public class LWWindowPeer return false; } - // Cross-app activation requests are not allowed. - if (cause != CausedFocusEvent.Cause.MOUSE_EVENT && - !((LWToolkit)Toolkit.getDefaultToolkit()).isApplicationActive()) - { - focusLog.fine("the app is inactive, so the request is rejected"); + if (platformWindow.rejectFocusRequest(cause)) { return false; } diff --git a/src/macosx/classes/sun/lwawt/PlatformWindow.java b/src/macosx/classes/sun/lwawt/PlatformWindow.java index aeee260b25cb6c4d2b98b08dffbf0ca6f466fa58..0d2a8083752da7809932182a4a2aaf588e757e31 100644 --- a/src/macosx/classes/sun/lwawt/PlatformWindow.java +++ b/src/macosx/classes/sun/lwawt/PlatformWindow.java @@ -27,6 +27,7 @@ package sun.lwawt; import java.awt.*; +import sun.awt.CausedFocusEvent; import sun.java2d.SurfaceData; // TODO Is it worth to generify this interface, like that: @@ -117,6 +118,8 @@ public interface PlatformWindow { public void updateFocusableWindowState(); + public boolean rejectFocusRequest(CausedFocusEvent.Cause cause); + public boolean requestWindowFocus(); /* diff --git a/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java b/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java index 147b12756101484775493a573c0434682651f094..7fd2a0f8f969738aec43422125f902835570da17 100644 --- a/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java +++ b/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java @@ -38,6 +38,8 @@ import java.awt.event.*; public class CEmbeddedFrame extends EmbeddedFrame { private CPlatformResponder responder; + private boolean focused = true; + private boolean parentWindowActive = true; public CEmbeddedFrame() { show(); @@ -94,4 +96,31 @@ public class CEmbeddedFrame extends EmbeddedFrame { public void handleInputEvent(String text) { new RuntimeException("Not implemented"); } + + public void handleFocusEvent(boolean focused) { + this.focused = focused; + updateOverlayWindowActiveState(); + } + + public void handleWindowFocusEvent(boolean parentWindowActive) { + this.parentWindowActive = parentWindowActive; + updateOverlayWindowActiveState(); + } + + public boolean isParentWindowActive() { + return parentWindowActive; + } + + /* + * May change appearance of contents of window, and generate a + * WINDOW_ACTIVATED event. + */ + private void updateOverlayWindowActiveState() { + final boolean showAsFocused = parentWindowActive && focused; + dispatchEvent( + new FocusEvent(this, showAsFocused ? + FocusEvent.FOCUS_GAINED : + FocusEvent.FOCUS_LOST)); + } + } diff --git a/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java b/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java index e4e93143f407a794f692ce6f8508dded938cd499..c355445ac83a6073283929114e305e2f0ea31d76 100644 --- a/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java @@ -33,17 +33,23 @@ import sun.java2d.SurfaceData; import sun.awt.CGraphicsConfig; import sun.awt.CGraphicsDevice; +import sun.awt.CausedFocusEvent; import java.awt.*; import java.awt.BufferCapabilities.FlipContents; +import sun.util.logging.PlatformLogger; + /* * Provides a lightweight implementation of the EmbeddedFrame. */ public class CPlatformEmbeddedFrame implements PlatformWindow { + private static final PlatformLogger focusLogger = PlatformLogger.getLogger("sun.lwawt.macosx.focus.CPlatformEmbeddedFrame"); + private CGLLayer windowLayer; private LWWindowPeer peer; + private CEmbeddedFrame target; private volatile int screenX = 0; private volatile int screenY = 0; @@ -52,6 +58,7 @@ public class CPlatformEmbeddedFrame implements PlatformWindow { public void initialize(Window target, final LWWindowPeer peer, PlatformWindow owner) { this.peer = peer; this.windowLayer = new CGLLayer(peer); + this.target = (CEmbeddedFrame)target; } @Override @@ -148,6 +155,18 @@ public class CPlatformEmbeddedFrame implements PlatformWindow { @Override public void updateFocusableWindowState() {} + @Override + public boolean rejectFocusRequest(CausedFocusEvent.Cause cause) { + // Cross-app activation requests are not allowed. + if (cause != CausedFocusEvent.Cause.MOUSE_EVENT && + !target.isParentWindowActive()) + { + focusLogger.fine("the embedder is inactive, so the request is rejected"); + return true; + } + return false; + } + @Override public boolean requestWindowFocus() { return true; diff --git a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java index ae3fbd54fbf4d91bed1c527ba1cca71f25504755..7f8ee76539b6bf12469b0eec9edeb3add5281d13 100644 --- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java @@ -65,6 +65,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo // Loger to report issues happened during execution but that do not affect functionality private static final PlatformLogger logger = PlatformLogger.getLogger("sun.lwawt.macosx.CPlatformWindow"); + private static final PlatformLogger focusLogger = PlatformLogger.getLogger("sun.lwawt.macosx.focus.CPlatformWindow"); // for client properties public static final String WINDOW_BRUSH_METAL_LOOK = "apple.awt.brushMetalLook"; @@ -112,6 +113,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo static final int MINIMIZABLE = 1 << 8; static final int RESIZABLE = 1 << 9; // both a style bit and prop bit + static final int NONACTIVATING = 1 << 24; static final int _STYLE_PROP_BITMASK = DECORATED | TEXTURED | UNIFIED | UTILITY | HUD | SHEET | CLOSEABLE | MINIMIZABLE | RESIZABLE; @@ -127,9 +129,6 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo static final int _METHOD_PROP_BITMASK = RESIZABLE | HAS_SHADOW | ZOOMABLE | ALWAYS_ON_TOP | HIDES_ON_DEACTIVATE | DRAGGABLE_BACKGROUND | DOCUMENT_MODIFIED | FULLSCREENABLE; - // not sure - static final int POPUP = 1 << 14; - // corresponds to callback-based properties static final int SHOULD_BECOME_KEY = 1 << 12; static final int SHOULD_BECOME_MAIN = 1 << 13; @@ -264,10 +263,6 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo // defaults style bits int styleBits = DECORATED | HAS_SHADOW | CLOSEABLE | MINIMIZABLE | ZOOMABLE | RESIZABLE; - if (target.getName() == "###overrideRedirect###") { - styleBits = SET(styleBits, POPUP, true); - } - if (isNativelyFocusableWindow()) { styleBits = SET(styleBits, SHOULD_BECOME_KEY, true); styleBits = SET(styleBits, SHOULD_BECOME_MAIN, true); @@ -275,6 +270,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo final boolean isFrame = (target instanceof Frame); final boolean isDialog = (target instanceof Dialog); + final boolean isPopup = (target.getType() == Window.Type.POPUP); if (isDialog) { styleBits = SET(styleBits, MINIMIZABLE, false); } @@ -304,8 +300,10 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo } // If the target is a dialog, popup or tooltip we want it to ignore the brushed metal look. - if (!isDialog && IS(styleBits, POPUP)) { + if (isPopup) { styleBits = SET(styleBits, TEXTURED, true); + // Popups in applets don't activate applet's process + styleBits = SET(styleBits, NONACTIVATING, true); } if (target instanceof javax.swing.RootPaneContainer) { @@ -498,12 +496,19 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo // If it ain't blocked, or is being hidden, go regular way if (visible) { CWrapper.NSWindow.makeFirstResponder(nsWindowPtr, contentView.getAWTView()); - boolean isKeyWindow = CWrapper.NSWindow.isKeyWindow(nsWindowPtr); - if (!isKeyWindow) { - CWrapper.NSWindow.makeKeyAndOrderFront(nsWindowPtr); + + boolean isPopup = (target.getType() == Window.Type.POPUP); + if (isPopup) { + // Popups in applets don't activate applet's process + CWrapper.NSWindow.orderFrontRegardless(nsWindowPtr); } else { CWrapper.NSWindow.orderFront(nsWindowPtr); } + + boolean isKeyWindow = CWrapper.NSWindow.isKeyWindow(nsWindowPtr); + if (!isKeyWindow) { + CWrapper.NSWindow.makeKeyWindow(nsWindowPtr); + } } else { CWrapper.NSWindow.orderOut(nsWindowPtr); } @@ -599,8 +604,21 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo nativeSetNSWindowMinMax(nsWindowPtr, min.getWidth(), min.getHeight(), max.getWidth(), max.getHeight()); } + @Override + public boolean rejectFocusRequest(CausedFocusEvent.Cause cause) { + // Cross-app activation requests are not allowed. + if (cause != CausedFocusEvent.Cause.MOUSE_EVENT && + !((LWCToolkit)Toolkit.getDefaultToolkit()).isApplicationActive()) + { + focusLogger.fine("the app is inactive, so the request is rejected"); + return true; + } + return false; + } + @Override public boolean requestWindowFocus() { + long ptr = getNSWindowPtr(); if (CWrapper.NSWindow.canBecomeMainWindow(ptr)) { CWrapper.NSWindow.makeMainWindow(ptr); @@ -751,6 +769,11 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo * Callbacks from the AWTWindow and AWTView objc classes. *************************************************************/ private void deliverWindowFocusEvent(boolean gained){ + // Fix for 7150349: ingore "gained" notifications when the app is inactive. + if (gained && !((LWCToolkit)Toolkit.getDefaultToolkit()).isApplicationActive()) { + focusLogger.fine("the app is inactive, so the notification is ignored"); + return; + } peer.notifyActivation(gained); } diff --git a/src/macosx/classes/sun/lwawt/macosx/CWrapper.java b/src/macosx/classes/sun/lwawt/macosx/CWrapper.java index bc25f18b4dc75b53af64aa37aaeada1fc5ea08e2..385259e352e77a79a253b8309989b7c8c354aff0 100644 --- a/src/macosx/classes/sun/lwawt/macosx/CWrapper.java +++ b/src/macosx/classes/sun/lwawt/macosx/CWrapper.java @@ -47,6 +47,7 @@ public final class CWrapper { public static native void setLevel(long window, int level); public static native void makeKeyAndOrderFront(long window); + public static native void makeKeyWindow(long window); public static native void makeMainWindow(long window); public static native boolean canBecomeMainWindow(long window); public static native boolean isKeyWindow(long window); diff --git a/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java b/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java index 8365a509c439754f36c22129054b15a4e6b19054..fd4a15a3d6ff75191928a89144ce037e1a310ed8 100644 --- a/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java +++ b/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java @@ -686,7 +686,10 @@ public class LWCToolkit extends LWToolkit { return sunAwtDisableCALayers.booleanValue(); } - @Override + + /* + * Returns true if the application (one of its windows) owns keyboard focus. + */ public native boolean isApplicationActive(); /************************ diff --git a/src/macosx/native/sun/awt/AWTView.m b/src/macosx/native/sun/awt/AWTView.m index 5b61e2737149eeedb3c1e6899783a6122191c700..4555d2732ca15c032f479164e5ce8db72d3c24b5 100644 --- a/src/macosx/native/sun/awt/AWTView.m +++ b/src/macosx/native/sun/awt/AWTView.m @@ -812,7 +812,7 @@ JNF_CLASS_CACHE(jc_CInputMethod, "sun/lwawt/macosx/CInputMethod"); // Unicode value. NSUInteger utf8Length = [aString lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; - if ([self hasMarkedText] || !fProcessingKeystroke || (utf8Length > 2)) { + if ([self hasMarkedText] || !fProcessingKeystroke || (utf8Length > 1)) { JNIEnv *env = [ThreadUtilities getJNIEnv]; static JNF_MEMBER_CACHE(jm_selectPreviousGlyph, jc_CInputMethod, "selectPreviousGlyph", "()V"); diff --git a/src/macosx/native/sun/awt/AWTWindow.m b/src/macosx/native/sun/awt/AWTWindow.m index 5beb2eb1173a42c7d5bf5a9a65e80286fd57b11e..51b3c01601edee468e500d112de3c71a1de3503e 100644 --- a/src/macosx/native/sun/awt/AWTWindow.m +++ b/src/macosx/native/sun/awt/AWTWindow.m @@ -102,11 +102,12 @@ static JNF_CLASS_CACHE(jc_CPlatformWindow, "sun/lwawt/macosx/CPlatformWindow"); type |= NSBorderlessWindowMask; } - if (IS(styleBits, TEXTURED)) type |= NSTexturedBackgroundWindowMask; - if (IS(styleBits, UNIFIED)) type |= NSUnifiedTitleAndToolbarWindowMask; - if (IS(styleBits, UTILITY)) type |= NSUtilityWindowMask; - if (IS(styleBits, HUD)) type |= NSHUDWindowMask; - if (IS(styleBits, SHEET)) type |= NSDocModalWindowMask; + if (IS(styleBits, TEXTURED)) type |= NSTexturedBackgroundWindowMask; + if (IS(styleBits, UNIFIED)) type |= NSUnifiedTitleAndToolbarWindowMask; + if (IS(styleBits, UTILITY)) type |= NSUtilityWindowMask; + if (IS(styleBits, HUD)) type |= NSHUDWindowMask; + if (IS(styleBits, SHEET)) type |= NSDocModalWindowMask; + if (IS(styleBits, NONACTIVATING)) type |= NSNonactivatingPanelMask; return type; } diff --git a/src/macosx/native/sun/awt/CWrapper.m b/src/macosx/native/sun/awt/CWrapper.m index dd3c75d5544bae9a0493faceed45cd48680fa67f..139ea4bef71b83204d37814c5000f1303add04e1 100644 --- a/src/macosx/native/sun/awt/CWrapper.m +++ b/src/macosx/native/sun/awt/CWrapper.m @@ -74,6 +74,26 @@ JNF_COCOA_ENTER(env); JNF_COCOA_EXIT(env); } +/* + * Class: sun_lwawt_macosx_CWrapper$NSWindow + * Method: makeKeyWindow + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_sun_lwawt_macosx_CWrapper_00024NSWindow_makeKeyWindow +(JNIEnv *env, jclass cls, jlong windowPtr) +{ +JNF_COCOA_ENTER(env); + + NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr); + [JNFRunLoop performOnMainThread:@selector(makeKeyWindow) + on:window + withObject:nil + waitUntilDone:NO]; + +JNF_COCOA_EXIT(env); +} + /* * Class: sun_lwawt_macosx_CWrapper$NSWindow * Method: makeMainWindow diff --git a/src/macosx/native/sun/awt/LWCToolkit.m b/src/macosx/native/sun/awt/LWCToolkit.m index 96bea057c57bef0bdbfc63465e92fe731c835673..8a95cd38d3de78b72143d765a652731ab6af3306 100644 --- a/src/macosx/native/sun/awt/LWCToolkit.m +++ b/src/macosx/native/sun/awt/LWCToolkit.m @@ -401,18 +401,21 @@ JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_LWCToolkit_isCapsLockOn JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_LWCToolkit_isApplicationActive (JNIEnv *env, jclass clazz) { - __block jboolean active = JNI_FALSE; + __block jboolean active = JNI_FALSE; -AWT_ASSERT_NOT_APPKIT_THREAD; JNF_COCOA_ENTER(env); + if ([NSThread isMainThread]) { + active = (jboolean)[NSRunningApplication currentApplication].active; + } else { [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^() { - active = (jboolean)[NSRunningApplication currentApplication].active; + active = (jboolean)[NSRunningApplication currentApplication].active; }]; + } JNF_COCOA_EXIT(env); - return active; + return active; } diff --git a/src/macosx/native/sun/awt/OSVersion.m b/src/macosx/native/sun/awt/OSVersion.m index 10fe713194dad5e33c801b978a37b13f942d180e..e127bae6296cc9fa6f5fc289acaf3dec5a3b78f0 100644 --- a/src/macosx/native/sun/awt/OSVersion.m +++ b/src/macosx/native/sun/awt/OSVersion.m @@ -31,33 +31,31 @@ #import -// returns 10.7 for Lion, 10.6 for SnowLeopard etc. -double getOSXMajorVersion() { - char *version = JRSCopyOSVersion(); - - if (version == NULL) return 0.0; - - char temp[32]; - strlcpy(temp, version, sizeof(temp)); - free(version); - - if (strlen(temp) < 3) { - return 0.0; +// returns 107 for Lion, 106 for SnowLeopard etc. +int getOSXMajorVersion() { + char *ver = JRSCopyOSVersion(); + if (ver == NULL) { + return 0; } - if (temp[2] != '.') { // Third char must be a '.' - return 0.0; + int len = strlen(ver); + int v = 0; + + // Third char must be a '.' + if (len >= 3 && ver[2] == '.') { + int i; + + v = (ver[0] - '0') * 10 + (ver[1] - '0'); + for (i = 3; i < len && isdigit(ver[i]); ++i) { + v = v * 10 + (ver[i] - '0'); + } } - char *ptr = strchr(temp+3, '.'); // remove the second . if one exists. - if (ptr != NULL) { - *ptr = 0; - } - - return atof(temp); + free(ver); + + return v; } - BOOL isSnowLeopardOrLower() { - return (getOSXMajorVersion() < 10.7); + return (getOSXMajorVersion() < 107); } diff --git a/src/share/classes/com/sun/crypto/provider/DHKeyAgreement.java b/src/share/classes/com/sun/crypto/provider/DHKeyAgreement.java index 82f51f714a330a467af91cb30e1cf7ab490f2859..b69875dd48182ccd0f74d49b393b65bf9d2908ee 100644 --- a/src/share/classes/com/sun/crypto/provider/DHKeyAgreement.java +++ b/src/share/classes/com/sun/crypto/provider/DHKeyAgreement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2012, 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,7 @@ import java.security.InvalidKeyException; import java.security.Key; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; +import java.security.ProviderException; import java.security.spec.AlgorithmParameterSpec; import java.security.spec.InvalidKeySpecException; import javax.crypto.KeyAgreementSpi; @@ -234,31 +235,14 @@ extends KeyAgreementSpi { protected byte[] engineGenerateSecret() throws IllegalStateException { - if (generateSecret == false) { - throw new IllegalStateException - ("Key agreement has not been completed yet"); - } - - // Reset the key agreement here (in case anything goes wrong) - generateSecret = false; - - // get the modulus - BigInteger modulus = init_p; - - BigInteger tmpResult = y.modPow(x, modulus); - byte[] secret = tmpResult.toByteArray(); - - /* - * BigInteger.toByteArray will sometimes put a sign byte up front, but - * we NEVER want one. - */ - if ((tmpResult.bitLength() % 8) == 0) { - byte retval[] = new byte[secret.length - 1]; - System.arraycopy(secret, 1, retval, 0, retval.length); - return retval; - } else { - return secret; + int expectedLen = (init_p.bitLength() + 7) >>> 3; + byte[] result = new byte[expectedLen]; + try { + engineGenerateSecret(result, 0); + } catch (ShortBufferException sbe) { + // should never happen since length are identical } + return result; } /** @@ -301,39 +285,51 @@ extends KeyAgreementSpi { } BigInteger modulus = init_p; - byte[] secret = this.y.modPow(this.x, modulus).toByteArray(); - - // BigInteger.toByteArray will sometimes put a sign byte up front, - // but we NEVER want one. - if ((secret.length << 3) != modulus.bitLength()) { - if ((sharedSecret.length - offset) < (secret.length - 1)) { - throw new ShortBufferException + int expectedLen = (modulus.bitLength() + 7) >>> 3; + if ((sharedSecret.length - offset) < expectedLen) { + throw new ShortBufferException ("Buffer too short for shared secret"); - } - System.arraycopy(secret, 1, sharedSecret, offset, - secret.length - 1); - - // Reset the key agreement here (not earlier!), so that people - // can recover from ShortBufferException above without losing - // internal state - generateSecret = false; + } - return secret.length - 1; + // Reset the key agreement after checking for ShortBufferException + // above, so user can recover w/o losing internal state + generateSecret = false; + /* + * NOTE: BigInteger.toByteArray() returns a byte array containing + * the two's-complement representation of this BigInteger with + * the most significant byte is in the zeroth element. This + * contains the minimum number of bytes required to represent + * this BigInteger, including at least one sign bit whose value + * is always 0. + * + * Keys are always positive, and the above sign bit isn't + * actually used when representing keys. (i.e. key = new + * BigInteger(1, byteArray)) To obtain an array containing + * exactly expectedLen bytes of magnitude, we strip any extra + * leading 0's, or pad with 0's in case of a "short" secret. + */ + byte[] secret = this.y.modPow(this.x, modulus).toByteArray(); + if (secret.length == expectedLen) { + System.arraycopy(secret, 0, sharedSecret, offset, + secret.length); } else { - if ((sharedSecret.length - offset) < secret.length) { - throw new ShortBufferException - ("Buffer too short to hold shared secret"); + // Array too short, pad it w/ leading 0s + if (secret.length < expectedLen) { + System.arraycopy(secret, 0, sharedSecret, + offset + (expectedLen - secret.length), + secret.length); + } else { + // Array too long, check and trim off the excess + if ((secret.length == (expectedLen+1)) && secret[0] == 0) { + // ignore the leading sign byte + System.arraycopy(secret, 1, sharedSecret, offset, expectedLen); + } else { + throw new ProviderException("Generated secret is out-of-range"); + } } - System.arraycopy(secret, 0, sharedSecret, offset, secret.length); - - // Reset the key agreement here (not earlier!), so that people - // can recover from ShortBufferException above without losing - // internal state - generateSecret = false; - - return secret.length; } + return expectedLen; } /** diff --git a/src/share/classes/java/lang/management/ManagementFactory.java b/src/share/classes/java/lang/management/ManagementFactory.java index 98f2e4005cc1a7ccc1dde6e37b6911b6575f3b7d..20906a1fb46eaab764fcaf517650500301cb1916 100644 --- a/src/share/classes/java/lang/management/ManagementFactory.java +++ b/src/share/classes/java/lang/management/ManagementFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, 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 @@ -42,7 +42,7 @@ import javax.management.StandardMBean; import java.util.Collections; import java.util.List; import java.util.Set; -import java.util.TreeSet; +import java.util.HashSet; import java.security.AccessController; import java.security.Permission; import java.security.PrivilegedAction; @@ -787,7 +787,7 @@ public class ManagementFactory { getPlatformManagementInterfaces() { Set> result = - new TreeSet<>(); + new HashSet<>(); for (PlatformComponent component: PlatformComponent.values()) { result.add(component.getMXBeanInterface()); } diff --git a/src/share/classes/java/net/InMemoryCookieStore.java b/src/share/classes/java/net/InMemoryCookieStore.java index e885cdd772d2fced71d2b6a85ea038429cf1753e..66cb04ec88599ab03912e9510ef9bb4568d2079c 100644 --- a/src/share/classes/java/net/InMemoryCookieStore.java +++ b/src/share/classes/java/net/InMemoryCookieStore.java @@ -207,6 +207,9 @@ class InMemoryCookieStore implements CookieStore { public boolean removeAll() { lock.lock(); try { + if (cookieJar.isEmpty()) { + return false; + } cookieJar.clear(); domainIndex.clear(); uriIndex.clear(); diff --git a/src/share/classes/java/util/Currency.java b/src/share/classes/java/util/Currency.java index 87b7e01b75b38632d3c6219bfadf7e87ea204b86..e475bbb0a7504c3f8fa61ca1a17deac95a123928 100644 --- a/src/share/classes/java/util/Currency.java +++ b/src/share/classes/java/util/Currency.java @@ -34,6 +34,8 @@ import java.io.IOException; import java.io.Serializable; import java.security.AccessController; import java.security.PrivilegedAction; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; import java.util.logging.Level; import java.util.regex.Pattern; import java.util.regex.Matcher; @@ -99,7 +101,7 @@ public final class Currency implements Serializable { // class data: instance map - private static HashMap instances = new HashMap(7); + private static ConcurrentMap instances = new ConcurrentHashMap<>(7); private static HashSet available; @@ -284,7 +286,6 @@ public final class Currency implements Serializable { private static Currency getInstance(String currencyCode, int defaultFractionDigits, int numericCode) { - synchronized (instances) { // Try to look up the currency code in the instances table. // This does the null pointer check as a side effect. // Also, if there already is an entry, the currencyCode must be valid. @@ -322,10 +323,9 @@ public final class Currency implements Serializable { } } - instance = new Currency(currencyCode, defaultFractionDigits, numericCode); - instances.put(currencyCode, instance); - return instance; - } + instance = instances.putIfAbsent(currencyCode, + new Currency(currencyCode, defaultFractionDigits, numericCode)); + return (instance != null ? instance : instances.get(currencyCode)); } /** diff --git a/src/share/classes/java/util/jar/Manifest.java b/src/share/classes/java/util/jar/Manifest.java index 49612938ab832855b47a3ec9704fb0f568d989c1..b25165b334522271a6da1e009b39e04d21e43ecf 100644 --- a/src/share/classes/java/util/jar/Manifest.java +++ b/src/share/classes/java/util/jar/Manifest.java @@ -400,6 +400,8 @@ public class Manifest implements Cloneable { public byte peek() throws IOException { if (pos == count) fill(); + if (pos == count) + return -1; // nothing left in buffer return buf[pos]; } diff --git a/src/share/classes/javax/swing/DefaultListSelectionModel.java b/src/share/classes/javax/swing/DefaultListSelectionModel.java index cec3131bad552e5eca23af19f0428bd955413592..57fb5d776dbc7845d951031ac060f081744b5507 100644 --- a/src/share/classes/javax/swing/DefaultListSelectionModel.java +++ b/src/share/classes/javax/swing/DefaultListSelectionModel.java @@ -252,6 +252,10 @@ public class DefaultListSelectionModel implements ListSelectionModel, Cloneable, // Updates first and last change indices private void markAsDirty(int r) { + if (r == -1) { + return; + } + firstAdjustedIndex = Math.min(firstAdjustedIndex, r); lastAdjustedIndex = Math.max(lastAdjustedIndex, r); } @@ -358,16 +362,12 @@ public class DefaultListSelectionModel implements ListSelectionModel, Cloneable, private void updateLeadAnchorIndices(int anchorIndex, int leadIndex) { if (leadAnchorNotificationEnabled) { if (this.anchorIndex != anchorIndex) { - if (this.anchorIndex != -1) { // The unassigned state. - markAsDirty(this.anchorIndex); - } + markAsDirty(this.anchorIndex); markAsDirty(anchorIndex); } if (this.leadIndex != leadIndex) { - if (this.leadIndex != -1) { // The unassigned state. - markAsDirty(this.leadIndex); - } + markAsDirty(this.leadIndex); markAsDirty(leadIndex); } } diff --git a/src/share/classes/sun/rmi/rmic/BatchEnvironment.java b/src/share/classes/sun/rmi/rmic/BatchEnvironment.java index 3eff0bbbb93f3c72403ab76e4bb7517c6dbc80df..396d54d25484ac3be37057d01fdd9ba462756b42 100644 --- a/src/share/classes/sun/rmi/rmic/BatchEnvironment.java +++ b/src/share/classes/sun/rmi/rmic/BatchEnvironment.java @@ -160,7 +160,7 @@ public class BatchEnvironment extends sun.tools.javac.BatchEnvironment { } /** list of generated source files created in this environment */ - private Vector generatedFiles = new Vector(); + private Vector generatedFiles = new Vector<>(); /** * Remember a generated source file generated so that it @@ -177,9 +177,9 @@ public class BatchEnvironment extends sun.tools.javac.BatchEnvironment { */ public void deleteGeneratedFiles() { synchronized(generatedFiles) { - Enumeration enumeration = generatedFiles.elements(); + Enumeration enumeration = generatedFiles.elements(); while (enumeration.hasMoreElements()) { - File file = (File) enumeration.nextElement(); + File file = enumeration.nextElement(); file.delete(); } generatedFiles.removeAllElements(); diff --git a/src/share/classes/sun/rmi/rmic/Main.java b/src/share/classes/sun/rmi/rmic/Main.java index 562e3892ae937d8f2fddea7212ca85f20e792bd9..23bdfce4f91e95b39520e27472a9a7f78bfb3268 100644 --- a/src/share/classes/sun/rmi/rmic/Main.java +++ b/src/share/classes/sun/rmi/rmic/Main.java @@ -73,14 +73,15 @@ public class Main implements sun.rmi.rmic.Constants { File destDir; int flags; long tm; - Vector classes; + Vector classes; boolean nowrite; boolean nocompile; boolean keepGenerated; boolean status; String[] generatorArgs; - Vector generators; - Class environmentClass = BatchEnvironment.class; + Vector generators; + Class environmentClass = + BatchEnvironment.class; boolean iiopGeneration = false; /** @@ -183,7 +184,7 @@ public class Main implements sun.rmi.rmic.Constants { destDir = null; flags = F_WARNINGS; tm = System.currentTimeMillis(); - classes = new Vector(); + classes = new Vector<>(); nowrite = false; nocompile = false; keepGenerated = false; @@ -191,7 +192,7 @@ public class Main implements sun.rmi.rmic.Constants { if (generatorArgs == null) { return false; } - generators = new Vector(); + generators = new Vector<>(); // Pre-process command line for @file arguments try { @@ -411,7 +412,7 @@ public class Main implements sun.rmi.rmic.Constants { // Get the environment required by this generator... - Class envClass = BatchEnvironment.class; + Class envClass = BatchEnvironment.class; String env = getString("generator.env." + arg); if (env != null) { try { @@ -423,7 +424,7 @@ public class Main implements sun.rmi.rmic.Constants { // Yes, so switch to the new one... - environmentClass = envClass; + environmentClass = envClass.asSubclass(BatchEnvironment.class); } else { @@ -495,8 +496,9 @@ public class Main implements sun.rmi.rmic.Constants { try { Class[] ctorArgTypes = {OutputStream.class,ClassPath.class,Main.class}; Object[] ctorArgs = {out,classPath,this}; - Constructor constructor = environmentClass.getConstructor(ctorArgTypes); - result = (BatchEnvironment) constructor.newInstance(ctorArgs); + Constructor constructor = + environmentClass.getConstructor(ctorArgTypes); + result = constructor.newInstance(ctorArgs); result.reset(); } catch (Exception e) { @@ -530,7 +532,7 @@ public class Main implements sun.rmi.rmic.Constants { */ for (int i = classes.size()-1; i >= 0; i-- ) { Identifier implClassName = - Identifier.lookup((String)classes.elementAt(i)); + Identifier.lookup(classes.elementAt(i)); /* * Fix bugid 4049354: support using '.' as an inner class @@ -558,7 +560,7 @@ public class Main implements sun.rmi.rmic.Constants { try { ClassDefinition def = decl.getClassDefinition(env); for (int j = 0; j < generators.size(); j++) { - Generator gen = (Generator)generators.elementAt(j); + Generator gen = generators.elementAt(j); gen.generate(env, def, destDir); } } catch (ClassNotFound ex) { @@ -673,7 +675,7 @@ public class Main implements sun.rmi.rmic.Constants { do { done = true; - for (Enumeration e = env.getClasses() ; e.hasMoreElements() ; ) { + for (Enumeration e = env.getClasses() ; e.hasMoreElements() ; ) { ClassDeclaration c = (ClassDeclaration)e.nextElement(); done = compileClass(c,buf,env); } @@ -682,7 +684,9 @@ public class Main implements sun.rmi.rmic.Constants { /* * Compile a single class. + * Fallthrough is intentional */ + @SuppressWarnings("fallthrough") public boolean compileClass (ClassDeclaration c, ByteArrayOutputStream buf, BatchEnvironment env) @@ -879,6 +883,6 @@ public class Main implements sun.rmi.rmic.Constants { args[1] = (arg1 != null ? arg1.toString() : "null"); args[2] = (arg2 != null ? arg2.toString() : "null"); - return java.text.MessageFormat.format(format, args); + return java.text.MessageFormat.format(format, (Object[]) args); } } diff --git a/src/share/classes/sun/rmi/rmic/RMIGenerator.java b/src/share/classes/sun/rmi/rmic/RMIGenerator.java index 043ca87901a60dd1af1257f4a2f4fdd8f675face..4839036608563c84decc9808b1ac32a67c28a0c9 100644 --- a/src/share/classes/sun/rmi/rmic/RMIGenerator.java +++ b/src/share/classes/sun/rmi/rmic/RMIGenerator.java @@ -61,7 +61,7 @@ import com.sun.corba.se.impl.util.Utility; */ public class RMIGenerator implements RMIConstants, Generator { - private static final Hashtable versionOptions = new Hashtable(); + private static final Hashtable versionOptions = new Hashtable<>(); static { versionOptions.put("-v1.1", new Integer(STUB_VERSION_1_1)); versionOptions.put("-vcompat", new Integer(STUB_VERSION_FAT)); @@ -96,7 +96,7 @@ public class RMIGenerator implements RMIConstants, Generator { return false; } explicitVersion = arg; - version = ((Integer) versionOptions.get(arg)).intValue(); + version = versionOptions.get(arg); argv[i] = null; } } @@ -519,7 +519,7 @@ public class RMIGenerator implements RMIConstants, Generator { * follows a previous catch of it or of one of its superclasses. * The following method invocation takes care of these details. */ - Vector catchList = computeUniqueCatchList(exceptions); + Vector catchList = computeUniqueCatchList(exceptions); /* * If we need to catch any particular exceptions (i.e. this method @@ -615,10 +615,10 @@ public class RMIGenerator implements RMIConstants, Generator { * UnexpectedException, and end the try block. */ if (catchList.size() > 0) { - for (Enumeration enumeration = catchList.elements(); + for (Enumeration enumeration = catchList.elements(); enumeration.hasMoreElements();) { - ClassDefinition def = (ClassDefinition) enumeration.nextElement(); + ClassDefinition def = enumeration.nextElement(); p.pOlnI("} catch (" + def.getName() + " e) {"); p.pln("throw e;"); } @@ -650,8 +650,8 @@ public class RMIGenerator implements RMIConstants, Generator { * of its superclasses is in the throws clause of the method, indicating * that no exceptions need to be caught. */ - private Vector computeUniqueCatchList(ClassDeclaration[] exceptions) { - Vector uniqueList = new Vector(); // unique exceptions to catch + private Vector computeUniqueCatchList(ClassDeclaration[] exceptions) { + Vector uniqueList = new Vector<>(); // unique exceptions to catch uniqueList.addElement(defRuntimeException); uniqueList.addElement(defRemoteException); @@ -682,8 +682,7 @@ public class RMIGenerator implements RMIConstants, Generator { * exceptions that need to be caught: */ for (int j = 0; j < uniqueList.size();) { - ClassDefinition def = - (ClassDefinition) uniqueList.elementAt(j); + ClassDefinition def = uniqueList.elementAt(j); if (def.superClassOf(env, decl)) { /* * If a superclass of this exception is already on diff --git a/src/share/classes/sun/rmi/rmic/newrmic/Main.java b/src/share/classes/sun/rmi/rmic/newrmic/Main.java index d80213680c670ac2d9b544743bb75740847abf1c..1e59be43605b82df729e41e379c8e4310d77fecb 100644 --- a/src/share/classes/sun/rmi/rmic/newrmic/Main.java +++ b/src/share/classes/sun/rmi/rmic/newrmic/Main.java @@ -455,7 +455,7 @@ public class Main { BatchEnvironment env; try { Constructor cons = - batch.envClass.getConstructor(new Class[] { RootDoc.class }); + batch.envClass.getConstructor(new Class[] { RootDoc.class }); env = cons.newInstance(rootDoc); } catch (NoSuchMethodException e) { throw new AssertionError(e); diff --git a/src/share/classes/sun/rmi/rmic/newrmic/Resources.java b/src/share/classes/sun/rmi/rmic/newrmic/Resources.java index f8ea7fc28c8960f3eab1e96009b75e12ff54024c..6b3ba17f5ee3a53c5a4baafa3ecb2495b19f3044 100644 --- a/src/share/classes/sun/rmi/rmic/newrmic/Resources.java +++ b/src/share/classes/sun/rmi/rmic/newrmic/Resources.java @@ -69,7 +69,7 @@ public final class Resources { format = "missing resource key: key = \"" + key + "\", " + "arguments = \"{0}\", \"{1}\", \"{2}\""; } - return MessageFormat.format(format, args); + return MessageFormat.format(format, (Object[]) args); } /** diff --git a/src/share/classes/sun/security/pkcs11/P11KeyAgreement.java b/src/share/classes/sun/security/pkcs11/P11KeyAgreement.java index 1ebe17bfaccbfd2e240c1f7014f3b80a92eea83f..dd7c329464982038a7377b4a1918f921835439ce 100644 --- a/src/share/classes/sun/security/pkcs11/P11KeyAgreement.java +++ b/src/share/classes/sun/security/pkcs11/P11KeyAgreement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, 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 @@ -198,8 +198,22 @@ final class P11KeyAgreement extends KeyAgreementSpi { token.p11.C_GetAttributeValue(session.id(), keyID, attributes); byte[] secret = attributes[0].getByteArray(); token.p11.C_DestroyObject(session.id(), keyID); - // trim leading 0x00 bytes per JCE convention - return P11Util.trimZeroes(secret); + // Some vendors, e.g. NSS, trim off the leading 0x00 byte(s) from + // the generated secret. Thus, we need to check the secret length + // and trim/pad it so the returned value has the same length as + // the modulus size + if (secret.length == secretLen) { + return secret; + } else { + if (secret.length > secretLen) { + // Shouldn't happen; but check just in case + throw new ProviderException("generated secret is out-of-range"); + } + byte[] newSecret = new byte[secretLen]; + System.arraycopy(secret, 0, newSecret, secretLen - secret.length, + secret.length); + return newSecret; + } } catch (PKCS11Exception e) { throw new ProviderException("Could not derive key", e); } finally { diff --git a/src/solaris/native/java/util/TimeZone_md.c b/src/solaris/native/java/util/TimeZone_md.c index 48b3c5260d69dd42e8f9203563095e67d626daab..3af5d72657ff9409a6082ff7b13a21742af64a37 100644 --- a/src/solaris/native/java/util/TimeZone_md.c +++ b/src/solaris/native/java/util/TimeZone_md.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2012, 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 @@ -96,9 +96,9 @@ getPathName(const char *dir, const char *name) { /* * Scans the specified directory and its subdirectories to find a * zoneinfo file which has the same content as /etc/localtime on Linux - * or /usr/share/lib/zoneinfo/localtime (most likely a symbolic link) - * on Solaris given in 'buf'. Returns a zone ID if found, otherwise, - * NULL is returned. + * or /usr/share/lib/zoneinfo/localtime on Solaris given in 'buf'. + * If file is symbolic link, then the contents it points to are in buf. + * Returns a zone ID if found, otherwise, NULL is returned. */ static char * findZoneinfoFile(char *buf, size_t size, const char *dir) @@ -280,21 +280,27 @@ getPlatformTimeZoneID() tz = getZoneName(linkbuf); if (tz != NULL) { tz = strdup(tz); + return tz; } - return tz; } /* * If it's a regular file, we need to find out the same zoneinfo file * that has been copied as /etc/localtime. + * If initial symbolic link resolution failed, we should treat target + * file as a regular file. */ + if ((fd = open(DEFAULT_ZONEINFO_FILE, O_RDONLY)) == -1) { + return NULL; + } + if (fstat(fd, &statbuf) == -1) { + (void) close(fd); + return NULL; + } size = (size_t) statbuf.st_size; buf = (char *) malloc(size); if (buf == NULL) { - return NULL; - } - if ((fd = open(DEFAULT_ZONEINFO_FILE, O_RDONLY)) == -1) { - free((void *) buf); + (void) close(fd); return NULL; } diff --git a/src/solaris/native/sun/java2d/x11/X11SurfaceData.c b/src/solaris/native/sun/java2d/x11/X11SurfaceData.c index 330cf0ddf0ba12a5c1ba7c2f869fbf3888681139..5b8aeb4be205a5b6232b44781a7cdc69f7340856 100644 --- a/src/solaris/native/sun/java2d/x11/X11SurfaceData.c +++ b/src/solaris/native/sun/java2d/x11/X11SurfaceData.c @@ -541,6 +541,8 @@ XImage* X11SD_CreateSharedImage(X11SDOps *xsdo, J2dRlsTraceLn1(J2D_TRACE_ERROR, "X11SD_SetupSharedSegment shmget has failed: %s", strerror(errno)); + free((void *)shminfo); + XDestroyImage(img); return NULL; } @@ -550,6 +552,8 @@ XImage* X11SD_CreateSharedImage(X11SDOps *xsdo, J2dRlsTraceLn1(J2D_TRACE_ERROR, "X11SD_SetupSharedSegment shmat has failed: %s", strerror(errno)); + free((void *)shminfo); + XDestroyImage(img); return NULL; } @@ -570,6 +574,9 @@ XImage* X11SD_CreateSharedImage(X11SDOps *xsdo, J2dRlsTraceLn1(J2D_TRACE_ERROR, "X11SD_SetupSharedSegment XShmAttach has failed: %s", strerror(errno)); + shmdt(shminfo->shmaddr); + free((void *)shminfo); + XDestroyImage(img); return NULL; } @@ -1345,13 +1352,10 @@ void X11SD_DisposeXImage(XImage * image) { #ifdef MITSHM if (image->obdata != NULL) { X11SD_DropSharedSegment((XShmSegmentInfo*)image->obdata); - } else { - free(image->data); + image->obdata = NULL; } -#else - free(image->data); #endif /* MITSHM */ - XFree(image); + XDestroyImage(image); } } diff --git a/src/solaris/native/sun/nio/ch/DatagramDispatcher.c b/src/solaris/native/sun/nio/ch/DatagramDispatcher.c index 6d5337cc398f13e1df234084182118bbd4951fa4..c37686bf962ebd00a5248d8476a2d5efb8ba5288 100644 --- a/src/solaris/native/sun/nio/ch/DatagramDispatcher.c +++ b/src/solaris/native/sun/nio/ch/DatagramDispatcher.c @@ -36,6 +36,7 @@ #include #include "nio_util.h" +#include JNIEXPORT jint JNICALL Java_sun_nio_ch_DatagramDispatcher_read0(JNIEnv *env, jclass clazz, @@ -60,23 +61,14 @@ Java_sun_nio_ch_DatagramDispatcher_readv0(JNIEnv *env, jclass clazz, ssize_t result = 0; struct iovec *iov = (struct iovec *)jlong_to_ptr(address); struct msghdr m; - if (len > 16) { - len = 16; + if (len > IOV_MAX) { + len = IOV_MAX; } - m.msg_name = NULL; - m.msg_namelen = 0; + // initialize the message + memset(&m, 0, sizeof(m)); m.msg_iov = iov; m.msg_iovlen = len; -#ifdef __solaris__ - m.msg_accrights = NULL; - m.msg_accrightslen = 0; -#endif - -#if defined(__linux__) || defined(_ALLBSD_SOURCE) - m.msg_control = NULL; - m.msg_controllen = 0; -#endif result = recvmsg(fd, &m, 0); if (result < 0 && errno == ECONNREFUSED) { @@ -108,23 +100,14 @@ Java_sun_nio_ch_DatagramDispatcher_writev0(JNIEnv *env, jclass clazz, struct iovec *iov = (struct iovec *)jlong_to_ptr(address); struct msghdr m; ssize_t result = 0; - if (len > 16) { - len = 16; + if (len > IOV_MAX) { + len = IOV_MAX; } - m.msg_name = NULL; - m.msg_namelen = 0; + // initialize the message + memset(&m, 0, sizeof(m)); m.msg_iov = iov; m.msg_iovlen = len; -#ifdef __solaris__ - m.msg_accrights = NULL; - m.msg_accrightslen = 0; -#endif - -#if defined(__linux__) || defined(_ALLBSD_SOURCE) - m.msg_control = NULL; - m.msg_controllen = 0; -#endif result = sendmsg(fd, &m, 0); if (result < 0 && errno == ECONNREFUSED) { diff --git a/src/solaris/native/sun/nio/fs/GnomeFileTypeDetector.c b/src/solaris/native/sun/nio/fs/GnomeFileTypeDetector.c index 7dc606ce2317ef6386a499c7231efa1ce90622cb..535a1819928220bab808d0025d6669c4bde4cea1 100644 --- a/src/solaris/native/sun/nio/fs/GnomeFileTypeDetector.c +++ b/src/solaris/native/sun/nio/fs/GnomeFileTypeDetector.c @@ -30,9 +30,6 @@ #include #include -#ifndef __APPLE__ -#include -#endif #ifdef __solaris__ #include diff --git a/src/solaris/native/sun/security/jgss/wrapper/NativeFunc.c b/src/solaris/native/sun/security/jgss/wrapper/NativeFunc.c index fdb32df4564395e45da6e2bcee1c089b06f16b5f..f46c00a9be9ef08f4e8836f887539ce54cf0662e 100644 --- a/src/solaris/native/sun/security/jgss/wrapper/NativeFunc.c +++ b/src/solaris/native/sun/security/jgss/wrapper/NativeFunc.c @@ -26,9 +26,6 @@ #include #include #include -#ifndef __APPLE__ -#include -#endif #include "NativeFunc.h" /* standard GSS method names (ordering is from mapfile) */ diff --git a/src/solaris/native/sun/security/pkcs11/j2secmod_md.c b/src/solaris/native/sun/security/pkcs11/j2secmod_md.c index 6cdeb62edfb5ebe8daad98fc60a49282a26e5d0b..a69f12bb1648d8a375d309ef342146bcd6e5be72 100644 --- a/src/solaris/native/sun/security/pkcs11/j2secmod_md.c +++ b/src/solaris/native/sun/security/pkcs11/j2secmod_md.c @@ -28,9 +28,6 @@ #include #include -#ifndef __APPLE__ -#include -#endif #include diff --git a/src/solaris/native/sun/security/pkcs11/wrapper/p11_md.c b/src/solaris/native/sun/security/pkcs11/wrapper/p11_md.c index 59b311f56111ac41a68d9ab5bbd576b46840f451..277f114145f4b587fa0ee93f2cecc1aaeaf1fa95 100644 --- a/src/solaris/native/sun/security/pkcs11/wrapper/p11_md.c +++ b/src/solaris/native/sun/security/pkcs11/wrapper/p11_md.c @@ -64,9 +64,6 @@ #include #include -#ifndef __APPLE__ -#include -#endif #include diff --git a/src/solaris/native/sun/security/smartcardio/pcsc_md.c b/src/solaris/native/sun/security/smartcardio/pcsc_md.c index c0fc2abdf58b4ce13a3300dbac527eadfe9d42a5..4e8199af3a2b25ed0c7024061665f7ed9a60cc78 100644 --- a/src/solaris/native/sun/security/smartcardio/pcsc_md.c +++ b/src/solaris/native/sun/security/smartcardio/pcsc_md.c @@ -29,9 +29,6 @@ #include #include -#ifndef __APPLE__ -#include -#endif #include diff --git a/src/solaris/npt/npt_md.h b/src/solaris/npt/npt_md.h index 8820b2c5cd9da766f1d550fbe8948c71aba4a9bc..7a85205543abfbc1270708b6f34e6d9fa622aab7 100644 --- a/src/solaris/npt/npt_md.h +++ b/src/solaris/npt/npt_md.h @@ -32,9 +32,6 @@ #include #include #include -#ifndef __APPLE__ -#include -#endif #include #define NPT_LIBNAME "npt" diff --git a/src/windows/native/sun/windows/awt_Component.cpp b/src/windows/native/sun/windows/awt_Component.cpp index 57d1733756e2e517c97289fc35da18c443a62690..b03ea0d0af06cd4615b4b5f17cab681ab21d8c83 100644 --- a/src/windows/native/sun/windows/awt_Component.cpp +++ b/src/windows/native/sun/windows/awt_Component.cpp @@ -302,6 +302,7 @@ void AwtComponent::Dispose() delete m_childList; DestroyDropTarget(); + ReleaseDragCapture(0); if (m_myControlID != 0) { AwtComponent* parent = GetParent(); diff --git a/test/ProblemList.txt b/test/ProblemList.txt index 8c481626a126bad8486f32eff5729026efe24006..70a44d7c4666263383ffcc52e3f0ab67322c5b45 100644 --- a/test/ProblemList.txt +++ b/test/ProblemList.txt @@ -212,7 +212,7 @@ java/io/File/MaxPathLength.java windows-all # 7076644 java/io/File/Basic.java windows-all -# Test needs AWT window server, does not work headless +# 7145435 - Test needs AWT window server, does not work headless java/io/Serializable/resolveClass/deserializeButton/run.sh macosx-all ############################################################################ @@ -225,9 +225,6 @@ java/nio/channels/Selector/Wakeup.java windows-all # 7052549 java/nio/channels/FileChannel/ReleaseOnCloseDeadlock.java windows-all -# 6963118 -java/nio/channels/Selector/Wakeup.java windows-all - # 7133499, 7133497 java/nio/channels/AsyncCloseAndInterrupt.java macosx-all java/nio/channels/AsynchronousFileChannel/Lock.java macosx-all @@ -259,9 +256,6 @@ java/rmi/registry/readTest/readTest.sh windows-all # jdk_security -# 7145024 -sun/security/ssl/com/sun/net/ssl/internal/ssl/GenSSLConfigs/main.java solaris-all - # 7147060 com/sun/org/apache/xml/internal/security/transforms/ClassLoaderTest.java generic-all @@ -305,9 +299,6 @@ sun/security/ssl/sanity/interop/ClientJSSEServerJSSE.java generic-all # 7079203 sun/security/tools/keytool/printssl.sh fails on solaris with timeout sun/security/tools/keytool/printssl.sh solaris-all -# 7081817 -sun/security/provider/certpath/X509CertPath/IllegalCertiticates.java generic-all - # 7041639, Solaris DSA keypair generation bug (Note: jdk_util also affected) java/security/KeyPairGenerator/SolarisShortDSA.java solaris-all sun/security/tools/jarsigner/onlymanifest.sh solaris-all diff --git a/test/com/sun/crypto/provider/KeyAgreement/DHKeyAgreement2.java b/test/com/sun/crypto/provider/KeyAgreement/DHKeyAgreement2.java index 563942ff95eb9d40fa548091fda9df4a82c07886..292a8cb234c46bd63c47d4687a8e09b616704dcb 100644 --- a/test/com/sun/crypto/provider/KeyAgreement/DHKeyAgreement2.java +++ b/test/com/sun/crypto/provider/KeyAgreement/DHKeyAgreement2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2012, 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,7 +23,7 @@ /* * @test - * @bug 0000000 + * @bug 7146728 * @summary DHKeyAgreement2 * @author Jan Luehe */ @@ -52,15 +52,12 @@ import sun.misc.HexDumpEncoder; public class DHKeyAgreement2 { + private static final String SUNJCE = "SunJCE"; private DHKeyAgreement2() {} public static void main(String argv[]) throws Exception { String mode = "USE_SKIP_DH_PARAMS"; - // Add JCE to the list of providers - SunJCE jce = new SunJCE(); - Security.addProvider(jce); - DHKeyAgreement2 keyAgree = new DHKeyAgreement2(); if (argv.length > 1) { @@ -86,7 +83,7 @@ public class DHKeyAgreement2 { // Some central authority creates new DH parameters System.err.println("Creating Diffie-Hellman parameters ..."); AlgorithmParameterGenerator paramGen - = AlgorithmParameterGenerator.getInstance("DH"); + = AlgorithmParameterGenerator.getInstance("DH", SUNJCE); paramGen.init(512); AlgorithmParameters params = paramGen.generateParameters(); dhSkipParamSpec = (DHParameterSpec)params.getParameterSpec @@ -103,7 +100,7 @@ public class DHKeyAgreement2 { * above */ System.err.println("ALICE: Generate DH keypair ..."); - KeyPairGenerator aliceKpairGen = KeyPairGenerator.getInstance("DH"); + KeyPairGenerator aliceKpairGen = KeyPairGenerator.getInstance("DH", SUNJCE); aliceKpairGen.initialize(dhSkipParamSpec); KeyPair aliceKpair = aliceKpairGen.generateKeyPair(); System.out.println("Alice DH public key:\n" + @@ -112,14 +109,14 @@ public class DHKeyAgreement2 { aliceKpair.getPrivate().toString()); DHParameterSpec dhParamSpec = ((DHPublicKey)aliceKpair.getPublic()).getParams(); - AlgorithmParameters algParams = AlgorithmParameters.getInstance("DH"); + AlgorithmParameters algParams = AlgorithmParameters.getInstance("DH", SUNJCE); algParams.init(dhParamSpec); System.out.println("Alice DH parameters:\n" + algParams.toString()); // Alice executes Phase1 of her version of the DH protocol System.err.println("ALICE: Execute PHASE1 ..."); - KeyAgreement aliceKeyAgree = KeyAgreement.getInstance("DH"); + KeyAgreement aliceKeyAgree = KeyAgreement.getInstance("DH", SUNJCE); aliceKeyAgree.init(aliceKpair.getPrivate()); // Alice encodes her public key, and sends it over to Bob. @@ -130,7 +127,7 @@ public class DHKeyAgreement2 { * in encoded format. * He instantiates a DH public key from the encoded key material. */ - KeyFactory bobKeyFac = KeyFactory.getInstance("DH"); + KeyFactory bobKeyFac = KeyFactory.getInstance("DH", SUNJCE); X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec (alicePubKeyEnc); PublicKey alicePubKey = bobKeyFac.generatePublic(x509KeySpec); @@ -144,7 +141,7 @@ public class DHKeyAgreement2 { // Bob creates his own DH key pair System.err.println("BOB: Generate DH keypair ..."); - KeyPairGenerator bobKpairGen = KeyPairGenerator.getInstance("DH"); + KeyPairGenerator bobKpairGen = KeyPairGenerator.getInstance("DH", SUNJCE); bobKpairGen.initialize(dhParamSpec); KeyPair bobKpair = bobKpairGen.generateKeyPair(); System.out.println("Bob DH public key:\n" + @@ -154,7 +151,7 @@ public class DHKeyAgreement2 { // Bob executes Phase1 of his version of the DH protocol System.err.println("BOB: Execute PHASE1 ..."); - KeyAgreement bobKeyAgree = KeyAgreement.getInstance("DH"); + KeyAgreement bobKeyAgree = KeyAgreement.getInstance("DH", SUNJCE); bobKeyAgree.init(bobKpair.getPrivate()); // Bob encodes his public key, and sends it over to Alice. @@ -166,7 +163,7 @@ public class DHKeyAgreement2 { * Before she can do so, she has to instanticate a DH public key * from Bob's encoded key material. */ - KeyFactory aliceKeyFac = KeyFactory.getInstance("DH"); + KeyFactory aliceKeyFac = KeyFactory.getInstance("DH", SUNJCE); x509KeySpec = new X509EncodedKeySpec(bobPubKeyEnc); PublicKey bobPubKey = aliceKeyFac.generatePublic(x509KeySpec); System.err.println("ALICE: Execute PHASE2 ..."); @@ -187,50 +184,33 @@ public class DHKeyAgreement2 { byte[] aliceSharedSecret = aliceKeyAgree.generateSecret(); int aliceLen = aliceSharedSecret.length; + // check if alice's key agreement has been reset afterwards + try { + aliceKeyAgree.generateSecret(); + throw new Exception("Error: alice's KeyAgreement not reset"); + } catch (IllegalStateException e) { + System.out.println("EXPECTED: " + e.getMessage()); + } + byte[] bobSharedSecret = new byte[aliceLen]; int bobLen; try { // provide output buffer that is too short bobLen = bobKeyAgree.generateSecret(bobSharedSecret, 1); - - /* - * Gatekeeper's note: - * We should not be getting here, but every so often, we - * get a failure, either a "ShortBufferException" or - * "Key agreement has not been completed yet" in the - * generateSecret(bobSharedSecret, 0) below. - * - * This will help to figure out why we're dropping through - * and not failing. - */ - System.out.println("NIGHTLY: Should *NOT* be here!!!\n" + - "aliceLen = " + aliceLen + "\n" + - "Alice's shared secret"); - - try { - HexDumpEncoder hd = new HexDumpEncoder(); - - hd.encodeBuffer( - new ByteArrayInputStream(aliceSharedSecret), System.out); - } catch (IOException e) { } - - System.out.println("bobLen = " + bobLen); - - try { - HexDumpEncoder hd = new HexDumpEncoder(); - - hd.encodeBuffer( - new ByteArrayInputStream(bobSharedSecret), System.out); - } catch (IOException e) { } - - throw new Exception("Shouldn't be succeeding."); } catch (ShortBufferException e) { System.out.println("EXPECTED: " + e.getMessage()); } - - // provide output buffer of required size + // retry w/ output buffer of required size bobLen = bobKeyAgree.generateSecret(bobSharedSecret, 0); + // check if bob's key agreement has been reset afterwards + try { + bobKeyAgree.generateSecret(bobSharedSecret, 0); + throw new Exception("Error: bob's KeyAgreement not reset"); + } catch (IllegalStateException e) { + System.out.println("EXPECTED: " + e.getMessage()); + } + System.out.println("Alice secret: " + toHexString(aliceSharedSecret)); System.out.println("Bob secret: " + toHexString(bobSharedSecret)); diff --git a/test/com/sun/jdi/EarlyReturnTest.java b/test/com/sun/jdi/EarlyReturnTest.java index 1de97ca213247a348e4ae01fe81d0588c088437c..306ff25a57fb0bfa498bfd82f48fa128d81ba2bf 100644 --- a/test/com/sun/jdi/EarlyReturnTest.java +++ b/test/com/sun/jdi/EarlyReturnTest.java @@ -292,7 +292,9 @@ public class EarlyReturnTest extends TestScaffold { private String[] excludes = { "javax.*", "sun.*", - "com.sun.*"}; + "com.sun.*", + "com.oracle.*", + "oracle.*"}; static VirtualMachineManager vmm ; ClassType targetClass; diff --git a/test/com/sun/jdi/MethodEntryExitEvents.java b/test/com/sun/jdi/MethodEntryExitEvents.java index 5313ea30c376332755348637f5cf93ffd788311f..8f1ac42dd68a5fefc831d3e4b2b9d62ad2831bba 100644 --- a/test/com/sun/jdi/MethodEntryExitEvents.java +++ b/test/com/sun/jdi/MethodEntryExitEvents.java @@ -114,7 +114,8 @@ public class MethodEntryExitEvents extends TestScaffold { * http://java.sun.com/javase/technologies/core/toolsapis/jpda/ */ private String[] excludes = {"java.*", "javax.*", "sun.*", - "com.sun.*"}; + "com.sun.*", "com.oracle.*", + "oracle.*"}; MethodEntryExitEvents (String args[]) { super(args); diff --git a/test/com/sun/jdi/MethodExitReturnValuesTest.java b/test/com/sun/jdi/MethodExitReturnValuesTest.java index 5df0175b4566337860a59f3488be64fb636a0ad7..5047e126d72b2e69fa5281ea08a80f9007215d81 100644 --- a/test/com/sun/jdi/MethodExitReturnValuesTest.java +++ b/test/com/sun/jdi/MethodExitReturnValuesTest.java @@ -218,7 +218,9 @@ public class MethodExitReturnValuesTest extends TestScaffold { private String[] excludes = { "javax.*", "sun.*", - "com.sun.*"}; + "com.sun.*", + "com.oracle.*", + "oracle.*"}; static VirtualMachineManager vmm ; ClassType targetClass; diff --git a/test/java/awt/Frame/WindowDragTest/WindowDragTest.java b/test/java/awt/Frame/WindowDragTest/WindowDragTest.java new file mode 100644 index 0000000000000000000000000000000000000000..127a49e607d664c422afadf1ac5cf2f6db8756ab --- /dev/null +++ b/test/java/awt/Frame/WindowDragTest/WindowDragTest.java @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2012, 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 7128738 + @summary dragged dialog freezes system on dispose + @author Oleg Pekhovskiy: area=awt.toplevel + @library ../../regtesthelpers + @run main WindowDragTest +*/ + +import java.awt.Frame; +import java.awt.event.InputEvent; +import java.awt.AWTException; +import test.java.awt.regtesthelpers.Util; +import java.awt.Robot; +import java.awt.Point; +import java.awt.Dimension; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +public class WindowDragTest { + + static boolean passed = false; + + public static void main(String[] args) { + try { + Robot robot = new Robot(); + robot.setAutoDelay(1000); + + Frame frame1 = new Frame(); + frame1.setBounds(50, 50, 300, 200); + frame1.setVisible(true); + frame1.toFront(); + frame1.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + // Clicking frame1 succeeded - mouse is not captured + passed = true; + } + }); + robot.delay(1000); + + Frame frame2 = new Frame(); + frame2.setBounds(100, 100, 300, 200); + frame2.setVisible(true); + frame2.toFront(); + robot.delay(1000); + + Point p = frame2.getLocationOnScreen(); + Dimension d = frame2.getSize(); + + // Move cursor to frame2 title bar to drag + robot.mouseMove(p.x + (int)(d.getWidth() / 2), p.y + (int)frame2.getInsets().top / 2); + Util.waitForIdle(robot); + + // Start window dragging + robot.mousePress(InputEvent.BUTTON1_MASK); + Util.waitForIdle(robot); + + // Dispose window being dragged + frame2.dispose(); + Util.waitForIdle(robot); + + // Release mouse button to be able to get MOUSE_CLICKED event on Util.clickOnComp() + robot.mouseRelease(InputEvent.BUTTON1_MASK); + Util.waitForIdle(robot); + + // Click frame1 to check whether mouse is not captured by frame2 + Util.clickOnComp(frame1, robot); + Util.waitForIdle(robot); + + frame1.dispose(); + if (passed) { + System.out.println("Test passed."); + } + else { + System.out.println("Test failed."); + throw new RuntimeException("Test failed."); + } + } + catch (AWTException e) { + throw new RuntimeException("AWTException occurred - problem creating robot!"); + } + } +} diff --git a/test/java/io/File/isDirectory/Applet.html b/test/java/io/File/isDirectory/Applet.html deleted file mode 100644 index 69d57f472508e97e80aad087cbf6a0e1e2a9707e..0000000000000000000000000000000000000000 --- a/test/java/io/File/isDirectory/Applet.html +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/test/java/io/Serializable/badSubstByReplace/BadSubstByReplace.java b/test/java/io/Serializable/badSubstByReplace/BadSubstByReplace.java index 39d7702623efd3537c3e1493ce57175d8d813836..ce78220ee7647561e1d6683c003969d150b28528 100644 --- a/test/java/io/Serializable/badSubstByReplace/BadSubstByReplace.java +++ b/test/java/io/Serializable/badSubstByReplace/BadSubstByReplace.java @@ -22,7 +22,6 @@ */ /* @test - * @clean A B Container ReplacerObjectOutputStream * @summary Verify that ClassCastException is thrown when deserializing * an object and one of its object fields is incompatibly replaced * by either replaceObject/resolveObject. diff --git a/test/java/io/Serializable/replaceStringArray/ReplaceStringArray.java b/test/java/io/Serializable/replaceStringArray/ReplaceStringArray.java index a7b099d1cee1cdcb678f5423b3794ee9bef14812..11b2d6d9f1f98800eceec7b910670d3335a3f355 100644 --- a/test/java/io/Serializable/replaceStringArray/ReplaceStringArray.java +++ b/test/java/io/Serializable/replaceStringArray/ReplaceStringArray.java @@ -22,7 +22,6 @@ */ /* @test - * @clean A SubstituteObjectOutputStream SubstituteObjectInputStream * @bug 4099013 * @summary Enable substitution of String and Array by ObjectStreams. */ diff --git a/test/java/io/Serializable/replaceWithNull/ReplaceWithNull.java b/test/java/io/Serializable/replaceWithNull/ReplaceWithNull.java index 1d7e11ec1d633828c8e75f5cd279873a4ffa1067..896900b2d6288d62633f4a77fe53ee89d1b547d9 100644 --- a/test/java/io/Serializable/replaceWithNull/ReplaceWithNull.java +++ b/test/java/io/Serializable/replaceWithNull/ReplaceWithNull.java @@ -23,7 +23,6 @@ /* @test * @bug 4065313 - * @clean A ReplaceWithNull MyObjectOutputStream * @summary Ensure that it is okay to replace an object with null. */ import java.io.*; diff --git a/test/java/io/Serializable/verifyDynamicObjHandleTable/VerifyDynamicObjHandleTable.java b/test/java/io/Serializable/verifyDynamicObjHandleTable/VerifyDynamicObjHandleTable.java index c2046fe251b32fbdb372accb19b8347c265f6b96..3e8156b07282b68bec06ffc8d746b559b6fcad7a 100644 --- a/test/java/io/Serializable/verifyDynamicObjHandleTable/VerifyDynamicObjHandleTable.java +++ b/test/java/io/Serializable/verifyDynamicObjHandleTable/VerifyDynamicObjHandleTable.java @@ -22,7 +22,6 @@ */ /* @test - * @clean A * @bug 4146453 * @summary Test that regrow of object/handle table of ObjectOutputStream works. */ diff --git a/test/java/lang/management/ManagementFactory/GetPlatformManagementInterfaces.java b/test/java/lang/management/ManagementFactory/GetPlatformManagementInterfaces.java new file mode 100644 index 0000000000000000000000000000000000000000..a6aa2c905cd2bc75a7e2a81a721fd585f5e3b208 --- /dev/null +++ b/test/java/lang/management/ManagementFactory/GetPlatformManagementInterfaces.java @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2012, 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 7074616 + * @summary Basic unit test of the + * ManagementFactory.getPlatformManagementInterfaces() method + * @author Frederic Parain + * + * @run main GetPlatformManagementInterfaces + */ + +import java.lang.management.*; +import java.io.IOException; +import java.util.*; +import javax.management.*; + +import static java.lang.management.ManagementFactory.*; + +public class GetPlatformManagementInterfaces { + + private static enum ManagementInterfaces { + CLASS_LOADING_MXBEAN(ClassLoadingMXBean.class), + COMPILATION_MXBEAN(CompilationMXBean.class), + MEMORY_MXBEAN(MemoryMXBean.class), + OPERATING_SYSTEM_MXBEAN(OperatingSystemMXBean.class), + RUNTIME_MXBEAN(RuntimeMXBean.class), + THREAD_MXBEAN(ThreadMXBean.class), + GARBAGE_COLLECTOR_MXBEAN(GarbageCollectorMXBean.class), + MEMORY_MANAGER_MXBEAN(MemoryManagerMXBean.class), + MEMORY_POOL_MXBEAN(MemoryPoolMXBean.class); + + private final Class managementInterface; + private ManagementInterfaces(Class minterface) { + managementInterface = minterface; + } + public Class getManagementInterface() { + return managementInterface; + } + }; + + public static void main(String[] args) { + Set> interfaces = + ManagementFactory.getPlatformManagementInterfaces(); + for(Class pom : interfaces) { + List list = + ManagementFactory.getPlatformMXBeans(pom); + } + for(ManagementInterfaces mi : ManagementInterfaces.values()) { + if(!interfaces.contains(mi.getManagementInterface())) { + throw new RuntimeException(mi.getManagementInterface() + " not in ManagementInterfaces set"); + } + } + } +} diff --git a/test/java/net/CookieHandler/NullUriCookieTest.java b/test/java/net/CookieHandler/NullUriCookieTest.java index 60d05506b420c2b97078c264c61d9a5a8a5d03c9..22ae6c2cb9d802d2fcec62d3230778b2ddec33c6 100644 --- a/test/java/net/CookieHandler/NullUriCookieTest.java +++ b/test/java/net/CookieHandler/NullUriCookieTest.java @@ -23,8 +23,9 @@ /* * @test - * @bug 6953455 + * @bug 6953455 7045655 * @summary CookieStore.add() cannot handle null URI parameter + * and An empty InMemoryCookieStore should not return true for removeAll */ import java.net.CookieManager; @@ -44,6 +45,11 @@ public class NullUriCookieTest { static void checkCookieNullUri() throws Exception { //get a cookie store implementation and add a cookie to the store with null URI CookieStore cookieStore = (new CookieManager()).getCookieStore(); + //Check if removeAll() retrurns false on an empty CookieStore + if (cookieStore.removeAll()) { + fail = true; + } + checkFail("removeAll on empty store should return false"); HttpCookie cookie = new HttpCookie("MY_COOKIE", "MY_COOKIE_VALUE"); cookie.setDomain("foo.com"); cookieStore.add(null, cookie); diff --git a/test/java/net/Socks/SocksServer.java b/test/java/net/Socks/SocksServer.java index de2822ab9a9b49991bfe72fb0cdda9a9b784cceb..f6720afd56de11dd7d80e753412469fbf3ba0818 100644 --- a/test/java/net/Socks/SocksServer.java +++ b/test/java/net/Socks/SocksServer.java @@ -22,13 +22,14 @@ */ import java.net.*; import java.io.*; +import java.util.HashMap; public class SocksServer extends Thread { // Some useful SOCKS constant - static final int PROTO_VERS4 = 4; + static final int PROTO_VERS4 = 4; static final int PROTO_VERS = 5; - static final int DEFAULT_PORT = 1080; + static final int DEFAULT_PORT = 1080; static final int NO_AUTH = 0; static final int GSSAPI = 1; @@ -36,28 +37,28 @@ public class SocksServer extends Thread { static final int NO_METHODS = -1; static final int CONNECT = 1; - static final int BIND = 2; + static final int BIND = 2; static final int UDP_ASSOC = 3; - static final int IPV4 = 1; - static final int DOMAIN_NAME = 3; - static final int IPV6 = 4; + static final int IPV4 = 1; + static final int DOMAIN_NAME = 3; + static final int IPV6 = 4; static final int REQUEST_OK = 0; static final int GENERAL_FAILURE = 1; - static final int NOT_ALLOWED = 2; + static final int NOT_ALLOWED = 2; static final int NET_UNREACHABLE = 3; static final int HOST_UNREACHABLE = 4; - static final int CONN_REFUSED = 5; - static final int TTL_EXPIRED = 6; + static final int CONN_REFUSED = 5; + static final int TTL_EXPIRED = 6; static final int CMD_NOT_SUPPORTED = 7; static final int ADDR_TYPE_NOT_SUP = 8; private int port; private ServerSocket server; private boolean useV4 = false; - private java.util.Hashtable users = new java.util.Hashtable(); - private boolean done = false; + private HashMap users = new HashMap<>(); + private volatile boolean done = false; // Inner class to handle protocol with client // This is the bulk of the work (protocol handler) class ClientHandler extends Thread { @@ -136,7 +137,7 @@ public class SocksServer extends Thread { System.err.println("User: '" + uname); System.err.println("PSWD: '" + password); if (users.containsKey(uname)) { - String p1 = (String) users.get(uname); + String p1 = users.get(uname); System.err.println("p1 = " + p1); if (p1.equals(password)) { out.write(PROTO_VERS); @@ -492,7 +493,12 @@ public class SocksServer extends Thread { public SocksServer(int port) throws IOException { this.port = port; server = new ServerSocket(); - server.bind(new InetSocketAddress(port)); + if (port == 0) { + server.bind(null); + this.port = server.getLocalPort(); + } else { + server.bind(new InetSocketAddress(port)); + } } public SocksServer() throws IOException { @@ -503,8 +509,13 @@ public class SocksServer extends Thread { users.put(user, passwd); } - public synchronized void terminate() { + public int getPort() { + return port; + } + + public void terminate() { done = true; + try { server.close(); } catch (IOException unused) {} } public void run() { diff --git a/test/java/net/Socks/SocksV4Test.java b/test/java/net/Socks/SocksV4Test.java index 0b7cd9ebcdbbed7139886a08be5f6224960609bd..d9786a217894e7c3fef2a48af306f233c2c39871 100644 --- a/test/java/net/Socks/SocksV4Test.java +++ b/test/java/net/Socks/SocksV4Test.java @@ -26,23 +26,22 @@ * @bug 4727547 * @summary SocksSocketImpl throws NullPointerException * @build SocksServer + * @run main SocksV4Test */ import java.net.*; -import java.io.*; public class SocksV4Test { - public static void main(String[] args) throws IOException { - // Create a SOCKS V4 proxy on port 8888 - SocksServer srvr = new SocksServer(8888, true); + public static void main(String[] args) throws Exception { + // Create a SOCKS V4 proxy + SocksServer srvr = new SocksServer(0, true); srvr.start(); - System.setProperty("socksProxyHost", "localhost"); - System.setProperty("socksProxyPort", "8888"); + Proxy sp = new Proxy(Proxy.Type.SOCKS, + new InetSocketAddress("localhost", srvr.getPort())); // Let's create an unresolved address InetSocketAddress ad = new InetSocketAddress("doesnt.exist.name", 1234); - Socket s = new Socket(); - try { - s.connect(ad,10000); + try (Socket s = new Socket(sp)) { + s.connect(ad, 10000); } catch (UnknownHostException ex) { // OK, that's what we expected } catch (NullPointerException npe) { @@ -50,7 +49,6 @@ public class SocksV4Test { throw new RuntimeException("Got a NUllPointerException"); } finally { srvr.terminate(); - srvr.interrupt(); } } } diff --git a/test/java/nio/file/Files/CustomOptions.java b/test/java/nio/file/Files/CustomOptions.java index a39cc6a6c9311ac7afb6fd0a71e3af63417a7aec..a06b97efd75803cfd28ba217f63873781fc1ca5d 100644 --- a/test/java/nio/file/Files/CustomOptions.java +++ b/test/java/nio/file/Files/CustomOptions.java @@ -28,6 +28,7 @@ * @author Brandon Passanisi * @library .. * @build CustomOptions PassThroughFileSystem + * @run main CustomOptions */ import java.io.IOException; diff --git a/test/java/text/Bidi/Bug6850113.java b/test/java/text/Bidi/Bug6850113.java index 91e07420e091272d48a53af2bf28d744f4834c70..704615049ce5df24ded10f77972637a133362f9e 100644 --- a/test/java/text/Bidi/Bug6850113.java +++ b/test/java/text/Bidi/Bug6850113.java @@ -25,6 +25,7 @@ * @bug 6850113 * @summary Verify the return value of digit() for some digits. * @compile -XDignore.symbol.file=true Bug6850113.java + * @run main Bug6850113 */ import sun.text.normalizer.UCharacter; diff --git a/test/java/util/jar/Manifest/CreateManifest.java b/test/java/util/jar/Manifest/CreateManifest.java new file mode 100644 index 0000000000000000000000000000000000000000..87a2b03b9a07d4bf7c6310fa79da3c8d3662abd9 --- /dev/null +++ b/test/java/util/jar/Manifest/CreateManifest.java @@ -0,0 +1,301 @@ +/* + * Copyright (c) 2012, 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 7148584 + * @summary Jar tools fails to generate manifest correctly when boundary condition hit + * @compile -XDignore.symbol.file=true CreateManifest.java + * @run main CreateManifest + */ + +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.jar.*; + +public class CreateManifest { + +public static void main(String arg[]) throws Exception { + + String jarFileName = "test.jar"; + String ManifestName = "MANIFEST.MF"; + + // create the MANIFEST.MF file + Files.write(Paths.get(ManifestName), FILE_CONTENTS.getBytes()); + + String [] args = new String [] { "cvfm", jarFileName, ManifestName}; + sun.tools.jar.Main jartool = + new sun.tools.jar.Main(System.out, System.err, "jar"); + jartool.run(args); + + try (JarFile jf = new JarFile(jarFileName)) { + Manifest m = jf.getManifest(); + String result = m.getMainAttributes().getValue("Class-path"); + if (result == null) + throw new RuntimeException("Failed to add Class-path attribute to manifest"); + } finally { + Files.deleteIfExists(Paths.get(jarFileName)); + Files.deleteIfExists(Paths.get(ManifestName)); + } + +} + +private static final String FILE_CONTENTS = + "Class-path: \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-testconsole-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-testconsole-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-bmp-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-bmp-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-host-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-host-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-agent-patching-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-agent-patching-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-connector-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-connector-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-discovery-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-gccompliance-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-mos-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-mos-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-security-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-security-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-topology-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-topology-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-event-pojo.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-event-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-event-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-mext-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-mext-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-discovery-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-discovery-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ecm-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ecm-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ecm-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-event-console-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-event-console-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-event-rules-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-event-rules-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-gccompliance-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ip-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ip-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-probanalysis-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-probanalysis-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-swlib-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-installmediacomponent-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-uifwk-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-uifwk-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-discovery-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-gccompliance-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-bmp-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-host-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-agent-patching-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-connector-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-mos-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-event-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-discovery-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-gccompliance-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ip-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-probanalysis-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-testconsole-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-uifwk-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-mext-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-security-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-agentpush-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-agentpush-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-agentpush-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-selfupdate-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-selfupdate-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-selfupdate-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-agentpush-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-groups-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-groups-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-groups-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-topology-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-jobs-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-jobs-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-jobs-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-templ-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-templ-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-templ-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-metricalertserrors-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-metricalertserrors-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-metricalertserrors-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-metrics-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-metrics-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-metrics-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-tc-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-tc-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-tc-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-agentmgmt-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-agentmgmt-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-agentmgmt-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-gcharvester-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-gcharvester-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-gcharvester-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-patching-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-patching-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-patching-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ohinv-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ohinv-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ohinv-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ohagent-pojo.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ohcoherence-pojo.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ohjrockit-pojo.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-extensibility-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-mpcustom-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-selfmonitor-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ocheck-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-udmmig-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-multioms-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-postupgrade-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-postupgrade-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-postupgrade-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ppc-pojo.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ppc-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ppc-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ppc-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ppc-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-mextjmx-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-mextjmx-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-mextjmx-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ocheck-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-services-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-services-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-services-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-eventmobile-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-uifwkmobile-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-logmgmt-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-omsproperties-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-ohel-pojo.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-agentupgrade-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-lm-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-lm-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-core-lm-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-samples-regiontest-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-samples-uipatterns-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-samples-uipatterns-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-samples-uipatterns-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-samples-uielements-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-samples-uielements-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-samples-sandbox-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-samples-sandbox-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-samples-sdkcore-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-samples-sdkcore-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-samples-sdkcore-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-samples-core-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-samples-core-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-samples-core-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-adfext-bc-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-aslm-services-public-pojo.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-avail-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-charge-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-config-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-connect-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-db-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-discovery-public-entity.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-discovery-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-event-console-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-event-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-event-rules-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-extens-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-filebrowser-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-filebrowser-public-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-gccompliance-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-gccompliance-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-gccompliance-public-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-ip-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-job-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-me-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-metric-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-ecm-public-pojo.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-ecm-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-ecm-public-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-ecm-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-paf-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-security-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-swlib-public-pojo.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-swlib-public-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-templ-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-uifwk-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-uifwk-public-pojo.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-uifwk-public-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-bmp-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-bmp-public-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-bmp-public-entity.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-agent-patching-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-agent-patching-public-pojo.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-mext-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-mext-public-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-mext-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-testconsole-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-testconsole-public-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-testconsole-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-mos-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-mos-public-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-mos-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-topology-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-topology-public-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-regions-uimodel.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-regions-public-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-event-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-uifwk-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-adfext-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-agentpatching-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-avail-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-bmp-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-charge-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-config-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-connect-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-db-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-discovery-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-ecm-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-extens-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-gccompliance-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-ip-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-job-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-me-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-metric-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-paf-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-regions-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-security-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-swlib-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-templ-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-groups-public-pojo.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-groups-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-topology-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-resources-public-pojo.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-clonecomponents-public-pojo.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-clonecomponents-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-clonecomponents-public-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-clonecomponents-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-patching-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-patching-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-ohinv-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-ohinv-test.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-ppc-public-pojo.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-ppc-public-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-agentpush-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-uifwkmobile-public-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-lm-public-model.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-lm-public-ui.jar \n" + + " /ade/dtsao_re/oracle/emcore//lib/em-sdkcore-lm-test.jar \n"; +} diff --git a/test/javax/naming/spi/DirectoryManager/GetContDirCtx.java b/test/javax/naming/spi/DirectoryManager/GetContDirCtx.java index 80e44b21da4d74c5ab69740966fee23a999db72f..520da9d39336f37714c00d627f7947fc77226564 100644 --- a/test/javax/naming/spi/DirectoryManager/GetContDirCtx.java +++ b/test/javax/naming/spi/DirectoryManager/GetContDirCtx.java @@ -26,6 +26,7 @@ * @bug 4241676 * @summary getContinuationDirContext() should set CPE environment property. * @build DummyObjectFactory DummyContext + * @run main/othervm GetContDirCtx */ import java.util.Hashtable; diff --git a/test/javax/swing/JTable/7027139/bug7027139.java b/test/javax/swing/JTable/7027139/bug7027139.java new file mode 100644 index 0000000000000000000000000000000000000000..1d2ce02823c76226e02e2b6a3ec8b84b7c26e36f --- /dev/null +++ b/test/javax/swing/JTable/7027139/bug7027139.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2012, 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 7027139 + @summary getFirstIndex() does not return the first index that has changed + @author Pavel Porvatov +*/ + +import javax.swing.*; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; + +public class bug7027139 { + public static void main(String[] args) throws Exception { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + JTable orderTable = new JTable(new String[][]{ + {"Item 1 1", "Item 1 2"}, + {"Item 2 1", "Item 2 2"}, + {"Item 3 1", "Item 3 2"}, + {"Item 4 1", "Item 4 2"}, + }, + new String[]{"Col 1", "Col 2"}); + + ListSelectionModel selectionModel = orderTable.getSelectionModel(); + selectionModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); + selectionModel.addListSelectionListener(new ListSelectionListener() { + public void valueChanged(ListSelectionEvent e) { + if (e.getValueIsAdjusting()) { + return; + } + + if (e.getFirstIndex() < 0) { + throw new RuntimeException("Test bug7027139 failed"); + } + } + }); + + orderTable.selectAll(); + } + }); + + System.out.println("Test bug7027139 passed"); + } +} diff --git a/test/sun/management/HotspotClassLoadingMBean/GetClassLoadingTime.java b/test/sun/management/HotspotClassLoadingMBean/GetClassLoadingTime.java index b663d95bbd6b365a9f7e6b7760258dfd794c4512..325ddc66a5a76d7435b1134e92fb672ea4a84810 100644 --- a/test/sun/management/HotspotClassLoadingMBean/GetClassLoadingTime.java +++ b/test/sun/management/HotspotClassLoadingMBean/GetClassLoadingTime.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, 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 @@ -27,6 +27,7 @@ * @summary Basic unit test of HotspotClassLoadingMBean.getClassLoadingTime() * @author Steve Bohne * @build ClassToLoad0 + * @run main GetClassLoadingTime */ /* @@ -71,10 +72,8 @@ public class GetClassLoadingTime { } long time2 = mbean.getClassLoadingTime(); - long count = mbean.getLoadedClassCount(); if (trace) { - System.out.println("(new count is " + count + ")"); System.out.println("Class loading time2 (ms): " + time2); } @@ -93,8 +92,6 @@ public class GetClassLoadingTime { // so we can avoid delegation and spend lots of time loading the // same class over and over, to test the class loading timer. class KlassLoader extends ClassLoader { - static String klassDir=""; - static int index=0; public KlassLoader() { super(null); @@ -102,14 +99,13 @@ class KlassLoader extends ClassLoader { protected synchronized Class findClass(String name) throws ClassNotFoundException { - String cname = klassDir - + (klassDir == "" ? "" : "/") - +name.replace('.', '/') + String cname = + name.replace('.', '/') +".class"; FileInputStream in; try { - in=new FileInputStream(cname); + in = new FileInputStream(new File(System.getProperty("test.classes", "."), cname)); if (in == null) { throw new ClassNotFoundException("getResourceAsStream(" +cname+")"); diff --git a/test/sun/misc/Cleaner/exitOnThrow.sh b/test/sun/misc/Cleaner/exitOnThrow.sh index 355f2671fbbe954e2ba8e146b07c046fb2f3a823..81daf8ba56e2f2ee0f546634f2f7a84b1d36f6b2 100644 --- a/test/sun/misc/Cleaner/exitOnThrow.sh +++ b/test/sun/misc/Cleaner/exitOnThrow.sh @@ -29,6 +29,7 @@ # @summary Ensure that if a cleaner throws an exception then the VM exits # # @build ExitOnThrow +# @run shell exitOnThrow.sh # Command-line usage: sh exitOnThrow.sh /path/to/build diff --git a/test/sun/nio/cs/OLD/TestIBMDB.java b/test/sun/nio/cs/OLD/TestIBMDB.java index 38d4991c859f8d99bf2c6c6e8464509ac897891e..571bf0c6532d8bf2b09e9ba738e2acd3c650461b 100644 --- a/test/sun/nio/cs/OLD/TestIBMDB.java +++ b/test/sun/nio/cs/OLD/TestIBMDB.java @@ -26,6 +26,7 @@ * @bug 6843578 * @summary Test IBM DB charsets * @build IBM930_OLD IBM933_OLD IBM935_OLD IBM937_OLD IBM939_OLD IBM942_OLD IBM943_OLD IBM948_OLD IBM949_OLD IBM950_OLD IBM970_OLD IBM942C_OLD IBM943C_OLD IBM949C_OLD IBM1381_OLD IBM1383_OLD EUC_CN_OLD EUC_KR_OLD GBK_OLD Johab_OLD MS932_OLD MS936_OLD MS949_OLD MS950_OLD + * @run main TestIBMDB */ import java.nio.charset.*; diff --git a/test/sun/nio/cs/OLD/TestX11CS.java b/test/sun/nio/cs/OLD/TestX11CS.java deleted file mode 100644 index 52b2ef513e2caf6fc08549e27eaa93e6d11284a3..0000000000000000000000000000000000000000 --- a/test/sun/nio/cs/OLD/TestX11CS.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2009, 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 1234567 - * @summary Test updated X11 charsets - * @build X11GB2312_OLD X11GBK_OLD X11KSC5601_OLD - */ - -import java.nio.charset.*; -import java.nio.*; -import java.util.*; - -public class TestX11CS { - - static char[] decode(byte[] bb, Charset cs) - throws Exception { - CharsetDecoder dec = cs.newDecoder(); - ByteBuffer bbf = ByteBuffer.wrap(bb); - CharBuffer cbf = CharBuffer.allocate(bb.length); - CoderResult cr = dec.decode(bbf, cbf, true); - if (cr != CoderResult.UNDERFLOW) { - System.out.println("DEC-----------------"); - int pos = bbf.position(); - System.out.printf(" cr=%s, bbf.pos=%d, bb[pos]=%x,%x,%x,%x%n", - cr.toString(), pos, - bb[pos++]&0xff, bb[pos++]&0xff,bb[pos++]&0xff, bb[pos++]&0xff); - throw new RuntimeException("Decoding err: " + cs.name()); - } - char[] cc = new char[cbf.position()]; - cbf.flip(); cbf.get(cc); - return cc; - - } - - static byte[] encode(char[] cc, Charset cs) - throws Exception { - ByteBuffer bbf = ByteBuffer.allocate(cc.length * 4); - CharBuffer cbf = CharBuffer.wrap(cc); - CharsetEncoder enc = cs.newEncoder(); - - CoderResult cr = enc.encode(cbf, bbf, true); - if (cr != CoderResult.UNDERFLOW) { - System.out.println("ENC-----------------"); - int pos = cbf.position(); - System.out.printf(" cr=%s, cbf.pos=%d, cc[pos]=%x%n", - cr.toString(), pos, cc[pos]&0xffff); - throw new RuntimeException("Encoding err: " + cs.name()); - } - byte[] bb = new byte[bbf.position()]; - bbf.flip(); bbf.get(bb); - return bb; - } - - static char[] getChars(Charset newCS, Charset oldCS) { - CharsetEncoder enc = oldCS.newEncoder(); - CharsetEncoder encNew = newCS.newEncoder(); - char[] cc = new char[0x10000]; - int pos = 0; - int i = 0; - while (i < 0x10000) { - if (enc.canEncode((char)i) != encNew.canEncode((char)i)) { - System.out.printf(" Err i=%x%n", i); - //throw new RuntimeException("canEncode() err!"); - } - if (enc.canEncode((char)i)) { - cc[pos++] = (char)i; - } - i++; - } - return Arrays.copyOf(cc, pos); - } - - static void compare(Charset newCS, Charset oldCS) throws Exception { - System.out.printf(" Diff <%s> <%s>...%n", newCS.name(), oldCS.name()); - char[] cc = getChars(newCS, oldCS); - - byte[] bb1 = encode(cc, newCS); - byte[] bb2 = encode(cc, oldCS); - - if (!Arrays.equals(bb1, bb2)) { - System.out.printf(" encoding failed!%n"); - } - char[] cc1 = decode(bb1, newCS); - char[] cc2 = decode(bb1, oldCS); - if (!Arrays.equals(cc1, cc2)) { - for (int i = 0; i < cc1.length; i++) { - if (cc1[i] != cc2[i]) { - System.out.printf("i=%d, cc1=%x cc2=%x, bb=<%x%x>%n", - i, - cc1[i]&0xffff, cc2[i]&0xffff, - bb1[i*2]&0xff, bb1[i*2+1]&0xff); - } - - } - - System.out.printf(" decoding failed%n"); - } - } - - public static void main(String[] args) throws Exception { - compare(new sun.awt.motif.X11GBK(), - new X11GBK_OLD()); - - compare(new sun.awt.motif.X11GB2312(), - new X11GB2312_OLD()); - - compare(new sun.awt.motif.X11KSC5601(), - new X11KSC5601_OLD()); - - } -} diff --git a/test/sun/security/krb5/auto/Basic.java b/test/sun/security/krb5/auto/Basic.java new file mode 100644 index 0000000000000000000000000000000000000000..1048dc037e46c2383e21da9156c5b0ae1cc9313d --- /dev/null +++ b/test/sun/security/krb5/auto/Basic.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2012, 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 7152176 + * @summary More krb5 tests + * @compile -XDignore.symbol.file Basic.java + * @run main/othervm Basic + */ + +import sun.security.jgss.GSSUtil; + +// The basic krb5 test skeleton you can copy from +public class Basic { + + public static void main(String[] args) throws Exception { + + new OneKDC(null).writeJAASConf(); + + Context c, s; + c = Context.fromJAAS("client"); + s = Context.fromJAAS("server"); + + c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID); + s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID); + + Context.handshake(c, s); + + Context.transmit("i say high --", c, s); + Context.transmit(" you say low", s, c); + + s.dispose(); + c.dispose(); + } +} diff --git a/test/sun/security/krb5/auto/Context.java b/test/sun/security/krb5/auto/Context.java index c4c0cbcc4e7d2f783c94ad903f1c9e74b0e44630..ca612bad4773c68320064c502cc1ab9b5c89736f 100644 --- a/test/sun/security/krb5/auto/Context.java +++ b/test/sun/security/krb5/auto/Context.java @@ -95,6 +95,15 @@ public class Context { return out; } + /** + * No JAAS login at all, can be used to test JGSS without JAAS + */ + public static Context fromThinAir() throws Exception { + Context out = new Context(); + out.s = new Subject(); + return out; + } + /** * Logins with a JAAS login config entry name */ @@ -111,8 +120,10 @@ public class Context { String user, char[] pass, boolean storeKey) throws Exception { return fromUserPass(null, user, pass, storeKey); } + /** * Logins with a username and a password, using Krb5LoginModule directly + * @param s existing subject, test multiple princ & creds for single subj * @param storeKey true if key should be saved, used on acceptor side */ public static Context fromUserPass(Subject s, diff --git a/test/sun/security/krb5/auto/GSS.java b/test/sun/security/krb5/auto/GSS.java new file mode 100644 index 0000000000000000000000000000000000000000..8e782095884bb23167814e09fd76e5310b432ce3 --- /dev/null +++ b/test/sun/security/krb5/auto/GSS.java @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2012, 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 7152176 + * @summary More krb5 tests + * @compile -XDignore.symbol.file GSS.java + * @run main/othervm GSS + */ + +import sun.security.jgss.GSSUtil; + +// Testing JGSS without JAAS +public class GSS { + + public static void main(String[] args) throws Exception { + + new OneKDC(null).writeJAASConf(); + + Context c, s; + c = Context.fromThinAir(); + s = Context.fromThinAir(); + + // This is the only setting needed for JGSS without JAAS. The default + // JAAS config entries are already created by OneKDC. + System.setProperty("javax.security.auth.useSubjectCredsOnly", "false"); + + c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID); + s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID); + + Context.handshake(c, s); + + Context.transmit("i say high --", c, s); + Context.transmit(" you say low", s, c); + + s.dispose(); + c.dispose(); + } +} diff --git a/test/sun/security/krb5/auto/KDC.java b/test/sun/security/krb5/auto/KDC.java index 13cad02b954c5dc3a54582ca076fe2cbc05c51e9..917c56d7b0fd7d564bb22211e6a69f08b00e4b71 100644 --- a/test/sun/security/krb5/auto/KDC.java +++ b/test/sun/security/krb5/auto/KDC.java @@ -236,80 +236,82 @@ public class KDC { } /** - * Writes or appends KDC keys into a keytab. See doc for writeMultiKtab. + * Writes or appends keys into a keytab. + *

+ * Attention: This is the most basic one of a series of methods below on + * keytab creation or modification. All these methods reference krb5.conf + * settings. If you need to modify krb5.conf or switch to another krb5.conf + * later, please call Config.refresh() again. For example: + *

+     * kdc.writeKtab("/etc/kdc/ktab", true);  // Config is initialized,
+     * System.setProperty("java.security.krb5.conf", "/home/mykrb5.conf");
+     * Config.refresh();
+     * 
+ * Inside this method there are 2 places krb5.conf is used: + *
    + *
  1. (Fatal) Generating keys: EncryptionKey.acquireSecretKeys + *
  2. (Has workaround) Creating PrincipalName + *
+ * @param tab the keytab file name * @param append true if append, otherwise, overwrite. + * @param names the names to write into, write all if names is empty */ - private static void writeKtab0(String tab, boolean append, KDC... kdcs) + public void writeKtab(String tab, boolean append, String... names) throws IOException, KrbException { KeyTab ktab = append ? KeyTab.getInstance(tab) : KeyTab.create(tab); - for (KDC kdc: kdcs) { - for (String name : kdc.passwords.keySet()) { - char[] pass = kdc.passwords.get(name); - int kvno = 0; - if (Character.isDigit(pass[pass.length-1])) { - kvno = pass[pass.length-1] - '0'; - } - ktab.addEntry(new PrincipalName(name, - name.indexOf('/') < 0 ? - PrincipalName.KRB_NT_UNKNOWN : - PrincipalName.KRB_NT_SRV_HST), - pass, - kvno, - true); + Iterable entries = + (names.length != 0) ? Arrays.asList(names): passwords.keySet(); + for (String name : entries) { + char[] pass = passwords.get(name); + int kvno = 0; + if (Character.isDigit(pass[pass.length-1])) { + kvno = pass[pass.length-1] - '0'; } + ktab.addEntry(new PrincipalName(name, + name.indexOf('/') < 0 ? + PrincipalName.KRB_NT_UNKNOWN : + PrincipalName.KRB_NT_SRV_HST), + pass, + kvno, + true); } ktab.save(); } /** * Writes all principals' keys from multiple KDCs into one keytab file. - * Note that the keys for the krbtgt principals will not be written. - *

- * Attention: This method references krb5.conf settings. If you need to - * setup krb5.conf later, please call Config.refresh() after - * the new setting. For example: - *

-     * KDC.writeKtab("/etc/kdc/ktab", kdc);  // Config is initialized,
-     * System.setProperty("java.security.krb5.conf", "/home/mykrb5.conf");
-     * Config.refresh();
-     * 
- * - * Inside this method there are 2 places krb5.conf is used: - *
    - *
  1. (Fatal) Generating keys: EncryptionKey.acquireSecretKeys - *
  2. (Has workaround) Creating PrincipalName - *
- * @param tab The keytab filename to write to. * @throws java.io.IOException for any file output error * @throws sun.security.krb5.KrbException for any realm and/or principal * name error. */ public static void writeMultiKtab(String tab, KDC... kdcs) throws IOException, KrbException { - writeKtab0(tab, false, kdcs); + KeyTab.create(tab).save(); // Empty the old keytab + appendMultiKtab(tab, kdcs); } /** * Appends all principals' keys from multiple KDCs to one keytab file. - * See writeMultiKtab for details. */ public static void appendMultiKtab(String tab, KDC... kdcs) throws IOException, KrbException { - writeKtab0(tab, true, kdcs); + for (KDC kdc: kdcs) { + kdc.writeKtab(tab, true); + } } /** * Write a ktab for this KDC. */ public void writeKtab(String tab) throws IOException, KrbException { - KDC.writeMultiKtab(tab, this); + writeKtab(tab, false); } /** * Appends keys in this KDC to a ktab. */ public void appendKtab(String tab) throws IOException, KrbException { - KDC.appendMultiKtab(tab, this); + writeKtab(tab, true); } /** diff --git a/test/sun/security/krb5/auto/TwoTab.java b/test/sun/security/krb5/auto/TwoTab.java new file mode 100644 index 0000000000000000000000000000000000000000..dd2cf96a8a4856a46705b6a97f824b5e25d3fd5f --- /dev/null +++ b/test/sun/security/krb5/auto/TwoTab.java @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2012, 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 7152176 + * @summary More krb5 tests + * @compile -XDignore.symbol.file TwoTab.java + * @run main/othervm TwoTab + */ + +import java.io.File; +import java.io.FileOutputStream; +import java.nio.file.Files; +import java.security.Security; +import sun.security.jgss.GSSUtil; +import sun.security.krb5.PrincipalName; +import sun.security.krb5.internal.ktab.KeyTab; + +// Two services using their own keytab. +public class TwoTab { + + public static void main(String[] args) throws Exception { + + KDC k = new OneKDC(null); + + // Write JAAS conf, two service using different keytabs + System.setProperty("java.security.auth.login.config", OneKDC.JAAS_CONF); + File f = new File(OneKDC.JAAS_CONF); + try (FileOutputStream fos = new FileOutputStream(f)) { + fos.write(( + "server {\n" + + " com.sun.security.auth.module.Krb5LoginModule required\n" + + " principal=\"" + OneKDC.SERVER + "\"\n" + + " useKeyTab=true\n" + + " keyTab=server.keytab\n" + + " storeKey=true;\n};\n" + + "server2 {\n" + + " com.sun.security.auth.module.Krb5LoginModule required\n" + + " principal=\"" + OneKDC.BACKEND + "\"\n" + + " useKeyTab=true\n" + + " keyTab=backend.keytab\n" + + " storeKey=true;\n};\n" + ).getBytes()); + } + f.deleteOnExit(); + + k.writeKtab("server.keytab", false, "server/host.rabbit.hole@RABBIT.HOLE"); + k.writeKtab("backend.keytab", false, "backend/host.rabbit.hole@RABBIT.HOLE"); + + Context c, s, s2; + c = Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false); + s = Context.fromJAAS("server"); + s2 = Context.fromJAAS("server2"); + + c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID); + s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID); + + Context.handshake(c, s); + + Context.transmit("i say high --", c, s); + Context.transmit(" you say low", s, c); + + s.dispose(); + c.dispose(); + + c = Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false); + c.startAsClient(OneKDC.BACKEND, GSSUtil.GSS_KRB5_MECH_OID); + s2.startAsServer(GSSUtil.GSS_KRB5_MECH_OID); + + Context.handshake(c, s2); + + Context.transmit("i say high --", c, s2); + Context.transmit(" you say low", s2, c); + + s2.dispose(); + c.dispose(); + } +} diff --git a/test/sun/security/pkcs11/KeyAgreement/TestInterop.java b/test/sun/security/pkcs11/KeyAgreement/TestInterop.java new file mode 100644 index 0000000000000000000000000000000000000000..95f1ce1c52f61f4856a886960aac833959fb27f2 --- /dev/null +++ b/test/sun/security/pkcs11/KeyAgreement/TestInterop.java @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2012, 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 7146728 + * @summary Interop test for DH with secret that has a leading 0x00 byte + * @library .. + */ +import java.math.BigInteger; +import java.util.*; + +import java.security.*; + +import javax.crypto.*; +import javax.crypto.spec.*; + +public class TestInterop extends PKCS11Test { + + private final static BigInteger p = new BigInteger + ("171718397966129586011229151993178480901904202533705695869569760169920539" + + "80807543778874708672297590042574075430109846864794139516459381007417046" + + "27996080624930219892858374168155487210358743785481212360509485282294161" + + "39585571568998066586304075565145536350296006867635076744949977849997684" + + "222020336013226588207303"); + + private final static BigInteger g = new BigInteger("2"); + + private final static BigInteger ya = new BigInteger + ("687709211571508809414670982463565909269384277848448625781941269577397703" + + "73675199968849153119146758339814638228795348558483510369322822476757204" + + "22158455966026517829008713407587339322132253724742557954802911059639161" + + "24827916158465757962384625410294483756242900146397201260757102085985457" + + "09397033481077351036224"); + + private final static BigInteger xa = new BigInteger + ("104917367119952955556289227181599819745346393858545449202252025137706135" + + "98100778613457655440586438263591136003106529323555991109623536177695714" + + "66884181531401472902830508361532232717792847436112280721439936797741371" + + "245140912614191507"); + + private final static BigInteger yb = new BigInteger + ("163887874871842952463100699681506173424091615364591742415764095471629919" + + "08421025296419917755446931473037086355546823601999684501737493240373415" + + "65608293667837249198973539289354492348897732633852665609611113031379864" + + "58514616034107537409230452318065341748503347627733368519091332060477528" + + "173423377887175351037810"); + + private final static BigInteger xb = new BigInteger + ("127757517533485947079959908591028646859165238853082197617179368337276371" + + "51601819447716934542027725311863797141734616730248519214531856941516613" + + "30313414180008978013330410484011186019824874948204261839391153650949864" + + "429505597086564709"); + + public void main(Provider prov) throws Exception { + if (prov.getService("KeyAgreement", "DH") == null) { + System.out.println("DH not supported, skipping"); + return; + } + try { + System.out.println("testing generateSecret()"); + + DHPublicKeySpec publicSpec; + DHPrivateKeySpec privateSpec; + KeyFactory kf = KeyFactory.getInstance("DH"); + KeyAgreement ka = KeyAgreement.getInstance("DH", prov); + KeyAgreement kbSunJCE = KeyAgreement.getInstance("DH", "SunJCE"); + DHPrivateKeySpec privSpecA = new DHPrivateKeySpec(xa, p, g); + DHPublicKeySpec pubSpecA = new DHPublicKeySpec(ya, p, g); + PrivateKey privA = kf.generatePrivate(privSpecA); + PublicKey pubA = kf.generatePublic(pubSpecA); + + DHPrivateKeySpec privSpecB = new DHPrivateKeySpec(xb, p, g); + DHPublicKeySpec pubSpecB = new DHPublicKeySpec(yb, p, g); + PrivateKey privB = kf.generatePrivate(privSpecB); + PublicKey pubB = kf.generatePublic(pubSpecB); + + ka.init(privA); + ka.doPhase(pubB, true); + byte[] n1 = ka.generateSecret(); + + kbSunJCE.init(privB); + kbSunJCE.doPhase(pubA, true); + byte[] n2 = kbSunJCE.generateSecret(); + + if (Arrays.equals(n1, n2) == false) { + throw new Exception("values mismatch!"); + } else { + System.out.println("values: same"); + } + + System.out.println("testing generateSecret(byte[], int)"); + byte[] n3 = new byte[n1.length]; + ka.init(privB); + ka.doPhase(pubA, true); + int n3Len = ka.generateSecret(n3, 0); + if (n3Len != n3.length) { + throw new Exception("PKCS11 Length mismatch!"); + } else System.out.println("PKCS11 Length: ok"); + byte[] n4 = new byte[n2.length]; + kbSunJCE.init(privA); + kbSunJCE.doPhase(pubB, true); + int n4Len = kbSunJCE.generateSecret(n4, 0); + if (n4Len != n4.length) { + throw new Exception("SunJCE Length mismatch!"); + } else System.out.println("SunJCE Length: ok"); + + if (Arrays.equals(n3, n4) == false) { + throw new Exception("values mismatch! "); + } else { + System.out.println("values: same"); + } + } catch (Exception ex) { + System.out.println("Unexpected ex: " + ex); + ex.printStackTrace(); + throw ex; + } + } + + public static void main(String[] args) throws Exception { + main(new TestInterop()); + } +} diff --git a/test/sun/security/pkcs11/KeyAgreement/TestShort.java b/test/sun/security/pkcs11/KeyAgreement/TestShort.java index 95ccf4ef5bb948750ca61c616214b6bae062efa4..ee9332764c8fb8bee0d047620b48199b4c9cc9ef 100644 --- a/test/sun/security/pkcs11/KeyAgreement/TestShort.java +++ b/test/sun/security/pkcs11/KeyAgreement/TestShort.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, 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,7 +23,7 @@ /** * @test - * @bug 4942494 + * @bug 4942494 7146728 * @summary KAT test for DH (normal and with secret that has leading a 0x00 byte) * @author Andreas Sterbenz * @library .. @@ -66,7 +66,7 @@ public class TestShort extends PKCS11Test { ("433011588852527167500079509018272713204454720683"); private final static byte[] s2 = parse - ("19:c7:f1:bb:2e:3d:93:fa:02:d2:e9:9f:75:32:b9:e6:7a:a0:4a:10:45:81:d4:2b:" + ("00:19:c7:f1:bb:2e:3d:93:fa:02:d2:e9:9f:75:32:b9:e6:7a:a0:4a:10:45:81:d4:2b:" + "e2:77:4c:70:41:39:7c:19:fa:65:64:47:49:8a:ad:0a:fa:9d:e9:62:68:97:c5:52" + ":b1:37:03:d9:cd:aa:e1:bd:7e:71:0c:fc:15:a1:95"); @@ -88,31 +88,36 @@ public class TestShort extends PKCS11Test { System.out.println("DH not supported, skipping"); return; } - DHPublicKeySpec publicSpec; - DHPrivateKeySpec privateSpec; - KeyFactory kf = KeyFactory.getInstance("DH", provider); - KeyAgreement ka = KeyAgreement.getInstance("DH", provider); -// KeyAgreement ka = KeyAgreement.getInstance("DH"); - - PrivateKey pr1 = kf.generatePrivate(new DHPrivateKeySpec(x1, p, g)); - PublicKey pu2 = kf.generatePublic(new DHPublicKeySpec(y2, p, g)); - PublicKey pu3 = kf.generatePublic(new DHPublicKeySpec(y3, p, g)); - - ka.init(pr1); - ka.doPhase(pu2, true); - byte[] n2 = ka.generateSecret(); - if (Arrays.equals(s2, n2) == false) { - throw new Exception("mismatch 2"); - } - System.out.println("short ok"); + try { + DHPublicKeySpec publicSpec; + DHPrivateKeySpec privateSpec; + KeyFactory kf = KeyFactory.getInstance("DH", provider); + KeyAgreement ka = KeyAgreement.getInstance("DH", provider); + + PrivateKey pr1 = kf.generatePrivate(new DHPrivateKeySpec(x1, p, g)); + PublicKey pu2 = kf.generatePublic(new DHPublicKeySpec(y2, p, g)); + PublicKey pu3 = kf.generatePublic(new DHPublicKeySpec(y3, p, g)); + + ka.init(pr1); + ka.doPhase(pu2, true); + byte[] n2 = ka.generateSecret(); + if (Arrays.equals(s2, n2) == false) { + throw new Exception("mismatch 2"); + } + System.out.println("short ok"); - ka.init(pr1); - ka.doPhase(pu3, true); - byte[] n3 = ka.generateSecret(); - if (Arrays.equals(s3, n3) == false) { - throw new Exception("mismatch 3"); + ka.init(pr1); + ka.doPhase(pu3, true); + byte[] n3 = ka.generateSecret(); + if (Arrays.equals(s3, n3) == false) { + throw new Exception("mismatch 3"); + } + System.out.println("normal ok"); + } catch (Exception ex) { + System.out.println("Unexpected Exception: " + ex); + ex.printStackTrace(); + throw ex; } - System.out.println("normal ok"); /* KeyPairGenerator kpg = KeyPairGenerator.getInstance("DH", provider); diff --git a/test/sun/security/ssl/com/sun/net/ssl/SSLSecurity/ProviderTest.java b/test/sun/security/ssl/com/sun/net/ssl/SSLSecurity/ProviderTest.java index e0530edb6787ab66a45b4767dfc33a69a876ffad..2bb3b37c7b75c4d7d166ae920d70770a499d8e06 100644 --- a/test/sun/security/ssl/com/sun/net/ssl/SSLSecurity/ProviderTest.java +++ b/test/sun/security/ssl/com/sun/net/ssl/SSLSecurity/ProviderTest.java @@ -27,6 +27,7 @@ * @compile JavaxSSLContextImpl.java ComSSLContextImpl.java * JavaxTrustManagerFactoryImpl.java ComTrustManagerFactoryImpl.java * JavaxKeyManagerFactoryImpl.java ComKeyManagerFactoryImpl.java + * @run main ProviderTest * @summary brokenness in the com.sun.net.ssl.SSLSecurity wrappers */ diff --git a/test/sun/tools/jcmd/jcmd_Output1.awk b/test/sun/tools/jcmd/jcmd_Output1.awk index 14fb2f253d3dadb7e05d901850c35ada461c6237..92bc9db6a29e01bbbbf9be9fa0050ee054df504b 100644 --- a/test/sun/tools/jcmd/jcmd_Output1.awk +++ b/test/sun/tools/jcmd/jcmd_Output1.awk @@ -20,6 +20,11 @@ BEGIN { current=1; } +# or match an empty class name +/^[0-9]+ $/ { + current=1; + } + { totallines++; matched+=current; current=0; print $0 } END { diff --git a/test/sun/tools/jps/jps-l_Output1.awk b/test/sun/tools/jps/jps-l_Output1.awk index c2afb04786aa5b9cdd40c3b05e32c244467d469e..ed90256b8dfc0d464921bf2cd350ad6091a1d915 100644 --- a/test/sun/tools/jps/jps-l_Output1.awk +++ b/test/sun/tools/jps/jps-l_Output1.awk @@ -20,6 +20,11 @@ BEGIN { matched++; } +# or match an empty class name +/^[0-9]+ $/ { + matched++; + } + { totallines++; print $0 } END { diff --git a/test/sun/tools/jps/jps_Output1.awk b/test/sun/tools/jps/jps_Output1.awk index ee94b9099d0e9401dc332155c0c8ce7a51631c0a..270889edfd986442c02e339add6e9164616b898e 100644 --- a/test/sun/tools/jps/jps_Output1.awk +++ b/test/sun/tools/jps/jps_Output1.awk @@ -20,6 +20,11 @@ BEGIN { matched++; } +# or match an empty class name +/^[0-9]+ $/ { + matched++; + } + { totallines++; print $0 } END { diff --git a/test/sun/tools/jstat/jstatClassOutput1.sh b/test/sun/tools/jstat/jstatClassOutput1.sh index 798a6f73d40da067981607cfcc372908b20243a1..fee5b0b502d9414386586f5914f672a98c34b6d4 100644 --- a/test/sun/tools/jstat/jstatClassOutput1.sh +++ b/test/sun/tools/jstat/jstatClassOutput1.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, 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,4 +33,4 @@ verify_os JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -class 0 2>&1 | awk -f ${TESTSRC}/classOutput1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -class 0 2>&1 | awk -f ${TESTSRC}/classOutput1.awk diff --git a/test/sun/tools/jstat/jstatClassloadOutput1.sh b/test/sun/tools/jstat/jstatClassloadOutput1.sh index 78f483c3e032bb7b0c19a5140fdb4118bc4c5912..7fc3cf1374a9de9d776b304363c197e329b41091 100644 --- a/test/sun/tools/jstat/jstatClassloadOutput1.sh +++ b/test/sun/tools/jstat/jstatClassloadOutput1.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 2012, 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,4 +33,4 @@ verify_os JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -classload -J-Djstat.showUnsupported=true 0 2>&1 | awk -f ${TESTSRC}/classloadOutput1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -classload -J-Djstat.showUnsupported=true 0 2>&1 | awk -f ${TESTSRC}/classloadOutput1.awk diff --git a/test/sun/tools/jstat/jstatCompilerOutput1.sh b/test/sun/tools/jstat/jstatCompilerOutput1.sh index 61cf3a69c8c677a2848afa228d66182acfb8ccec..c309bd27937473fa9e7f45ebc7230987bf38d77c 100644 --- a/test/sun/tools/jstat/jstatCompilerOutput1.sh +++ b/test/sun/tools/jstat/jstatCompilerOutput1.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, 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,4 +33,4 @@ verify_os JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -compiler 0 2>&1 | awk -f ${TESTSRC}/compilerOutput1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -compiler 0 2>&1 | awk -f ${TESTSRC}/compilerOutput1.awk diff --git a/test/sun/tools/jstat/jstatFileURITest1.sh b/test/sun/tools/jstat/jstatFileURITest1.sh index 3687adb272061507d20750bc1063773089b58b9a..94fad57ab3044f2c2f47316108bd3980b5878681 100644 --- a/test/sun/tools/jstat/jstatFileURITest1.sh +++ b/test/sun/tools/jstat/jstatFileURITest1.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, 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 @@ -40,12 +40,12 @@ Windows*) # characters into forward slash characters in an effort to convert # TESTSRC into a canonical form useable as URI path. cp ${TESTSRC}/hsperfdata_3433 . - ${JSTAT} -J-XX:+UsePerfData -gcutil file:/`pwd`/hsperfdata_3433 2>&1 | awk -f ${TESTSRC}/fileURITest1.awk + ${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil file:/`pwd`/hsperfdata_3433 2>&1 | awk -f ${TESTSRC}/fileURITest1.awk RC=$? rm -f hsperfdata_3433 2>&1 > /dev/null ;; *) - ${JSTAT} -J-XX:+UsePerfData -gcutil file:${TESTSRC}/hsperfdata_3433 2>&1 | awk -f ${TESTSRC}/fileURITest1.awk + ${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil file:${TESTSRC}/hsperfdata_3433 2>&1 | awk -f ${TESTSRC}/fileURITest1.awk RC=$? ;; esac diff --git a/test/sun/tools/jstat/jstatGcCapacityOutput1.sh b/test/sun/tools/jstat/jstatGcCapacityOutput1.sh index bc8b10a072a27fd1b45c52359aca67338efeb382..9120949b6dec11a34ab5de63fe13959f34cf316d 100644 --- a/test/sun/tools/jstat/jstatGcCapacityOutput1.sh +++ b/test/sun/tools/jstat/jstatGcCapacityOutput1.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, 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,4 +33,4 @@ verify_os JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -gccapacity 0 2>&1 | awk -f ${TESTSRC}/gcCapacityOutput1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gccapacity 0 2>&1 | awk -f ${TESTSRC}/gcCapacityOutput1.awk diff --git a/test/sun/tools/jstat/jstatGcCauseOutput1.sh b/test/sun/tools/jstat/jstatGcCauseOutput1.sh index e0c0211b2d07135a55f26b627fa3db73d33fb2eb..8f5b747043c80cf3a279d921376bbb769f4c8eab 100644 --- a/test/sun/tools/jstat/jstatGcCauseOutput1.sh +++ b/test/sun/tools/jstat/jstatGcCauseOutput1.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, 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,4 +37,4 @@ JSTAT="${TESTJAVA}/bin/jstat" # class machine, ergonomics will automatically use UseParallelGC. # The UseParallelGC collector does not currently update the gc cause counters. -${JSTAT} -J-XX:+UsePerfData -J-XX:+UseSerialGC -gccause 0 2>&1 | awk -f ${TESTSRC}/gcCauseOutput1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -J-XX:+UseSerialGC -gccause 0 2>&1 | awk -f ${TESTSRC}/gcCauseOutput1.awk diff --git a/test/sun/tools/jstat/jstatGcNewCapacityOutput1.sh b/test/sun/tools/jstat/jstatGcNewCapacityOutput1.sh index 59ffd973d7832ead203d9bde27355631e81d866c..e9a58b43fbf0a7f4ba11717b9e333ebf339115b0 100644 --- a/test/sun/tools/jstat/jstatGcNewCapacityOutput1.sh +++ b/test/sun/tools/jstat/jstatGcNewCapacityOutput1.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, 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,4 +33,4 @@ verify_os JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -gcnewcapacity 0 2>&1 | awk -f ${TESTSRC}/gcNewCapacityOutput1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcnewcapacity 0 2>&1 | awk -f ${TESTSRC}/gcNewCapacityOutput1.awk diff --git a/test/sun/tools/jstat/jstatGcNewOutput1.sh b/test/sun/tools/jstat/jstatGcNewOutput1.sh index 50aef075597da08525d796303d47162f8ed053d6..c0414906f7b2240773d24740d93650ffc4bb47ba 100644 --- a/test/sun/tools/jstat/jstatGcNewOutput1.sh +++ b/test/sun/tools/jstat/jstatGcNewOutput1.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, 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,4 +33,4 @@ verify_os JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -gcnew 0 2>&1 | awk -f ${TESTSRC}/gcNewOutput1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcnew 0 2>&1 | awk -f ${TESTSRC}/gcNewOutput1.awk diff --git a/test/sun/tools/jstat/jstatGcOldCapacityOutput1.sh b/test/sun/tools/jstat/jstatGcOldCapacityOutput1.sh index b77737b98a8c861303f40c1903fbdcc9e69217b0..d130a1e9805ee49ab7f319808c6c5152507405f4 100644 --- a/test/sun/tools/jstat/jstatGcOldCapacityOutput1.sh +++ b/test/sun/tools/jstat/jstatGcOldCapacityOutput1.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, 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,4 +33,4 @@ verify_os JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -gcoldcapacity 0 2>&1 | awk -f ${TESTSRC}/gcOldCapacityOutput1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcoldcapacity 0 2>&1 | awk -f ${TESTSRC}/gcOldCapacityOutput1.awk diff --git a/test/sun/tools/jstat/jstatGcOldOutput1.sh b/test/sun/tools/jstat/jstatGcOldOutput1.sh index 68019be751ad46b3118f2b6210c5c23c70cb1cd2..6dde8f7b41e26b7fe4dfc4bb21520108863d32c1 100644 --- a/test/sun/tools/jstat/jstatGcOldOutput1.sh +++ b/test/sun/tools/jstat/jstatGcOldOutput1.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, 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,4 +33,4 @@ verify_os JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -gcold 0 2>&1 | awk -f ${TESTSRC}/gcOldOutput1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcold 0 2>&1 | awk -f ${TESTSRC}/gcOldOutput1.awk diff --git a/test/sun/tools/jstat/jstatGcOutput1.sh b/test/sun/tools/jstat/jstatGcOutput1.sh index 7b338bccf0d17995438aec0625de25ba4410e08c..3acdceb14e771c7e736c09e5860423996e34731c 100644 --- a/test/sun/tools/jstat/jstatGcOutput1.sh +++ b/test/sun/tools/jstat/jstatGcOutput1.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, 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,4 +33,4 @@ verify_os JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -gc 0 2>&1 | awk -f ${TESTSRC}/gcOutput1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gc 0 2>&1 | awk -f ${TESTSRC}/gcOutput1.awk diff --git a/test/sun/tools/jstat/jstatGcPermCapacityOutput1.sh b/test/sun/tools/jstat/jstatGcPermCapacityOutput1.sh index 3f4f55afe7f313799577e4ca6851df104a494cb8..04754fe7a45616d6e2e363e1c00c5fdf894266b1 100644 --- a/test/sun/tools/jstat/jstatGcPermCapacityOutput1.sh +++ b/test/sun/tools/jstat/jstatGcPermCapacityOutput1.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, 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,4 +33,4 @@ verify_os JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -gcpermcapacity 0 2>&1 | awk -f ${TESTSRC}/gcPermCapacityOutput1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcpermcapacity 0 2>&1 | awk -f ${TESTSRC}/gcPermCapacityOutput1.awk diff --git a/test/sun/tools/jstat/jstatLineCounts1.sh b/test/sun/tools/jstat/jstatLineCounts1.sh index 59c4d5d56a51d1d5f7e24bd1c6036c32c56b2e4c..f9111ad3e293385838b0aac8efb107d6d4eaaa0a 100644 --- a/test/sun/tools/jstat/jstatLineCounts1.sh +++ b/test/sun/tools/jstat/jstatLineCounts1.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, 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,4 +33,4 @@ verify_os JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -gcutil 0 250 5 2>&1 | awk -f ${TESTSRC}/lineCounts1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil 0 250 5 2>&1 | awk -f ${TESTSRC}/lineCounts1.awk diff --git a/test/sun/tools/jstat/jstatLineCounts2.sh b/test/sun/tools/jstat/jstatLineCounts2.sh index 0c8b0439c9dc5c0af648f12c418a9813b681c2f8..d4577d27bc1f5b8423bbea5c9ca8d323aa59320e 100644 --- a/test/sun/tools/jstat/jstatLineCounts2.sh +++ b/test/sun/tools/jstat/jstatLineCounts2.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, 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,4 +33,4 @@ verify_os JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -gcutil 0 2>&1 | awk -f ${TESTSRC}/lineCounts2.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil 0 2>&1 | awk -f ${TESTSRC}/lineCounts2.awk diff --git a/test/sun/tools/jstat/jstatLineCounts3.sh b/test/sun/tools/jstat/jstatLineCounts3.sh index b31139c1a5ef6cae7ec4f5f8d3536d88faf46a8d..7bdd69aacc264578f3e0a8c62bfcd6b243fae753 100644 --- a/test/sun/tools/jstat/jstatLineCounts3.sh +++ b/test/sun/tools/jstat/jstatLineCounts3.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, 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,4 +33,4 @@ verify_os JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -gcutil -h 10 0 250 10 2>&1 | awk -f ${TESTSRC}/lineCounts3.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil -h 10 0 250 10 2>&1 | awk -f ${TESTSRC}/lineCounts3.awk diff --git a/test/sun/tools/jstat/jstatLineCounts4.sh b/test/sun/tools/jstat/jstatLineCounts4.sh index 772ccaa0162f4cfdea7f09bae19b7b5af0fd4a93..4226abdca52caf07a03fad58af52668e7b17e097 100644 --- a/test/sun/tools/jstat/jstatLineCounts4.sh +++ b/test/sun/tools/jstat/jstatLineCounts4.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, 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,4 +33,4 @@ verify_os JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -gcutil -h 10 0 250 11 2>&1 | awk -f ${TESTSRC}/lineCounts4.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil -h 10 0 250 11 2>&1 | awk -f ${TESTSRC}/lineCounts4.awk diff --git a/test/sun/tools/jstat/jstatOptions1.sh b/test/sun/tools/jstat/jstatOptions1.sh index c318998d0aca59056c9a5761d076bb6235ce8d3a..fa85af3994ec7e147fbeac99ceb4c4f773193b71 100644 --- a/test/sun/tools/jstat/jstatOptions1.sh +++ b/test/sun/tools/jstat/jstatOptions1.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, 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,8 +33,8 @@ setup JSTAT="${TESTJAVA}/bin/jstat" rm -f jstat.out1 jstat.out2 2>/dev/null -${JSTAT} -J-XX:+UsePerfData -options > jstat.out1 2>&1 -${JSTAT} -J-XX:+UsePerfData -options -J-Djstat.showUnsupported=true > jstat.out2 2>&1 +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -options > jstat.out1 2>&1 +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -options -J-Djstat.showUnsupported=true > jstat.out2 2>&1 diff -w jstat.out1 ${TESTSRC}/options1.out diff -w jstat.out2 ${TESTSRC}/options2.out diff --git a/test/sun/tools/jstat/jstatPrintCompilationOutput1.sh b/test/sun/tools/jstat/jstatPrintCompilationOutput1.sh index 2b763f6e23eec65ecc238d4b458573a6bf53f70d..29178fec2f376afb020e6a89f78cf3d4adbcc1e9 100644 --- a/test/sun/tools/jstat/jstatPrintCompilationOutput1.sh +++ b/test/sun/tools/jstat/jstatPrintCompilationOutput1.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, 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 @@ -35,4 +35,4 @@ JSTAT="${TESTJAVA}/bin/jstat" # run with -Xcomp as jstat may complete too quickly to assure # that compilation occurs. -${JSTAT} -J-XX:+UsePerfData -J-Xcomp -printcompilation 0 2>&1 | awk -f ${TESTSRC}/printCompilationOutput1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -J-Xcomp -printcompilation 0 2>&1 | awk -f ${TESTSRC}/printCompilationOutput1.awk diff --git a/test/sun/tools/jstat/jstatSnap1.sh b/test/sun/tools/jstat/jstatSnap1.sh index c35abd43684686282367de1713ca1de4ba8f1791..0543248dc79c3b1b5c369447c34fc8b3e0caa9c3 100644 --- a/test/sun/tools/jstat/jstatSnap1.sh +++ b/test/sun/tools/jstat/jstatSnap1.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, 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,4 +33,4 @@ verify_os JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -snap 0 2>&1 | awk -f ${TESTSRC}/snap1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -snap 0 2>&1 | awk -f ${TESTSRC}/snap1.awk diff --git a/test/sun/tools/jstat/jstatSnap2.sh b/test/sun/tools/jstat/jstatSnap2.sh index 960bb2dba1fc6e62dcd74fdf746bc42092a78d9a..7233e8cd2ad9db00e5db0c117e578018074197fa 100644 --- a/test/sun/tools/jstat/jstatSnap2.sh +++ b/test/sun/tools/jstat/jstatSnap2.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, 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,4 +33,4 @@ verify_os JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -J-Djstat.showUnsupported=true -snap 0 2>&1 | awk -f ${TESTSRC}/snap2.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -J-Djstat.showUnsupported=true -snap 0 2>&1 | awk -f ${TESTSRC}/snap2.awk diff --git a/test/sun/tools/jstat/jstatTimeStamp1.sh b/test/sun/tools/jstat/jstatTimeStamp1.sh index fce411362c6e8719957d795b98f81d4ea1f5233d..7a693690f0a1352d503b6930837712ad4b141968 100644 --- a/test/sun/tools/jstat/jstatTimeStamp1.sh +++ b/test/sun/tools/jstat/jstatTimeStamp1.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, 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,4 +33,4 @@ verify_os JSTAT="${TESTJAVA}/bin/jstat" -${JSTAT} -J-XX:+UsePerfData -gcutil -t 0 2>&1 | awk -f ${TESTSRC}/timeStamp1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil -t 0 2>&1 | awk -f ${TESTSRC}/timeStamp1.awk diff --git a/test/sun/tools/jstatd/jpsOutput1.awk b/test/sun/tools/jstatd/jpsOutput1.awk index eaf133ae406e44d0848e2b422070ce10609aab10..289d3407eeb49c932a9d241326e7e2ce898bfa0b 100644 --- a/test/sun/tools/jstatd/jpsOutput1.awk +++ b/test/sun/tools/jstatd/jpsOutput1.awk @@ -11,6 +11,10 @@ BEGIN { matched++; } +/^[0-9]+ $/ { + matched++; + } + { totallines++; print $0 } END { diff --git a/test/sun/tools/jstatd/jstatdDefaults.sh b/test/sun/tools/jstatd/jstatdDefaults.sh index 61d56e31a40630d8f2507db23dc356d07f760556..02b12cb245e0ddabe89071284344809ab0eca2d0 100644 --- a/test/sun/tools/jstatd/jstatdDefaults.sh +++ b/test/sun/tools/jstatd/jstatdDefaults.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, 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 @@ -60,7 +60,7 @@ then exit 1 fi -${JSTAT} -J-XX:+UsePerfData -gcutil ${JSTATD_PID}@${HOSTNAME} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil ${JSTATD_PID}@${HOSTNAME} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk RC=$? if [ ${RC} -ne 0 ] diff --git a/test/sun/tools/jstatd/jstatdExternalRegistry.sh b/test/sun/tools/jstatd/jstatdExternalRegistry.sh index c4d09b58b983943ecf5bea05f7a3bf3351560b6b..1773bdacecec0075557ea4348d8df780d961eab2 100644 --- a/test/sun/tools/jstatd/jstatdExternalRegistry.sh +++ b/test/sun/tools/jstatd/jstatdExternalRegistry.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, 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 @@ -73,7 +73,7 @@ then exit 1 fi -${JSTAT} -J-XX:+UsePerfData -gcutil ${JSTATD_PID}@${HOSTNAME}:${PORT} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil ${JSTATD_PID}@${HOSTNAME}:${PORT} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk RC=$? if [ ${RC} -ne 0 ] diff --git a/test/sun/tools/jstatd/jstatdPort.sh b/test/sun/tools/jstatd/jstatdPort.sh index 42c93497e55534a3e41ea0bcb27f84e9615a3e76..0780ae79c05d910ed1be7ef85a850c7ebe428c76 100644 --- a/test/sun/tools/jstatd/jstatdPort.sh +++ b/test/sun/tools/jstatd/jstatdPort.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, 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 @@ -65,7 +65,7 @@ then exit 1 fi -${JSTAT} -J-XX:+UsePerfData -gcutil ${JSTATD_PID}@${HOSTNAME}:${PORT} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil ${JSTATD_PID}@${HOSTNAME}:${PORT} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk RC=$? if [ ${RC} -ne 0 ] diff --git a/test/sun/tools/jstatd/jstatdServerName.sh b/test/sun/tools/jstatd/jstatdServerName.sh index 108826ffaa4717e92b12080d7752ff4c5d4978b9..50753d628a3dad8afc56d40fff74cd59419f7920 100644 --- a/test/sun/tools/jstatd/jstatdServerName.sh +++ b/test/sun/tools/jstatd/jstatdServerName.sh @@ -1,5 +1,5 @@ # -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2012, 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,8 +86,8 @@ then exit 1 fi -echo "running: ${JSTAT} -J-XX:+UsePerfData -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_1} 250 5" -${JSTAT} -J-XX:+UsePerfData -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_1} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk +echo "running: ${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_1} 250 5" +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_1} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk RC=$? if [ ${RC} -ne 0 ] @@ -95,8 +95,8 @@ then echo "jstat output differs from expected output" fi -echo "running: ${JSTAT} -J-XX:+UsePerfData -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_2}/${SERVERNAME} 250 5" -${JSTAT} -J-XX:+UsePerfData -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_2}/${SERVERNAME} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk +echo "running: ${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_2}/${SERVERNAME} 250 5" +${JSTAT} -J-XX:+UsePerfData -J-Duser.language=en -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_2}/${SERVERNAME} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk RC=$? if [ ${RC} -ne 0 ]