Mercurial > hg > icedtea7-forest-aarch64 > jdk
changeset 5240:c3a8fa474dab
Merge
author | cgruszka |
---|---|
date | Wed, 28 Mar 2012 10:24:20 -0400 |
parents | 712ddd5cd31c (current diff) 7bfc566a0e6d (diff) |
children | 42b162b2d764 |
files | test/java/io/FileDescriptor/FileChannelFDTest.java |
diffstat | 86 files changed, 3568 insertions(+), 687 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgtags Tue Mar 20 11:00:54 2012 -0400 +++ b/.hgtags Wed Mar 28 10:24:20 2012 -0400 @@ -158,5 +158,9 @@ d568e85567ccfdd75f3f0c42aa0d75c440422827 jdk7u4-b11 16781e84dcdb5f82c287a3b5387dde9f8aaf74e0 jdk7u4-b12 c929e96aa059c8b79ab94d5b0b1a242ca53a5b32 jdk7u4-b13 +09f612bac047b132bb9bf7d4aa8afe6ea4d5b938 jdk7u4-b14 +00f0f18379ecb927a515d1540682a922bd0227ec jdk7u4-b15 +df20c60949f8cef09be1e89d754cff366eaf7aa4 jdk7u4-b16 09f612bac047b132bb9bf7d4aa8afe6ea4d5b938 jdk7u6-b01 420027ae37b33e350877f3616ec857c00bd4c958 jdk7u6-b02 +8e8cedfb1ee265f4aff8441bae2ebf0f5b1ee853 jdk7u6-b03
--- a/make/javax/sound/jsoundalsa/Makefile Tue Mar 20 11:00:54 2012 -0400 +++ b/make/javax/sound/jsoundalsa/Makefile Wed Mar 28 10:24:20 2012 -0400 @@ -65,7 +65,7 @@ $(MIDIFILES_export) \ $(PORTFILES_export) -LDFLAGS += -lasound +OTHER_LDLIBS += -lasound CPPFLAGS += \ -DUSE_DAUDIO=TRUE \
--- a/make/launchers/Makefile.launcher Tue Mar 20 11:00:54 2012 -0400 +++ b/make/launchers/Makefile.launcher Wed Mar 28 10:24:20 2012 -0400 @@ -159,8 +159,10 @@ # GUI tools ifeq ($(GUI_TOOL),true) ifneq ($(PLATFORM), windows) - # Anything with a GUI needs X11 to be linked in. - OTHER_LDLIBS += -L$(OPENWIN_LIB) -lX11 + ifneq ($(PLATFORM), macosx) + # Anything with a GUI needs X11 to be linked in. + OTHER_LDLIBS += -L$(OPENWIN_LIB) -lX11 + endif endif endif
--- a/make/tools/src/build/tools/javazic/Mappings.java Tue Mar 20 11:00:54 2012 -0400 +++ b/make/tools/src/build/tools/javazic/Mappings.java Wed Mar 28 10:24:20 2012 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -26,6 +26,7 @@ package build.tools.javazic; import java.util.ArrayList; +import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -162,6 +163,20 @@ for (String key : toBeRemoved) { aliases.remove(key); } + // Eliminate any alias-to-alias mappings. For example, if + // there are A->B and B->C, A->B is changed to A->C. + Map<String, String> newMap = new HashMap<String, String>(); + for (String key : aliases.keySet()) { + String realid = aliases.get(key); + String leaf = realid; + while (aliases.get(leaf) != null) { + leaf = aliases.get(leaf); + } + if (!realid.equals(leaf)) { + newMap.put(key, leaf); + } + } + aliases.putAll(newMap); } Map<String,String> getAliases() {
--- a/src/macosx/classes/com/apple/laf/AquaInternalFrameUI.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/macosx/classes/com/apple/laf/AquaInternalFrameUI.java Wed Mar 28 10:24:20 2012 -0400 @@ -257,7 +257,7 @@ } public Dimension getPreferredSize(JComponent x) { - Dimension preferredSize = super.getMinimumSize(x); + Dimension preferredSize = super.getPreferredSize(x); Dimension minimumSize = frame.getMinimumSize(); if (preferredSize.width < minimumSize.width) { preferredSize.width = minimumSize.width;
--- a/src/macosx/classes/com/apple/laf/AquaKeyBindings.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/macosx/classes/com/apple/laf/AquaKeyBindings.java Wed Mar 28 10:24:20 2012 -0400 @@ -142,6 +142,21 @@ })); } + LateBoundInputMap getPasswordFieldInputMap() { + return new LateBoundInputMap(new SimpleBinding(getTextFieldInputMap().getBindings()), + // nullify all the bindings that may discover space characters in the text + new SimpleBinding(new String[] { + "alt LEFT", null, + "alt KP_LEFT", null, + "alt RIGHT", null, + "alt KP_RIGHT", null, + "shift alt LEFT", null, + "shift alt KP_LEFT", null, + "shift alt RIGHT", null, + "shift alt KP_RIGHT", null, + })); + } + LateBoundInputMap getMultiLineTextInputMap() { return new LateBoundInputMap(new SimpleBinding(commonTextEditorBindings), new SimpleBinding(new String[] { "ENTER", DefaultEditorKit.insertBreakAction,
--- a/src/macosx/classes/com/apple/laf/AquaLookAndFeel.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/macosx/classes/com/apple/laf/AquaLookAndFeel.java Wed Mar 28 10:24:20 2012 -0400 @@ -691,7 +691,7 @@ "Panel.foreground", black, "Panel.opaque", useOpaqueComponents, - "PasswordField.focusInputMap", aquaKeyBindings.getTextFieldInputMap(), + "PasswordField.focusInputMap", aquaKeyBindings.getPasswordFieldInputMap(), "PasswordField.font", controlFont, "PasswordField.background", textBackground, "PasswordField.foreground", textForeground,
--- a/src/macosx/classes/com/apple/laf/AquaTabbedPaneUI.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/macosx/classes/com/apple/laf/AquaTabbedPaneUI.java Wed Mar 28 10:24:20 2012 -0400 @@ -318,7 +318,7 @@ } // not for the scrolling tabs - if (tabIndex >= 0) { + if (component == null && tabIndex >= 0) { paintTitle(g2d, font, metrics, textRect, tabIndex, title); }
--- a/src/macosx/classes/sun/lwawt/LWComponentPeer.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/macosx/classes/sun/lwawt/LWComponentPeer.java Wed Mar 28 10:24:20 2012 -0400 @@ -982,16 +982,23 @@ // DropTargetPeer Method @Override public void addDropTarget(DropTarget dt) { - synchronized (dropTargetLock){ - // 10-14-02 VL: Windows WComponentPeer would add (or remove) the drop target only - // if it's the first (or last) one for the component. Otherwise this call is a no-op. - if (++fNumDropTargets == 1) { - // Having a non-null drop target would be an error but let's check just in case: - if (fDropTarget != null) - System.err.println("CComponent.addDropTarget(): current drop target is non-null."); + LWWindowPeer winPeer = getWindowPeerOrSelf(); + if (winPeer != null && winPeer != this) { + // We need to register the DropTarget in the + // peer of the window ancestor of the component + winPeer.addDropTarget(dt); + } else { + synchronized (dropTargetLock) { + // 10-14-02 VL: Windows WComponentPeer would add (or remove) the drop target only + // if it's the first (or last) one for the component. Otherwise this call is a no-op. + if (++fNumDropTargets == 1) { + // Having a non-null drop target would be an error but let's check just in case: + if (fDropTarget != null) + System.err.println("CComponent.addDropTarget(): current drop target is non-null."); - // Create a new drop target: - fDropTarget = CDropTarget.createDropTarget(dt, target, this); + // Create a new drop target: + fDropTarget = CDropTarget.createDropTarget(dt, target, this); + } } } } @@ -999,17 +1006,24 @@ // DropTargetPeer Method @Override public void removeDropTarget(DropTarget dt) { - synchronized (dropTargetLock){ - // 10-14-02 VL: Windows WComponentPeer would add (or remove) the drop target only - // if it's the first (or last) one for the component. Otherwise this call is a no-op. - if (--fNumDropTargets == 0) { - // Having a null drop target would be an error but let's check just in case: - if (fDropTarget != null) { - // Dispose of the drop target: - fDropTarget.dispose(); - fDropTarget = null; - } else - System.err.println("CComponent.removeDropTarget(): current drop target is null."); + LWWindowPeer winPeer = getWindowPeerOrSelf(); + if (winPeer != null && winPeer != this) { + // We need to unregister the DropTarget in the + // peer of the window ancestor of the component + winPeer.removeDropTarget(dt); + } else { + synchronized (dropTargetLock){ + // 10-14-02 VL: Windows WComponentPeer would add (or remove) the drop target only + // if it's the first (or last) one for the component. Otherwise this call is a no-op. + if (--fNumDropTargets == 0) { + // Having a null drop target would be an error but let's check just in case: + if (fDropTarget != null) { + // Dispose of the drop target: + fDropTarget.dispose(); + fDropTarget = null; + } else + System.err.println("CComponent.removeDropTarget(): current drop target is null."); + } } } } @@ -1114,7 +1128,7 @@ sendEventToDelegate(e); } - private void sendEventToDelegate(final AWTEvent e) { + protected void sendEventToDelegate(final AWTEvent e) { synchronized (getDelegateLock()) { if (getDelegate() == null || !isShowing() || !isEnabled()) { return;
--- a/src/macosx/classes/sun/lwawt/LWScrollPanePeer.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/macosx/classes/sun/lwawt/LWScrollPanePeer.java Wed Mar 28 10:24:20 2012 -0400 @@ -29,6 +29,7 @@ import javax.swing.event.ChangeListener; import javax.swing.event.ChangeEvent; import java.awt.*; +import java.awt.event.MouseWheelEvent; import java.awt.peer.ScrollPanePeer; import java.util.List; @@ -52,6 +53,21 @@ } @Override + public void handleEvent(AWTEvent e) { + if (e instanceof MouseWheelEvent) { + MouseWheelEvent wheelEvent = (MouseWheelEvent) e; + //java.awt.ScrollPane consumes the event + // in case isWheelScrollingEnabled() is true, + // forcibly send the consumed event to the delegate + if (getTarget().isWheelScrollingEnabled() && wheelEvent.isConsumed()) { + sendEventToDelegate(wheelEvent); + } + } else { + super.handleEvent(e); + } + } + + @Override public void stateChanged(final ChangeEvent e) { SwingUtilities.invokeLater(new Runnable() { @Override
--- a/src/macosx/classes/sun/lwawt/LWTextFieldPeer.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/macosx/classes/sun/lwawt/LWTextFieldPeer.java Wed Mar 28 10:24:20 2012 -0400 @@ -34,7 +34,7 @@ import java.awt.event.FocusEvent; import java.awt.peer.TextFieldPeer; -import javax.swing.JPasswordField; +import javax.swing.*; import javax.swing.text.JTextComponent; final class LWTextFieldPeer @@ -50,7 +50,7 @@ @Override protected JPasswordField createDelegate() { - return new JTextAreaDelegate(); + return new JPasswordFieldDelegate(); } @Override @@ -71,9 +71,18 @@ public void setEchoChar(final char echoChar) { synchronized (getDelegateLock()) { getDelegate().setEchoChar(echoChar); - getDelegate().putClientProperty("JPasswordField.cutCopyAllowed", - getDelegate().echoCharIsSet() - ? Boolean.FALSE : Boolean.TRUE); + final boolean cutCopyAllowed; + final String focusInputMapKey; + if (echoChar != 0) { + cutCopyAllowed = false; + focusInputMapKey = "PasswordField.focusInputMap"; + } else { + cutCopyAllowed = true; + focusInputMapKey = "TextField.focusInputMap"; + } + getDelegate().putClientProperty("JPasswordField.cutCopyAllowed", cutCopyAllowed); + InputMap inputMap = (InputMap) UIManager.get(focusInputMapKey); + SwingUtilities.replaceUIInputMap(getDelegate(), JComponent.WHEN_FOCUSED, inputMap); } } @@ -113,11 +122,11 @@ super.handleJavaFocusEvent(e); } - private final class JTextAreaDelegate extends JPasswordField { + private final class JPasswordFieldDelegate extends JPasswordField { // Empty non private constructor was added because access to this // class shouldn't be emulated by a synthetic accessor method. - JTextAreaDelegate() { + JPasswordFieldDelegate() { super(); }
--- a/src/macosx/classes/sun/lwawt/LWToolkit.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/macosx/classes/sun/lwawt/LWToolkit.java Wed Mar 28 10:24:20 2012 -0400 @@ -522,11 +522,6 @@ 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() {
--- a/src/macosx/classes/sun/lwawt/LWWindowPeer.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/macosx/classes/sun/lwawt/LWWindowPeer.java Wed Mar 28 10:24:20 2012 -0400 @@ -1072,11 +1072,7 @@ 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; }
--- a/src/macosx/classes/sun/lwawt/PlatformWindow.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/macosx/classes/sun/lwawt/PlatformWindow.java Wed Mar 28 10:24:20 2012 -0400 @@ -27,6 +27,7 @@ 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 void updateFocusableWindowState(); + public boolean rejectFocusRequest(CausedFocusEvent.Cause cause); + public boolean requestWindowFocus(); /*
--- a/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java Wed Mar 28 10:24:20 2012 -0400 @@ -38,6 +38,8 @@ public class CEmbeddedFrame extends EmbeddedFrame { private CPlatformResponder responder; + private boolean focused = true; + private boolean parentWindowActive = true; public CEmbeddedFrame() { show(); @@ -94,4 +96,31 @@ 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)); + } + }
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java Wed Mar 28 10:24:20 2012 -0400 @@ -33,17 +33,23 @@ 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 void initialize(Window target, final LWWindowPeer peer, PlatformWindow owner) { this.peer = peer; this.windowLayer = new CGLLayer(peer); + this.target = (CEmbeddedFrame)target; } @Override @@ -149,6 +156,18 @@ 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; }
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Wed Mar 28 10:24:20 2012 -0400 @@ -65,6 +65,7 @@ // 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 @@ 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 @@ 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 @@ // 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 @@ 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 @@ } // 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,11 +496,18 @@ // If it ain't blocked, or is being hidden, go regular way if (visible) { CWrapper.NSWindow.makeFirstResponder(nsWindowPtr, contentView.getAWTView()); + + 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.makeKeyAndOrderFront(nsWindowPtr); - } else { - CWrapper.NSWindow.orderFront(nsWindowPtr); + CWrapper.NSWindow.makeKeyWindow(nsWindowPtr); } } else { CWrapper.NSWindow.orderOut(nsWindowPtr); @@ -608,7 +613,20 @@ } @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); @@ -759,6 +777,11 @@ * 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); }
--- a/src/macosx/classes/sun/lwawt/macosx/CWrapper.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/macosx/classes/sun/lwawt/macosx/CWrapper.java Wed Mar 28 10:24:20 2012 -0400 @@ -47,6 +47,7 @@ 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);
--- a/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java Wed Mar 28 10:24:20 2012 -0400 @@ -686,7 +686,10 @@ return sunAwtDisableCALayers.booleanValue(); } - @Override + + /* + * Returns true if the application (one of its windows) owns keyboard focus. + */ public native boolean isApplicationActive(); /************************
--- a/src/macosx/native/sun/awt/AWTWindow.m Tue Mar 20 11:00:54 2012 -0400 +++ b/src/macosx/native/sun/awt/AWTWindow.m Wed Mar 28 10:24:20 2012 -0400 @@ -102,11 +102,12 @@ 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; }
--- a/src/macosx/native/sun/awt/CDropTarget.m Tue Mar 20 11:00:54 2012 -0400 +++ b/src/macosx/native/sun/awt/CDropTarget.m Wed Mar 28 10:24:20 2012 -0400 @@ -648,6 +648,10 @@ if (sDraggingError == FALSE) { sDraggingLocation = [sender draggingLocation]; NSPoint javaLocation = [fView convertPoint:sDraggingLocation fromView:nil]; + // The y coordinate that comes in the NSDraggingInfo seems to be reversed - probably + // has to do something with the type of view it comes to. + // This is the earliest place where we can correct it. + javaLocation.y = fView.window.frame.size.height - javaLocation.y; jint actions = [DnDUtilities mapNSDragOperationMaskToJava:[sender draggingSourceOperationMask]]; jint dropAction = sJavaDropOperation;
--- a/src/macosx/native/sun/awt/CFileDialog.m Tue Mar 20 11:00:54 2012 -0400 +++ b/src/macosx/native/sun/awt/CFileDialog.m Wed Mar 28 10:24:20 2012 -0400 @@ -117,13 +117,15 @@ fPanelResult = [thePanel runModalForDirectory:fDirectory file:fFile]; [thePanel setDelegate:nil]; - if (fMode == java_awt_FileDialog_LOAD) { - NSOpenPanel *openPanel = (NSOpenPanel *)thePanel; - fURLs = [openPanel URLs]; - } else { - fURLs = [NSArray arrayWithObject:[thePanel URL]]; + if ([self userClickedOK]) { + if (fMode == java_awt_FileDialog_LOAD) { + NSOpenPanel *openPanel = (NSOpenPanel *)thePanel; + fURLs = [openPanel URLs]; + } else { + fURLs = [NSArray arrayWithObject:[thePanel URL]]; + } + [fURLs retain]; } - [fURLs retain]; } [self disposer]; @@ -213,12 +215,11 @@ returnValue = (*env)->NewObjectArray(env, count, stringClass, NULL); (*env)->DeleteLocalRef(env, stringClass); - NSUInteger i; - for (i = 0; i < count; i++) { - jstring filename = JNFNSToJavaString(env, [[urls objectAtIndex:i] absoluteString]); - (*env)->SetObjectArrayElement(env, returnValue, i, filename); + [urls enumerateObjectsUsingBlock:^(id url, NSUInteger index, BOOL *stop) { + jstring filename = JNFNormalizedJavaStringForPath(env, [url path]); + (*env)->SetObjectArrayElement(env, returnValue, index, filename); (*env)->DeleteLocalRef(env, filename); - } + }]; } [dialogDelegate release];
--- a/src/macosx/native/sun/awt/CWrapper.m Tue Mar 20 11:00:54 2012 -0400 +++ b/src/macosx/native/sun/awt/CWrapper.m Wed Mar 28 10:24:20 2012 -0400 @@ -76,6 +76,26 @@ /* * 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 * Signature: (J)V */
--- a/src/macosx/native/sun/awt/LWCToolkit.m Tue Mar 20 11:00:54 2012 -0400 +++ b/src/macosx/native/sun/awt/LWCToolkit.m Wed Mar 28 10:24:20 2012 -0400 @@ -401,18 +401,21 @@ 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; }
--- a/src/macosx/native/sun/awt/awt.m Tue Mar 20 11:00:54 2012 -0400 +++ b/src/macosx/native/sun/awt/awt.m Wed Mar 28 10:24:20 2012 -0400 @@ -306,6 +306,18 @@ // AWT gets here AFTER +[AWTStarter appKitIsRunning:] is called. if (verbose) AWT_DEBUG_LOG(@"got out of the AppKit startup mutex"); } + + // Don't set the delegate until the NSApplication has been created and + // its finishLaunching has initialized it. + // ApplicationDelegate is the support code for com.apple.eawt. + void (^setDelegateBlock)() = ^(){ + OSXAPP_SetApplicationDelegate([ApplicationDelegate sharedDelegate]); + }; + if (onMainThread) { + setDelegateBlock(); + } else { + [JNFRunLoop performOnMainThreadWaiting:YES withBlock:setDelegateBlock]; + } } - (void)starter:(NSArray*)args { @@ -340,10 +352,6 @@ // AppKit Application. NSApplication *app = [NSApplicationAWT sharedApplication]; - // Don't set the delegate until the NSApplication has been created. - // ApplicationDelegate is the support code for com.apple.eawt. - OSXAPP_SetApplicationDelegate([ApplicationDelegate sharedDelegate]); - // AWT gets to this point BEFORE NSApplicationDidFinishLaunchingNotification is sent. if (![app isRunning]) { if (verbose) AWT_DEBUG_LOG(@"+[AWTStarter startAWT]: ![app isRunning]");
--- a/src/share/bin/java.c Tue Mar 20 11:00:54 2012 -0400 +++ b/src/share/bin/java.c Wed Mar 28 10:24:20 2012 -0400 @@ -362,6 +362,11 @@ exit(1); } + if (showSettings != NULL) { + ShowSettings(env, showSettings); + CHECK_EXCEPTION_LEAVE(1); + } + if (printVersion || showVersion) { PrintJavaVersion(env, showVersion); CHECK_EXCEPTION_LEAVE(0); @@ -370,10 +375,6 @@ } } - if (showSettings != NULL) { - ShowSettings(env, showSettings); - CHECK_EXCEPTION_LEAVE(1); - } /* If the user specified neither a class name nor a JAR file */ if (printXUsage || printUsage || what == 0 || mode == LM_UNKNOWN) { PrintUsage(env, printXUsage);
--- a/src/share/classes/com/sun/jndi/toolkit/url/UrlUtil.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/share/classes/com/sun/jndi/toolkit/url/UrlUtil.java Wed Mar 28 10:24:20 2012 -0400 @@ -27,6 +27,7 @@ import java.net.MalformedURLException; import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; /** * Utilities for dealing with URLs. @@ -61,29 +62,14 @@ * The string is subsequently converted using the specified encoding */ public static final String decode(String s, String enc) - throws MalformedURLException, UnsupportedEncodingException { - - int length = s.length(); - byte[] bytes = new byte[length]; - int j = 0; - - for (int i = 0; i < length; i++) { - if (s.charAt(i) == '%') { - i++; // skip % - try { - bytes[j++] = (byte) - Integer.parseInt(s.substring(i, i + 2), 16); - - } catch (Exception e) { - throw new MalformedURLException("Invalid URI encoding: " + s); - } - i++; // skip first hex char; for loop will skip second one - } else { - bytes[j++] = (byte) s.charAt(i); - } + throws MalformedURLException, UnsupportedEncodingException { + try { + return URLDecoder.decode(s, enc); + } catch (IllegalArgumentException iae) { + MalformedURLException mue = new MalformedURLException("Invalid URI encoding: " + s); + mue.initCause(iae); + throw mue; } - - return new String(bytes, 0, j, enc); } /**
--- a/src/share/classes/java/awt/Component.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/share/classes/java/awt/Component.java Wed Mar 28 10:24:20 2012 -0400 @@ -10072,11 +10072,12 @@ } Window window = getContainingWindow(); if (window != null) { - if (!window.hasHeavyweightDescendants() || !window.hasLightweightDescendants()) { + if (!window.hasHeavyweightDescendants() || !window.hasLightweightDescendants() || window.isDisposing()) { if (mixingLog.isLoggable(PlatformLogger.FINE)) { mixingLog.fine("containing window = " + window + "; has h/w descendants = " + window.hasHeavyweightDescendants() + - "; has l/w descendants = " + window.hasLightweightDescendants()); + "; has l/w descendants = " + window.hasLightweightDescendants() + + "; disposing = " + window.isDisposing()); } return false; }
--- a/src/share/classes/java/awt/Window.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/share/classes/java/awt/Window.java Wed Mar 28 10:24:20 2012 -0400 @@ -226,6 +226,7 @@ static boolean systemSyncLWRequests = false; boolean syncLWRequests = false; transient boolean beforeFirstShow = true; + private transient boolean disposing = false; static final int OPENED = 0x01; @@ -1162,36 +1163,41 @@ void doDispose() { class DisposeAction implements Runnable { public void run() { - // Check if this window is the fullscreen window for the - // device. Exit the fullscreen mode prior to disposing - // of the window if that's the case. - GraphicsDevice gd = getGraphicsConfiguration().getDevice(); - if (gd.getFullScreenWindow() == Window.this) { - gd.setFullScreenWindow(null); - } - - Object[] ownedWindowArray; - synchronized(ownedWindowList) { - ownedWindowArray = new Object[ownedWindowList.size()]; - ownedWindowList.copyInto(ownedWindowArray); + disposing = true; + try { + // Check if this window is the fullscreen window for the + // device. Exit the fullscreen mode prior to disposing + // of the window if that's the case. + GraphicsDevice gd = getGraphicsConfiguration().getDevice(); + if (gd.getFullScreenWindow() == Window.this) { + gd.setFullScreenWindow(null); + } + + Object[] ownedWindowArray; + synchronized(ownedWindowList) { + ownedWindowArray = new Object[ownedWindowList.size()]; + ownedWindowList.copyInto(ownedWindowArray); + } + for (int i = 0; i < ownedWindowArray.length; i++) { + Window child = (Window) (((WeakReference) + (ownedWindowArray[i])).get()); + if (child != null) { + child.disposeImpl(); + } + } + hide(); + beforeFirstShow = true; + removeNotify(); + synchronized (inputContextLock) { + if (inputContext != null) { + inputContext.dispose(); + inputContext = null; + } + } + clearCurrentFocusCycleRootOnHide(); + } finally { + disposing = false; } - for (int i = 0; i < ownedWindowArray.length; i++) { - Window child = (Window) (((WeakReference) - (ownedWindowArray[i])).get()); - if (child != null) { - child.disposeImpl(); - } - } - hide(); - beforeFirstShow = true; - removeNotify(); - synchronized (inputContextLock) { - if (inputContext != null) { - inputContext.dispose(); - inputContext = null; - } - } - clearCurrentFocusCycleRootOnHide(); } } DisposeAction action = new DisposeAction(); @@ -2734,6 +2740,10 @@ return visible; } + boolean isDisposing() { + return disposing; + } + /** * @deprecated As of J2SE 1.4, replaced by * {@link Component#applyComponentOrientation Component.applyComponentOrientation}.
--- a/src/share/classes/java/beans/ChangeListenerMap.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/share/classes/java/beans/ChangeListenerMap.java Wed Mar 28 10:24:20 2012 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -237,11 +237,5 @@ * * @return a real listener */ - public final L extract(L listener) { - while (listener instanceof EventListenerProxy) { - EventListenerProxy<L> proxy = (EventListenerProxy<L>) listener; - listener = proxy.getListener(); - } - return listener; - } + public abstract L extract(L listener); }
--- a/src/share/classes/java/beans/PropertyChangeSupport.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/share/classes/java/beans/PropertyChangeSupport.java Wed Mar 28 10:24:20 2012 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -532,5 +532,15 @@ protected PropertyChangeListener newProxy(String name, PropertyChangeListener listener) { return new PropertyChangeListenerProxy(name, listener); } + + /** + * {@inheritDoc} + */ + public final PropertyChangeListener extract(PropertyChangeListener listener) { + while (listener instanceof PropertyChangeListenerProxy) { + listener = ((PropertyChangeListenerProxy) listener).getListener(); + } + return listener; + } } }
--- a/src/share/classes/java/beans/VetoableChangeSupport.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/share/classes/java/beans/VetoableChangeSupport.java Wed Mar 28 10:24:20 2012 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 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 @@ -521,5 +521,15 @@ protected VetoableChangeListener newProxy(String name, VetoableChangeListener listener) { return new VetoableChangeListenerProxy(name, listener); } + + /** + * {@inheritDoc} + */ + public final VetoableChangeListener extract(VetoableChangeListener listener) { + while (listener instanceof VetoableChangeListenerProxy) { + listener = ((VetoableChangeListenerProxy) listener).getListener(); + } + return listener; + } } }
--- a/src/share/classes/java/io/FileInputStream.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/share/classes/java/io/FileInputStream.java Wed Mar 28 10:24:20 2012 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 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 @@ -56,16 +56,6 @@ private final Object closeLock = new Object(); private volatile boolean closed = false; - private static final ThreadLocal<Boolean> runningFinalize = - new ThreadLocal<>(); - - private static boolean isRunningFinalize() { - Boolean val; - if ((val = runningFinalize.get()) != null) - return val.booleanValue(); - return false; - } - /** * Creates a <code>FileInputStream</code> by * opening a connection to an actual file, @@ -134,7 +124,7 @@ throw new NullPointerException(); } fd = new FileDescriptor(); - fd.incrementAndGetUseCount(); + fd.attach(this); open(name); } @@ -174,10 +164,9 @@ /* * FileDescriptor is being shared by streams. - * Ensure that it's GC'ed only when all the streams/channels are done - * using it. + * Register this stream with FileDescriptor tracker. */ - fd.incrementAndGetUseCount(); + fd.attach(this); } /** @@ -304,27 +293,13 @@ closed = true; } if (channel != null) { - /* - * Decrement the FD use count associated with the channel - * The use count is incremented whenever a new channel - * is obtained from this stream. - */ - fd.decrementAndGetUseCount(); channel.close(); } - - /* - * Decrement the FD use count associated with this stream - */ - int useCount = fd.decrementAndGetUseCount(); - - /* - * If FileDescriptor is still in use by another stream, the finalizer - * will not close it. - */ - if ((useCount <= 0) || !isRunningFinalize()) { - close0(); - } + fd.closeAll(new Closeable() { + public void close() throws IOException { + close0(); + } + }); } /** @@ -338,7 +313,9 @@ * @see java.io.FileDescriptor */ public final FileDescriptor getFD() throws IOException { - if (fd != null) return fd; + if (fd != null) { + return fd; + } throw new IOException(); } @@ -362,13 +339,6 @@ synchronized (this) { if (channel == null) { channel = FileChannelImpl.open(fd, true, false, this); - - /* - * Increment fd's use count. Invoking the channel's close() - * method will result in decrementing the use count set for - * the channel. - */ - fd.incrementAndGetUseCount(); } return channel; } @@ -391,18 +361,12 @@ */ protected void finalize() throws IOException { if ((fd != null) && (fd != FileDescriptor.in)) { - - /* - * Finalizer should not release the FileDescriptor if another - * stream is still using it. If the user directly invokes - * close() then the FileDescriptor is also released. + /* if fd is shared, the references in FileDescriptor + * will ensure that finalizer is only called when + * safe to do so. All references using the fd have + * become unreachable. We can call close() */ - runningFinalize.set(Boolean.TRUE); - try { - close(); - } finally { - runningFinalize.set(Boolean.FALSE); - } + close(); } } }
--- a/src/share/classes/java/io/FileOutputStream.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/share/classes/java/io/FileOutputStream.java Wed Mar 28 10:24:20 2012 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 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 @@ -69,15 +69,6 @@ private final Object closeLock = new Object(); private volatile boolean closed = false; - private static final ThreadLocal<Boolean> runningFinalize = - new ThreadLocal<>(); - - private static boolean isRunningFinalize() { - Boolean val; - if ((val = runningFinalize.get()) != null) - return val.booleanValue(); - return false; - } /** * Creates a file output stream to write to the file with the @@ -208,7 +199,7 @@ this.fd = new FileDescriptor(); this.append = append; - fd.incrementAndGetUseCount(); + fd.attach(this); open(name, append); } @@ -245,13 +236,7 @@ } this.fd = fdObj; this.append = false; - - /* - * FileDescriptor is being shared by streams. - * Ensure that it's GC'ed only when all the streams/channels are done - * using it. - */ - fd.incrementAndGetUseCount(); + fd.attach(this); } /** @@ -340,27 +325,13 @@ } if (channel != null) { - /* - * Decrement FD use count associated with the channel - * The use count is incremented whenever a new channel - * is obtained from this stream. - */ - fd.decrementAndGetUseCount(); channel.close(); } - - /* - * Decrement FD use count associated with this stream - */ - int useCount = fd.decrementAndGetUseCount(); - - /* - * If FileDescriptor is still in use by another stream, the finalizer - * will not close it. - */ - if ((useCount <= 0) || !isRunningFinalize()) { - close0(); - } + fd.closeAll(new Closeable() { + public void close() throws IOException { + close0(); + } + }); } /** @@ -374,7 +345,9 @@ * @see java.io.FileDescriptor */ public final FileDescriptor getFD() throws IOException { - if (fd != null) return fd; + if (fd != null) { + return fd; + } throw new IOException(); } @@ -399,13 +372,6 @@ synchronized (this) { if (channel == null) { channel = FileChannelImpl.open(fd, false, true, append, this); - - /* - * Increment fd's use count. Invoking the channel's close() - * method will result in decrementing the use count set for - * the channel. - */ - fd.incrementAndGetUseCount(); } return channel; } @@ -424,18 +390,12 @@ if (fd == FileDescriptor.out || fd == FileDescriptor.err) { flush(); } else { - - /* - * Finalizer should not release the FileDescriptor if another - * stream is still using it. If the user directly invokes - * close() then the FileDescriptor is also released. + /* if fd is shared, the references in FileDescriptor + * will ensure that finalizer is only called when + * safe to do so. All references using the fd have + * become unreachable. We can call close() */ - runningFinalize.set(Boolean.TRUE); - try { - close(); - } finally { - runningFinalize.set(Boolean.FALSE); - } + close(); } } }
--- a/src/share/classes/java/io/RandomAccessFile.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/share/classes/java/io/RandomAccessFile.java Wed Mar 28 10:24:20 2012 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 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 @@ -229,7 +229,7 @@ throw new NullPointerException(); } fd = new FileDescriptor(); - fd.incrementAndGetUseCount(); + fd.attach(this); open(name, imode); } @@ -242,7 +242,9 @@ * @see java.io.FileDescriptor */ public final FileDescriptor getFD() throws IOException { - if (fd != null) return fd; + if (fd != null) { + return fd; + } throw new IOException(); } @@ -268,17 +270,6 @@ synchronized (this) { if (channel == null) { channel = FileChannelImpl.open(fd, true, rw, this); - - /* - * FileDescriptor could be shared by FileInputStream or - * FileOutputStream. - * Ensure that FD is GC'ed only when all the streams/channels - * are done using it. - * Increment fd's use count. Invoking the channel's close() - * method will result in decrementing the use count set for - * the channel. - */ - fd.incrementAndGetUseCount(); } return channel; } @@ -577,21 +568,13 @@ closed = true; } if (channel != null) { - /* - * Decrement FD use count associated with the channel. The FD use - * count is incremented whenever a new channel is obtained from - * this stream. - */ - fd.decrementAndGetUseCount(); channel.close(); } - - /* - * Decrement FD use count associated with this stream. - * The count got incremented by FileDescriptor during its construction. - */ - fd.decrementAndGetUseCount(); - close0(); + fd.closeAll(new Closeable() { + public void close() throws IOException { + close0(); + } + }); } //
--- a/src/share/classes/java/util/Collections.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/share/classes/java/util/Collections.java Wed Mar 28 10:24:20 2012 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, 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 @@ -1489,6 +1489,8 @@ } public int hashCode() {return e.hashCode();} public boolean equals(Object o) { + if (this == o) + return true; if (!(o instanceof Map.Entry)) return false; Map.Entry t = (Map.Entry)o; @@ -1709,6 +1711,8 @@ } public boolean equals(Object o) { + if (this == o) + return true; synchronized (mutex) {return c.equals(o);} } public int hashCode() { @@ -1863,6 +1867,8 @@ } public boolean equals(Object o) { + if (this == o) + return true; synchronized (mutex) {return list.equals(o);} } public int hashCode() { @@ -2073,6 +2079,8 @@ } public boolean equals(Object o) { + if (this == o) + return true; synchronized (mutex) {return m.equals(o);} } public int hashCode() {
--- a/src/share/classes/java/util/jar/Manifest.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/share/classes/java/util/jar/Manifest.java Wed Mar 28 10:24:20 2012 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2006, 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 @@ -400,6 +400,8 @@ public byte peek() throws IOException { if (pos == count) fill(); + if (pos == count) + return -1; // nothing left in buffer return buf[pos]; }
--- a/src/share/classes/javax/script/ScriptEngineManager.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/share/classes/javax/script/ScriptEngineManager.java Wed Mar 28 10:24:20 2012 -0400 @@ -39,7 +39,7 @@ * collection of key/value pairs storing state shared by all engines created * by the Manager. This class uses the <a href="../../../technotes/guides/jar/jar.html#Service%20Provider">service provider</a> mechanism to enumerate all the * implementations of <code>ScriptEngineFactory</code>. <br><br> - * The <code>ScriptEngineManager</code> provides a method to return an array of all these factories + * The <code>ScriptEngineManager</code> provides a method to return a list of all these factories * as well as utility methods which look up factories on the basis of language name, file extension * and mime type. * <p> @@ -202,7 +202,7 @@ * The algorithm first searches for a <code>ScriptEngineFactory</code> that has been * registered as a handler for the specified name using the <code>registerEngineName</code> * method. - * <br><br> If one is not found, it searches the array of <code>ScriptEngineFactory</code> instances + * <br><br> If one is not found, it searches the set of <code>ScriptEngineFactory</code> instances * stored by the constructor for one with the specified name. If a <code>ScriptEngineFactory</code> * is found by either method, it is used to create instance of <code>ScriptEngine</code>. * @param shortName The short name of the <code>ScriptEngine</code> implementation. @@ -351,7 +351,7 @@ } /** - * Returns an array whose elements are instances of all the <code>ScriptEngineFactory</code> classes + * Returns a list whose elements are instances of all the <code>ScriptEngineFactory</code> classes * found by the discovery mechanism. * @return List of all discovered <code>ScriptEngineFactory</code>s. */
--- a/src/share/classes/javax/swing/DefaultListSelectionModel.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/share/classes/javax/swing/DefaultListSelectionModel.java Wed Mar 28 10:24:20 2012 -0400 @@ -252,6 +252,10 @@ // 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 @@ 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); } }
--- a/src/share/classes/javax/swing/JViewport.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/share/classes/javax/swing/JViewport.java Wed Mar 28 10:24:20 2012 -0400 @@ -27,9 +27,7 @@ import java.awt.*; import java.awt.event.*; -import java.awt.image.VolatileImage; import java.awt.peer.ComponentPeer; -import java.applet.Applet; import java.beans.Transient; import javax.swing.plaf.ViewportUI; @@ -265,6 +263,14 @@ */ private boolean hasHadValidView; + /** + * When view is changed we have to synchronize scrollbar values + * with viewport (see the BasicScrollPaneUI#syncScrollPaneWithViewport method). + * This flag allows to invoke that method while ScrollPaneLayout#layoutContainer + * is running. + */ + private boolean viewChanged; + /** Creates a <code>JViewport</code>. */ public JViewport() { super(); @@ -830,7 +836,9 @@ backingStoreImage = null; } super.reshape(x, y, w, h); - if (sizeChanged) { + if (sizeChanged || viewChanged) { + viewChanged = false; + fireStateChanged(); } } @@ -967,6 +975,8 @@ hasHadValidView = true; } + viewChanged = true; + revalidate(); repaint(); }
--- a/src/share/classes/sun/java2d/loops/Blit.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/share/classes/sun/java2d/loops/Blit.java Wed Mar 28 10:24:20 2012 -0400 @@ -172,11 +172,11 @@ while (si.nextSpan(span)) { int w = span[2] - span[0]; int h = span[3] - span[1]; - srcRas = srcRas.createChild(srcx + span[0], srcy + span[1], - w, h, 0, 0, null); - dstRas = dstRas.createWritableChild(span[0], span[1], - w, h, 0, 0, null); - ctx.compose(srcRas, dstRas, dstRas); + Raster tmpSrcRas = srcRas.createChild(srcx + span[0], srcy + span[1], + w, h, 0, 0, null); + WritableRaster tmpDstRas = dstRas.createWritableChild(span[0], span[1], + w, h, 0, 0, null); + ctx.compose(tmpSrcRas, tmpDstRas, tmpDstRas); } ctx.dispose(); }
--- a/src/share/classes/sun/launcher/resources/launcher_de.properties Tue Mar 20 11:00:54 2012 -0400 +++ b/src/share/classes/sun/launcher/resources/launcher_de.properties Wed Mar 28 10:24:20 2012 -0400 @@ -34,13 +34,13 @@ java.launcher.ergo.message2 =\ weil die Ausf\u00FChrung auf einem Server-Class-Rechner erfolgt.\n # Translators please note do not translate the options themselves -java.launcher.opt.footer =\ -cp <Class-Suchpfad von Verzeichnissen und .zip-/.jar-Dateien>\n\\ -classpath <Class-Suchpfad von Verzeichnissen und .zip-/.jar-Dateien>\n\\ Eine durch {0} getrennte Liste mit Verzeichnissen, .jar-Archiven\n\\ und .zip-Archiven zur Suche nach Klassendateien.\n\\ -D<name>=<value>\n\\ Setzt eine Systemeigenschaft\n\\ -verbose[:class|gc|jni]\n\\ Aktiviert die Verbose-Ausgabe\n\\ -version Druckt Produktversion und beendet das Programm\n\\ -version:<value>\n\\ Erfordert die angegebene Version zur Ausf\u00FChrung\n\\ -showversion Druckt Produktversion und f\u00E4hrt fort\n\\ -jre-restrict-search | -no-jre-restrict-search\n\\ Bezieht private JREs des Benutzers in Versionssuche ein bzw. schlie\u00DFt sie aus\n\\ -? -help Druckt diese Hilfemeldung\n\\ -X Druckt Hilfe zu Nicht-Standardoptionen\n\\ -ea[:<packagename>...|:<classname>]\n\\ -enableassertions[:<packagename>...|:<classname>]\n\\ Aktiviert Assertionen mit angegebener Granularit\u00E4t\n\\ -da[:<packagename>...|:<classname>]\n\\ -disableassertions[:<packagename>...|:<classname>]\n\\ Deaktiviert Assertionen mit angegebener Granularit\u00E4t\n\\ -esa | -enablesystemassertions\n\\ Aktiviert Systemassertionen\n\\ -dsa | -disablesystemassertions\n\\ Deaktiviert Systemassertionen\n\\ -agentlib:<libname>[=<options>]\n\\ L\u00E4dt native Agent Library <libname>, z.B. -agentlib:hprof\n\\ siehe auch, -agentlib:jdwp=help und -agentlib:hprof=help\n\\ -agentpath:<pathname>[=<options>]\n\\ L\u00E4dt native Agent Library nach vollem Pfadnamen\n\\ -javaagent:<jarpath>[=<options>]\n\\ L\u00E4dt Java-Programmiersprachen-Agent, siehe java.lang.instrument\n\\ -splash:<imagepath>\n\\ Zeigt Startbildschirm mit angegebenem Bild\nWeitere Einzelheiten finden Sie unter http://www.oracle.com/technetwork/java/javase/documentation/index.html. +java.launcher.opt.footer =\ -cp <Class-Suchpfad von Verzeichnissen und .zip-/.jar-Dateien>\n\ -classpath <Class-Suchpfad von Verzeichnissen und .zip-/.jar-Dateien>\n\ Eine durch {0} getrennte Liste mit Verzeichnissen, .jar-Archiven\n\ und .zip-Archiven zur Suche nach Klassendateien.\n\ -D<name>=<value>\n\ Setzt eine Systemeigenschaft\n\ -verbose[:class|gc|jni]\n\ Aktiviert die Verbose-Ausgabe\n\ -version Druckt Produktversion und beendet das Programm\n\ -version:<value>\n\ Erfordert die angegebene Version zur Ausf\u00FChrung\n\ -showversion Druckt Produktversion und f\u00E4hrt fort\n\ -jre-restrict-search | -no-jre-restrict-search\n\ Bezieht private JREs des Benutzers in Versionssuche ein bzw. schlie\u00DFt sie aus\n\ -? -help Druckt diese Hilfemeldung\n\ -X Druckt Hilfe zu Nicht-Standardoptionen\n\ -ea[:<packagename>...|:<classname>]\n\ -enableassertions[:<packagename>...|:<classname>]\n\ Aktiviert Assertionen mit angegebener Granularit\u00E4t\n\ -da[:<packagename>...|:<classname>]\n\ -disableassertions[:<packagename>...|:<classname>]\n\ Deaktiviert Assertionen mit angegebener Granularit\u00E4t\n\ -esa | -enablesystemassertions\n\ Aktiviert Systemassertionen\n\ -dsa | -disablesystemassertions\n\ Deaktiviert Systemassertionen\n\ -agentlib:<libname>[=<options>]\n\ L\u00E4dt native Agent Library <libname>, z.B. -agentlib:hprof\n\ siehe auch, -agentlib:jdwp=help und -agentlib:hprof=help\n\ -agentpath:<pathname>[=<options>]\n\ L\u00E4dt native Agent Library nach vollem Pfadnamen\n\ -javaagent:<jarpath>[=<options>]\n\ L\u00E4dt Java-Programmiersprachen-Agent, siehe java.lang.instrument\n\ -splash:<imagepath>\n\ Zeigt Startbildschirm mit angegebenem Bild\nWeitere Einzelheiten finden Sie unter http://www.oracle.com/technetwork/java/javase/documentation/index.html. # Translators please note do not translate the options themselves java.launcher.X.usage=\ -Xmixed Ausf\u00FChrung im gemischten Modus (Standard)\n\ -Xint Nur Ausf\u00FChrung im interpretierten Modus\n\ -Xbootclasspath:<Verzeichnisse und ZIP-/JAR-Dateien durch {0} getrennt>\n\ Legt Suchpfad f\u00FCr Bootstrap-Klassen und Ressourcen fest\n\ -Xbootclasspath/a:<Verzeichnisse und ZIP-/JAR-Dateien durch {0} getrennt>\n\ H\u00E4ngt an das Ende des Bootstrap Classpath an\n\ -Xbootclasspath/p:<Verzeichnisse und ZIP-/JAR-Dateien durch {0} getrennt>\n\ Stellt Bootstrap Classpath voran\n\ -Xdiag Zeigt zus\u00E4tzliche Diagnosemeldungen an\n\ -Xnoclassgc Deaktiviert Klassen-Garbage Collection\n\ -Xincgc Aktiviert inkrementelle Garbage Collection\n\ -Xloggc:<file> Loggt GC-Status in einer Datei mit Zeitstempeln\n\ -Xbatch Deaktiviert Hintergrundkompilierung\n\ -Xms<size> Legt anf\u00E4ngliche Java Heap-Gr\u00F6\u00DFe fest\n\ -Xmx<size> Legt maximale Java Heap-Gr\u00F6\u00DFe fest\n\ -Xss<size> Legt Java-Thread-Stack-Gr\u00F6\u00DFe fest\n\ -Xprof Gibt CPU-Profiling-Daten aus\n\ -Xfuture Aktiviert strengste Pr\u00FCfungen, antizipiert zuk\u00FCnftigen Standardwert\n\ -Xrs Reduziert Verwendung von BS-Signalen durch Java/VM (siehe Dokumentation)\n\ -Xcheck:jni F\u00FChrt zus\u00E4tzliche Pr\u00FCfungen f\u00FCr JNI-Funktionen durch\n\ -Xshare:off Kein Versuch, gemeinsame Klassendaten zu verwenden\n\ -Xshare:auto Verwendet gemeinsame Klassendaten, wenn m\u00F6glich (Standard)\n\ -Xshare:on Erfordert die Verwendung gemeinsamer Klassendaten, sonst verl\u00E4uft der Vorgang nicht erfolgreich.\n\ -XshowSettings Zeigt alle Einstellungen und f\u00E4hrt fort\n\ -XshowSettings:all\n\ Zeigt alle Einstellungen und f\u00E4hrt fort\n\ -XshowSettings:vm Zeigt alle VM-bezogenen Einstellungen und f\u00E4hrt fort\n\ -XshowSettings:properties\n\ Zeigt alle Eigenschaftseinstellungen und f\u00E4hrt fort\n\ -XshowSettings:locale\n\ Zeigt alle gebietsschemabezogenen Einstellungen und f\u00E4hrt fort\n\nDie -X-Optionen sind keine Standardoptionen und k\u00F6nnen ohne Vorank\u00FCndigung ge\u00E4ndert werden.\n # Translators please note do not translate the options themselves -java.launcher.X.macosx.usage=\nDie folgenden Optionen sind f\u00FCr Mac OS X spezifisch:\n\\ -XstartOnFirstThread\n\\ f\u00FChrt die main()-Methode f\u00FCr den ersten (AppKit) Thread aus\n\\ -Xdock:name=<Anwendungsname>"\n\\ \u00DCberschreibt den in der Uhr angezeigten Standardanwendungsnamen\n\\ -Xdock:icon=<Pfad zu Symboldatei>\n\\ \u00DCberschreibt das in der Uhr angezeigte Standardsymbol\n\n +java.launcher.X.macosx.usage=\nDie folgenden Optionen sind f\u00FCr Mac OS X spezifisch:\n\ -XstartOnFirstThread\n\ f\u00FChrt die main()-Methode f\u00FCr den ersten (AppKit) Thread aus\n\ -Xdock:name=<Anwendungsname>"\n\ \u00DCberschreibt den in der Uhr angezeigten Standardanwendungsnamen\n\ -Xdock:icon=<Pfad zu Symboldatei>\n\ \u00DCberschreibt das in der Uhr angezeigte Standardsymbol\n\n java.launcher.cls.error1=Fehler: Hauptklasse {0} konnte nicht gefunden oder geladen werden java.launcher.cls.error2=Fehler: Hauptmethode ist nicht {0} in Klasse {1}. Definieren Sie die Hauptmethode als:\n\ public static void main(String[] args)
--- a/src/share/classes/sun/launcher/resources/launcher_es.properties Tue Mar 20 11:00:54 2012 -0400 +++ b/src/share/classes/sun/launcher/resources/launcher_es.properties Wed Mar 28 10:24:20 2012 -0400 @@ -34,13 +34,13 @@ java.launcher.ergo.message2 =\ porque la ejecuci\u00F3n se est\u00E1 llevando a cabo en una m\u00E1quina de clase de servidor.\n # Translators please note do not translate the options themselves -java.launcher.opt.footer =\ -cp <ruta de acceso de b\u00FAsqueda de clases de los directorios y los archivos zip/jar>\n\\ -classpath <ruta de acceso de b\u00FAsqueda de clases de los directorios y los archivos zip/jar>\n\\ Lista separada por {0} de directorios, archivos JAR\n\\ y archivos ZIP para buscar archivos de clase.\n\\ -D<nombre>=<valor>\n\\ definir una propiedad del sistema\n\\ -verbose[:class|gc|jni]\n\\ activar la salida verbose\n\\ -version imprimir la versi\u00F3n del producto y salir\n\\ -version:<valor>\n\\ es necesario que se ejecute la versi\u00F3n especificada\n\\ -showversion imprimir la versi\u00F3n del producto y continuar\n\\ -jre-restrict-search | -no-jre-restrict-search\n\\ incluir/excluir JRE privados de usuario en la b\u00FAsqueda de versi\u00F3n\n\\ -? -help imprimir este mensaje de ayuda\n\\ -X imprimir la ayuda sobre las opciones que no sean est\u00E1ndar\n\\ -ea[:<nombre_paquete>...|:<nombre_clase>]\n\\ -enableassertions[:<nombre_paquete>...|:<nombre_clase>]\n\\ activar afirmaciones con la granularidad especificada\n\\ -da[:<nombre_paquete>...|:<nombre_clase>]\n\\ -disableassertions[:<nombre_paquete>...|:<nombre_clase>]\n\\ desactivar afirmaciones con la granularidad especificada\n\\ -esa | -enablesystemassertions\n\\ activar afirmaciones del sistema\n\\ -dsa | -disablesystemassertions\n\\ desactivar afirmaciones del sistema\n\\ -agentlib:<nombre_bib>[=<opciones>]\n\\ cargar la biblioteca de agente nativa <nombre_bib>, como -agentlib:hprof\n\\ v\u00E9ase tambi\u00E9n -agentlib:jdwp=help y -agentlib:hprof=help\n\\ -agentpath:<nombre_ruta_acceso>[=<opciones>]\n\\ cargar biblioteca de agente nativa con el nombre de la ruta de acceso completa\n\\ -javaagent:<ruta_acceso_jar>[=<opciones>]\n\\ cargar agente de lenguaje de programaci\u00F3n Java, v\u00E9ase java.lang.instrument\n\\ -splash:<ruta_acceso_imagen>\n\\ mostrar una pantalla de presentaci\u00F3n con la imagen especificada\nConsulte http://www.oracle.com/technetwork/java/javase/documentation/index.html para obtener m\u00E1s informaci\u00F3n. +java.launcher.opt.footer =\ -cp <ruta de acceso de b\u00FAsqueda de clases de los directorios y los archivos zip/jar>\n\ -classpath <ruta de acceso de b\u00FAsqueda de clases de los directorios y los archivos zip/jar>\n\ Lista separada por {0} de directorios, archivos JAR\n\ y archivos ZIP para buscar archivos de clase.\n\ -D<nombre>=<valor>\n\ definir una propiedad del sistema\n\ -verbose[:class|gc|jni]\n\ activar la salida verbose\n\ -version imprimir la versi\u00F3n del producto y salir\n\ -version:<valor>\n\ es necesario que se ejecute la versi\u00F3n especificada\n\ -showversion imprimir la versi\u00F3n del producto y continuar\n\ -jre-restrict-search | -no-jre-restrict-search\n\ incluir/excluir JRE privados de usuario en la b\u00FAsqueda de versi\u00F3n\n\ -? -help imprimir este mensaje de ayuda\n\ -X imprimir la ayuda sobre las opciones que no sean est\u00E1ndar\n\ -ea[:<nombre_paquete>...|:<nombre_clase>]\n\ -enableassertions[:<nombre_paquete>...|:<nombre_clase>]\n\ activar afirmaciones con la granularidad especificada\n\ -da[:<nombre_paquete>...|:<nombre_clase>]\n\ -disableassertions[:<nombre_paquete>...|:<nombre_clase>]\n\ desactivar afirmaciones con la granularidad especificada\n\ -esa | -enablesystemassertions\n\ activar afirmaciones del sistema\n\ -dsa | -disablesystemassertions\n\ desactivar afirmaciones del sistema\n\ -agentlib:<nombre_bib>[=<opciones>]\n\ cargar la biblioteca de agente nativa <nombre_bib>, como -agentlib:hprof\n\ v\u00E9ase tambi\u00E9n -agentlib:jdwp=help y -agentlib:hprof=help\n\ -agentpath:<nombre_ruta_acceso>[=<opciones>]\n\ cargar biblioteca de agente nativa con el nombre de la ruta de acceso completa\n\ -javaagent:<ruta_acceso_jar>[=<opciones>]\n\ cargar agente de lenguaje de programaci\u00F3n Java, v\u00E9ase java.lang.instrument\n\ -splash:<ruta_acceso_imagen>\n\ mostrar una pantalla de presentaci\u00F3n con la imagen especificada\nConsulte http://www.oracle.com/technetwork/java/javase/documentation/index.html para obtener m\u00E1s informaci\u00F3n. # Translators please note do not translate the options themselves java.launcher.X.usage=\ -Xmixed ejecuci\u00F3n de modo mixto (por defecto)\n\ -Xint s\u00F3lo ejecuci\u00F3n de modo interpretado\n\ -Xbootclasspath:<directorios y archivos zip/jar separados por {0}>\n\ definir la ruta de acceso de b\u00FAsqueda para los recursos y clases de inicializaci\u00F3n de datos\n\ -Xbootclasspath/a:<directorios y archivos zip/jar separados por {0}>\n\ agregar al final de la ruta de acceso de la clase de inicializaci\u00F3n de datos\n\ -Xbootclasspath/p:<directorios y archivos zip/jar separados por {0}>\n\ anteponer a la ruta de acceso de la clase de inicializaci\u00F3n de datos\n\ -Xdiag mostrar mensajes de diagn\u00F3stico adicionales\n\ -Xnoclassgc desactivar la recolecci\u00F3n de basura de clases\n\ -Xincgc activar la recolecci\u00F3n de basura de clases\n\ -Xloggc:<archivo> registrar el estado de GC en un archivo con registros de hora\n\ -Xbatch desactivar compilaci\u00F3n en segundo plano\n\ -Xms<tama\u00F1o> definir tama\u00F1o de pila Java inicial\n\ -Xmx<tama\u00F1o> definir tama\u00F1o de pila Java m\u00E1ximo\n\ -Xss<tama\u00F1o> definir tama\u00F1o de la pila del thread de Java\n\ -Xprof datos de salida de creaci\u00F3n de perfil de CPU\n\ -Xfuture activar las comprobaciones m\u00E1s estrictas, anticip\u00E1ndose al futuro valor por defecto\n\ -Xrs reducir el uso de se\u00F1ales de sistema operativo por parte de Java/VM (consulte la documentaci\u00F3n)\n\ -Xcheck:jni realizar comprobaciones adicionales para las funciones de JNI\n\ -Xshare:off no intentar usar datos de clase compartidos\n\ -Xshare:auto usar datos de clase compartidos si es posible (valor por defecto)\n\ -Xshare:on es obligatorio el uso de datos de clase compartidos, de lo contrario se emitir\u00E1 un fallo.\n\ -XshowSettings mostrar todos los valores y continuar\n\ -XshowSettings:all\n\ mostrar todos los valores y continuar\n\ -XshowSettings:vm mostrar todos los valores de la VM y continuar\n\ -XshowSettings:properties\n\ mostrar todos los valores de las propiedades y continuar\n\ -XshowSettings:locale\n\ mostrar todos los valores relacionados con la configuraci\u00F3n regional y continuar\n\nLas opciones -X no son est\u00E1ndar, por lo que podr\u00EDan cambiarse sin previo aviso.\n # Translators please note do not translate the options themselves -java.launcher.X.macosx.usage=\nLas siguientes opciones son espec\u00EDficas para Mac OS X:\n\\ -XstartOnFirstThread\n\\ ejecuta el m\u00E9todo main() del primer thread (AppKit)\n\\ -Xdock:name=<nombre de aplicaci\u00F3n>"\n\\ sustituye al nombre por defecto de la aplicaci\u00F3n que se muestra en el Dock\n\\ -Xdock:icon=<ruta de acceso a archivo de icono>\n\\ sustituye al icono por defecto que se muestra en el Dock\n\n +java.launcher.X.macosx.usage=\nLas siguientes opciones son espec\u00EDficas para Mac OS X:\n\ -XstartOnFirstThread\n\ ejecuta el m\u00E9todo main() del primer thread (AppKit)\n\ -Xdock:name=<nombre de aplicaci\u00F3n>"\n\ sustituye al nombre por defecto de la aplicaci\u00F3n que se muestra en el Dock\n\ -Xdock:icon=<ruta de acceso a archivo de icono>\n\ sustituye al icono por defecto que se muestra en el Dock\n\n java.launcher.cls.error1=Error: no se ha encontrado o cargado la clase principal {0} java.launcher.cls.error2=Error: el m\u00E9todo principal no es {0} en la clase {1}, defina el m\u00E9todo principal del siguiente modo:\n\ public static void main(String[] args)
--- a/src/share/classes/sun/launcher/resources/launcher_it.properties Tue Mar 20 11:00:54 2012 -0400 +++ b/src/share/classes/sun/launcher/resources/launcher_it.properties Wed Mar 28 10:24:20 2012 -0400 @@ -34,13 +34,13 @@ java.launcher.ergo.message2 =\ perch\u00E9 si utilizza un computer di classe server.\n # Translators please note do not translate the options themselves -java.launcher.opt.footer =\ -cp <classpath di ricerca di directory e file zip/jar>\n\\ -classpath <classpath di ricerca di directory e file zip/jar>\n\\ Una lista separata da {0} di directory, archivi JAR\n\\ e archivi ZIP utilizzata per la ricerca di file di classe.\n\\ -D<nome>=<valore>\n\\ imposta una propriet\u00E0 di sistema\n\\ -verbose[:class|gc|jni]\n\\ abilita l''output descrittivo\n\\ -version stampa la versione del prodotto ed esce\n\\ -version:<valore>\n\\ richiede l''esecuzione della versione specificata\n\\ -showversion stampa la versione del prodotto e continua\n\\ -jre-restrict-search | -no-jre-restrict-search\n\\ include/esclude gli ambienti JRE privati dell''utente nella ricerca della versione\n\\ -? -help stampa questo messaggio della Guida\n\\ -X stampa la Guida sulle opzioni non standard\n\\ -ea[:<nomepackage>...|:<nomeclasse>]\n\\ -enableassertions[:<nomepackage>...|:<nomeclasse>]\n\\ abilita le asserzioni con la granularit\u00E0 specificata\n\\ -da[:<nomepackage>...|:<nomeclasse>]\n\\ -disableassertions[:<nomepackage>...|:<nomeclasse>]\n\\ disabilita le asserzioni con la granularit\u00E0 specificata\n\\ -esa | -enablesystemassertions\n\\ abilita le asserzioni di sistema\n\\ -dsa | -disablesystemassertions\n\\ disabilita le asserzioni di sistema\n\\ -agentlib:<nomelib>[=<opzioni>]\n\\ carica la libreria agenti nativa <nomelib>, ad esempio -agentlib:hprof\n\\ vedere anche -agentlib:jdwp=help and -agentlib:hprof=help\n\\ -agentpath:<nomepercorso>[=<opzioni>]\n\\ carica la libreria agenti nativa con il percorso completo\n\\ -javaagent:<percorsojar>[=<opzioni>]\n\\ carica l''agente del linguaggio di programmazione Java. Vedere java.lang.instrument\n\\ -splash:<percorsoimmagine>\n\\ mostra la schermata iniziale con l''immagine specificata\nVedere http://www.oracle.com/technetwork/java/javase/documentation/index.html per ulteriori dettagli. +java.launcher.opt.footer =\ -cp <classpath di ricerca di directory e file zip/jar>\n\ -classpath <classpath di ricerca di directory e file zip/jar>\n\ Una lista separata da {0} di directory, archivi JAR\n\ e archivi ZIP utilizzata per la ricerca di file di classe.\n\ -D<nome>=<valore>\n\ imposta una propriet\u00E0 di sistema\n\ -verbose[:class|gc|jni]\n\ abilita l''output descrittivo\n\ -version stampa la versione del prodotto ed esce\n\ -version:<valore>\n\ richiede l''esecuzione della versione specificata\n\ -showversion stampa la versione del prodotto e continua\n\ -jre-restrict-search | -no-jre-restrict-search\n\ include/esclude gli ambienti JRE privati dell''utente nella ricerca della versione\n\ -? -help stampa questo messaggio della Guida\n\ -X stampa la Guida sulle opzioni non standard\n\ -ea[:<nomepackage>...|:<nomeclasse>]\n\ -enableassertions[:<nomepackage>...|:<nomeclasse>]\n\ abilita le asserzioni con la granularit\u00E0 specificata\n\ -da[:<nomepackage>...|:<nomeclasse>]\n\ -disableassertions[:<nomepackage>...|:<nomeclasse>]\n\ disabilita le asserzioni con la granularit\u00E0 specificata\n\ -esa | -enablesystemassertions\n\ abilita le asserzioni di sistema\n\ -dsa | -disablesystemassertions\n\ disabilita le asserzioni di sistema\n\ -agentlib:<nomelib>[=<opzioni>]\n\ carica la libreria agenti nativa <nomelib>, ad esempio -agentlib:hprof\n\ vedere anche -agentlib:jdwp=help and -agentlib:hprof=help\n\ -agentpath:<nomepercorso>[=<opzioni>]\n\ carica la libreria agenti nativa con il percorso completo\n\ -javaagent:<percorsojar>[=<opzioni>]\n\ carica l''agente del linguaggio di programmazione Java. Vedere java.lang.instrument\n\ -splash:<percorsoimmagine>\n\ mostra la schermata iniziale con l''immagine specificata\nVedere http://www.oracle.com/technetwork/java/javase/documentation/index.html per ulteriori dettagli. # Translators please note do not translate the options themselves java.launcher.X.usage=\ -Xmixed esecuzione in modalit\u00E0 mista (impostazione predefinita)\n\ -Xint esecuzione solo in modalit\u00E0 convertita\n\ -Xbootclasspath:<directory e file zip/jar separati da {0}>\n\ imposta il percorso di ricerca per le classi e le risorse di bootstrap\n\ -Xbootclasspath/a:<directory e file zip/jar separati da {0}>\n\ aggiunge alla fine del classpath di bootstrap\n\ -Xbootclasspath/p:<directory e file zip/jar separati da {0}>\n\ antepone al classpath di bootstrap\n\ -Xdiag mostra messaggi di diagnostica aggiuntivi\n\ -Xnoclassgc disabilita la garbage collection della classe\n\ -Xincgc abilita la garbage collection incrementale\n\ -Xloggc:<file> registra lo stato GC in un file di log con indicatori orari\n\ -Xbatch disabilita la compilazione in background\n\ -Xms<dimensione> imposta la dimensione heap Java iniziale\n\ -Xmx<dimensione> imposta la dimensione heap Java massima\n\ -Xss<dimensione> imposta la dimensione dello stack di thread Java\n\ -Xprof visualizza i dati di profilo della CPU\n\ -Xfuture abilita i controlli pi\u00F9 limitativi anticipando le impostazioni predefinite future\n\ -Xrs riduce l''uso di segnali del sistema operativo da Java/VM (vedere la documentazione)\n\ -Xcheck:jni esegue controlli aggiuntivi per le funzioni JNI\n\ -Xshare:off non tenta di utilizzare i dati della classe condivisi\n\ -Xshare:auto utilizza i dati di classe condivisi se possibile (impostazione predefinita)\n\ -Xshare:on richiede l''uso dei dati di classe condivisi, altrimenti l''esecuzione non riesce.\n\ -XshowSettings mostra tutte le impostazioni e continua\n\ -XshowSettings:all\n\ mostra tutte le impostazioni e continua\n\ -XshowSettings:vm mostra tutte le impostazioni correlate alla VM e continua\n\ -XshowSettings:properties\n\ mostra tutte le impostazioni delle propriet\u00E0 e continua\n\ -XshowSettings:locale\n\ mostra tutte le impostazioni correlate alle impostazioni nazionali e continua\n\nLe opzioni -X non sono opzioni standard e sono soggette a modifiche senza preavviso.\n # Translators please note do not translate the options themselves -java.launcher.X.macosx.usage=\nLe opzioni riportate di seguito sono specifiche del sistema operativo Mac OS X:\n\\ -XstartOnFirstThread\n\\ Esegue il metodo main() sul primo thread (AppKit).\n\\ -Xdock:name=<nome applicazione>"\n\\ Sostituisce il nome applicazione predefinito visualizzato nel dock\n\\ -Xdock:icon=<percorso file icona>\n\\ Sostituisce l'icona predefinita visualizzata nel dock\n\n +java.launcher.X.macosx.usage=\nLe opzioni riportate di seguito sono specifiche del sistema operativo Mac OS X:\n\ -XstartOnFirstThread\n\ Esegue il metodo main() sul primo thread (AppKit).\n\ -Xdock:name=<nome applicazione>"\n\ Sostituisce il nome applicazione predefinito visualizzato nel dock\n\ -Xdock:icon=<percorso file icona>\n\ Sostituisce l'icona predefinita visualizzata nel dock\n\n java.launcher.cls.error1=Errore: impossibile trovare o caricare la classe principale {0} java.launcher.cls.error2=Errore: il metodo principale non \u00E8 {0} nella classe {1}. Definire il metodo principale come:\n\ public static void main(String[] args)
--- a/src/share/classes/sun/launcher/resources/launcher_ko.properties Tue Mar 20 11:00:54 2012 -0400 +++ b/src/share/classes/sun/launcher/resources/launcher_ko.properties Wed Mar 28 10:24:20 2012 -0400 @@ -34,13 +34,13 @@ java.launcher.ergo.message2 =\ \uC11C\uBC84\uAE09 \uC2DC\uC2A4\uD15C\uC5D0\uC11C \uC2E4\uD589 \uC911\uC774\uAE30 \uB54C\uBB38\uC785\uB2C8\uB2E4.\n # Translators please note do not translate the options themselves -java.launcher.opt.footer =\ -cp <class search path of directories and zip/jar files>\n\\ -classpath <class search path of directories and zip/jar files>\n\\ \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uAC80\uC0C9\uD560 {0}(\uC73C)\uB85C \uAD6C\uBD84\uB41C \uB514\uB809\uD1A0\uB9AC,\n\\ JAR \uC544\uCE74\uC774\uBE0C \uBC0F ZIP \uC544\uCE74\uC774\uBE0C \uBAA9\uB85D\uC785\uB2C8\uB2E4.\n\\ -D<name>=<value>\n\\ \uC2DC\uC2A4\uD15C \uC18D\uC131\uC744 \uC124\uC815\uD569\uB2C8\uB2E4.\n\\ -verbose[:class|gc|jni]\n\\ \uC0C1\uC138 \uC815\uBCF4 \uCD9C\uB825\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\\ -version \uC81C\uD488 \uBC84\uC804\uC744 \uC778\uC1C4\uD55C \uD6C4 \uC885\uB8CC\uD569\uB2C8\uB2E4.\n\\ -version:<value>\n\\ \uC2E4\uD589\uD560 \uBC84\uC804\uC744 \uC9C0\uC815\uD574\uC57C \uD569\uB2C8\uB2E4.\n\\ -showversion \uC81C\uD488 \uBC84\uC804\uC744 \uC778\uC1C4\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n\\ -jre-restrict-search | -no-jre-restrict-search\n\\ \uBC84\uC804 \uAC80\uC0C9\uC5D0\uC11C \uC0AC\uC6A9\uC790 \uC804\uC6A9 JRE\uB97C \uD3EC\uD568/\uC81C\uC678\uD569\uB2C8\uB2E4.\n\\ -? -help \uC774 \uB3C4\uC6C0\uB9D0 \uBA54\uC2DC\uC9C0\uB97C \uC778\uC1C4\uD569\uB2C8\uB2E4.\n\\ -X \uBE44\uD45C\uC900 \uC635\uC158\uC5D0 \uB300\uD55C \uB3C4\uC6C0\uB9D0\uC744 \uC778\uC1C4\uD569\uB2C8\uB2E4.\n\\ -ea[:<packagename>...|:<classname>]\n\\ -enableassertions[:<packagename>...|:<classname>]\n\\ \uC138\uBD84\uC131\uC774 \uC9C0\uC815\uB41C \uAC80\uC99D\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\\ -da[:<packagename>...|:<classname>]\n\\ -disableassertions[:<packagename>...|:<classname>]\n\\ \uC138\uBD84\uC131\uC774 \uC9C0\uC815\uB41C \uAC80\uC99D\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\\ -esa | -enablesystemassertions\n\\ \uC2DC\uC2A4\uD15C \uAC80\uC99D\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\\ -dsa | -disablesystemassertions\n\\ \uC2DC\uC2A4\uD15C \uAC80\uC99D\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\\ -agentlib:<libname>[=<options>]\n\\ <libname> \uACE0\uC720 \uC5D0\uC774\uC804\uD2B8 \uB77C\uC774\uBE0C\uB7EC\uB9AC\uB97C \uB85C\uB4DC\uD569\uB2C8\uB2E4(\uC608: -agentlib:hprof).\n\\ -agentlib:jdwp=help \uBC0F -agentlib:hprof=help\uB3C4 \uCC38\uC870\uD558\uC2ED\uC2DC\uC624.\n\\ -agentpath:<pathname>[=<options>]\n\\ \uC804\uCCB4 \uACBD\uB85C\uBA85\uC744 \uC0AC\uC6A9\uD558\uC5EC \uACE0\uC720 \uC5D0\uC774\uC804\uD2B8 \uB77C\uC774\uBE0C\uB7EC\uB9AC\uB97C \uB85C\uB4DC\uD569\uB2C8\uB2E4.\n\\ -javaagent:<jarpath>[=<options>]\n\\ Java \uD504\uB85C\uADF8\uB798\uBC0D \uC5B8\uC5B4 \uC5D0\uC774\uC804\uD2B8\uB97C \uB85C\uB4DC\uD569\uB2C8\uB2E4. java.lang.instrument\uB97C \uCC38\uC870\uD558\uC2ED\uC2DC\uC624.\n\\ -splash:<imagepath>\n\\ \uC774\uBBF8\uC9C0\uAC00 \uC9C0\uC815\uB41C \uC2A4\uD50C\uB798\uC2DC \uD654\uBA74\uC744 \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\uC790\uC138\uD55C \uB0B4\uC6A9\uC740 http://www.oracle.com/technetwork/java/javase/documentation/index.html\uC744 \uCC38\uC870\uD558\uC2ED\uC2DC\uC624. +java.launcher.opt.footer =\ -cp <class search path of directories and zip/jar files>\n\ -classpath <class search path of directories and zip/jar files>\n\ \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uAC80\uC0C9\uD560 {0}(\uC73C)\uB85C \uAD6C\uBD84\uB41C \uB514\uB809\uD1A0\uB9AC,\n\ JAR \uC544\uCE74\uC774\uBE0C \uBC0F ZIP \uC544\uCE74\uC774\uBE0C \uBAA9\uB85D\uC785\uB2C8\uB2E4.\n\ -D<name>=<value>\n\ \uC2DC\uC2A4\uD15C \uC18D\uC131\uC744 \uC124\uC815\uD569\uB2C8\uB2E4.\n\ -verbose[:class|gc|jni]\n\ \uC0C1\uC138 \uC815\uBCF4 \uCD9C\uB825\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\ -version \uC81C\uD488 \uBC84\uC804\uC744 \uC778\uC1C4\uD55C \uD6C4 \uC885\uB8CC\uD569\uB2C8\uB2E4.\n\ -version:<value>\n\ \uC2E4\uD589\uD560 \uBC84\uC804\uC744 \uC9C0\uC815\uD574\uC57C \uD569\uB2C8\uB2E4.\n\ -showversion \uC81C\uD488 \uBC84\uC804\uC744 \uC778\uC1C4\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n\ -jre-restrict-search | -no-jre-restrict-search\n\ \uBC84\uC804 \uAC80\uC0C9\uC5D0\uC11C \uC0AC\uC6A9\uC790 \uC804\uC6A9 JRE\uB97C \uD3EC\uD568/\uC81C\uC678\uD569\uB2C8\uB2E4.\n\ -? -help \uC774 \uB3C4\uC6C0\uB9D0 \uBA54\uC2DC\uC9C0\uB97C \uC778\uC1C4\uD569\uB2C8\uB2E4.\n\ -X \uBE44\uD45C\uC900 \uC635\uC158\uC5D0 \uB300\uD55C \uB3C4\uC6C0\uB9D0\uC744 \uC778\uC1C4\uD569\uB2C8\uB2E4.\n\ -ea[:<packagename>...|:<classname>]\n\ -enableassertions[:<packagename>...|:<classname>]\n\ \uC138\uBD84\uC131\uC774 \uC9C0\uC815\uB41C \uAC80\uC99D\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\ -da[:<packagename>...|:<classname>]\n\ -disableassertions[:<packagename>...|:<classname>]\n\ \uC138\uBD84\uC131\uC774 \uC9C0\uC815\uB41C \uAC80\uC99D\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\ -esa | -enablesystemassertions\n\ \uC2DC\uC2A4\uD15C \uAC80\uC99D\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\ -dsa | -disablesystemassertions\n\ \uC2DC\uC2A4\uD15C \uAC80\uC99D\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\ -agentlib:<libname>[=<options>]\n\ <libname> \uACE0\uC720 \uC5D0\uC774\uC804\uD2B8 \uB77C\uC774\uBE0C\uB7EC\uB9AC\uB97C \uB85C\uB4DC\uD569\uB2C8\uB2E4(\uC608: -agentlib:hprof).\n\ -agentlib:jdwp=help \uBC0F -agentlib:hprof=help\uB3C4 \uCC38\uC870\uD558\uC2ED\uC2DC\uC624.\n\ -agentpath:<pathname>[=<options>]\n\ \uC804\uCCB4 \uACBD\uB85C\uBA85\uC744 \uC0AC\uC6A9\uD558\uC5EC \uACE0\uC720 \uC5D0\uC774\uC804\uD2B8 \uB77C\uC774\uBE0C\uB7EC\uB9AC\uB97C \uB85C\uB4DC\uD569\uB2C8\uB2E4.\n\ -javaagent:<jarpath>[=<options>]\n\ Java \uD504\uB85C\uADF8\uB798\uBC0D \uC5B8\uC5B4 \uC5D0\uC774\uC804\uD2B8\uB97C \uB85C\uB4DC\uD569\uB2C8\uB2E4. java.lang.instrument\uB97C \uCC38\uC870\uD558\uC2ED\uC2DC\uC624.\n\ -splash:<imagepath>\n\ \uC774\uBBF8\uC9C0\uAC00 \uC9C0\uC815\uB41C \uC2A4\uD50C\uB798\uC2DC \uD654\uBA74\uC744 \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\uC790\uC138\uD55C \uB0B4\uC6A9\uC740 http://www.oracle.com/technetwork/java/javase/documentation/index.html\uC744 \uCC38\uC870\uD558\uC2ED\uC2DC\uC624. # Translators please note do not translate the options themselves java.launcher.X.usage=\ -Xmixed \uD63C\uD569 \uBAA8\uB4DC\uB97C \uC2E4\uD589\uD569\uB2C8\uB2E4(\uAE30\uBCF8\uAC12).\n\ -Xint \uD574\uC11D\uB41C \uBAA8\uB4DC\uB9CC \uC2E4\uD589\uD569\uB2C8\uB2E4.\n\ -Xbootclasspath:<directories and zip/jar files separated by {0}>\n\ \uBD80\uD2B8\uC2A4\uD2B8\uB7A9 \uD074\uB798\uC2A4 \uBC0F \uB9AC\uC18C\uC2A4\uC5D0 \uB300\uD55C \uAC80\uC0C9 \uACBD\uB85C\uB97C \uC124\uC815\uD569\uB2C8\uB2E4.\n\ -Xbootclasspath/a:<directories and zip/jar files separated by {0}>\n\ \uBD80\uD2B8\uC2A4\uD2B8\uB7A9 \uD074\uB798\uC2A4 \uACBD\uB85C \uB05D\uC5D0 \uCD94\uAC00\uD569\uB2C8\uB2E4.\n\ -Xbootclasspath/p:<directories and zip/jar files separated by {0}>\n\ \uBD80\uD2B8\uC2A4\uD2B8\uB7A9 \uD074\uB798\uC2A4 \uACBD\uB85C \uC55E\uC5D0 \uCD94\uAC00\uD569\uB2C8\uB2E4.\n\ -Xdiag \uCD94\uAC00 \uC9C4\uB2E8 \uBA54\uC2DC\uC9C0\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\ -Xnoclassgc \uD074\uB798\uC2A4\uC758 \uBD88\uD544\uC694\uD55C \uC815\uBCF4 \uBAA8\uC74C\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\ -Xincgc \uC99D\uBD84\uC801\uC778 \uBD88\uD544\uC694\uD55C \uC815\uBCF4 \uBAA8\uC74C\uC744 \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\ -Xloggc:<file> \uC2DC\uAC04 \uAE30\uB85D\uACFC \uD568\uAED8 \uD30C\uC77C\uC5D0 GC \uC0C1\uD0DC\uB97C \uAE30\uB85D\uD569\uB2C8\uB2E4.\n\ -Xbatch \uBC31\uADF8\uB77C\uC6B4\uB4DC \uCEF4\uD30C\uC77C\uC744 \uC0AC\uC6A9 \uC548\uD568\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\ -Xms<size> \uCD08\uAE30 Java \uD799 \uD06C\uAE30\uB97C \uC124\uC815\uD569\uB2C8\uB2E4.\n\ -Xmx<size> \uCD5C\uB300 Java \uD799 \uD06C\uAE30\uB97C \uC124\uC815\uD569\uB2C8\uB2E4.\n\ -Xss<size> Java \uC2A4\uB808\uB4DC \uC2A4\uD0DD \uD06C\uAE30\uB97C \uC124\uC815\uD569\uB2C8\uB2E4.\n\ -Xprof CPU \uD504\uB85C\uD30C\uC77C \uC791\uC131 \uB370\uC774\uD130\uB97C \uCD9C\uB825\uD569\uB2C8\uB2E4.\n\ -Xfuture \uBBF8\uB798 \uAE30\uBCF8\uAC12\uC744 \uC608\uCE21\uD558\uC5EC \uAC00\uC7A5 \uC5C4\uACA9\uD55C \uAC80\uC0AC\uB97C \uC0AC\uC6A9\uC73C\uB85C \uC124\uC815\uD569\uB2C8\uB2E4.\n\ -Xrs Java/VM\uC5D0 \uC758\uD55C OS \uC2E0\uD638 \uC0AC\uC6A9\uC744 \uC904\uC785\uB2C8\uB2E4(\uC124\uBA85\uC11C \uCC38\uC870).\n\ -Xcheck:jni JNI \uD568\uC218\uC5D0 \uB300\uD55C \uCD94\uAC00 \uAC80\uC0AC\uB97C \uC218\uD589\uD569\uB2C8\uB2E4.\n\ -Xshare:off \uACF5\uC720 \uD074\uB798\uC2A4 \uB370\uC774\uD130 \uC0AC\uC6A9\uC744 \uC2DC\uB3C4\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.\n\ -Xshare:auto \uAC00\uB2A5\uD55C \uACBD\uC6B0 \uACF5\uC720 \uD074\uB798\uC2A4 \uB370\uC774\uD130\uB97C \uC0AC\uC6A9\uD569\uB2C8\uB2E4(\uAE30\uBCF8\uAC12).\n\ -Xshare:on \uACF5\uC720 \uD074\uB798\uC2A4 \uB370\uC774\uD130\uB97C \uC0AC\uC6A9\uD574\uC57C \uD569\uB2C8\uB2E4. \uADF8\uB807\uC9C0 \uC54A\uC744 \uACBD\uC6B0 \uC2E4\uD328\uD569\uB2C8\uB2E4.\n\ -XshowSettings \uBAA8\uB4E0 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n\ -XshowSettings:all\n\ \uBAA8\uB4E0 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n\ -XshowSettings:vm \uBAA8\uB4E0 VM \uAD00\uB828 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n\ -XshowSettings:properties\n\ \uBAA8\uB4E0 \uC18D\uC131 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n\ -XshowSettings:locale\n\ \uBAA8\uB4E0 \uB85C\uCF00\uC77C \uAD00\uB828 \uC124\uC815\uC744 \uD45C\uC2DC\uD55C \uD6C4 \uACC4\uC18D\uD569\uB2C8\uB2E4.\n\n-X \uC635\uC158\uC740 \uBE44\uD45C\uC900 \uC635\uC158\uC774\uBBC0\uB85C \uD1B5\uC9C0 \uC5C6\uC774 \uBCC0\uACBD\uB420 \uC218 \uC788\uC2B5\uB2C8\uB2E4.\n # Translators please note do not translate the options themselves -java.launcher.X.macosx.usage=\n\uB2E4\uC74C\uC740 Mac OS X\uC5D0 \uD2B9\uC815\uB41C \uC635\uC158\uC785\uB2C8\uB2E4.\n\\ -XstartOnFirstThread\n\\ \uCCAB\uBC88\uC9F8 (AppKit) \uC2A4\uB808\uB4DC\uC5D0 main() \uBA54\uC18C\uB4DC\uB97C \uC2E4\uD589\uD569\uB2C8\uB2E4.\n\\ -Xdock:name=<application name>"\n\\ \uACE0\uC815\uC73C\uB85C \uD45C\uC2DC\uB41C \uAE30\uBCF8 \uC751\uC6A9 \uD504\uB85C\uADF8\uB7A8 \uC774\uB984\uC744 \uBB34\uD6A8\uD654\uD569\uB2C8\uB2E4.\n\\ -Xdock:icon=<path to icon file>\n\\ \uACE0\uC815\uC73C\uB85C \uD45C\uC2DC\uB41C \uAE30\uBCF8 \uC544\uC774\uCF58\uC744 \uBB34\uD6A8\uD654\uD569\uB2C8\uB2E4.\n\n +java.launcher.X.macosx.usage=\n\uB2E4\uC74C\uC740 Mac OS X\uC5D0 \uD2B9\uC815\uB41C \uC635\uC158\uC785\uB2C8\uB2E4.\n\ -XstartOnFirstThread\n\ \uCCAB\uBC88\uC9F8 (AppKit) \uC2A4\uB808\uB4DC\uC5D0 main() \uBA54\uC18C\uB4DC\uB97C \uC2E4\uD589\uD569\uB2C8\uB2E4.\n\ -Xdock:name=<application name>"\n\ \uACE0\uC815\uC73C\uB85C \uD45C\uC2DC\uB41C \uAE30\uBCF8 \uC751\uC6A9 \uD504\uB85C\uADF8\uB7A8 \uC774\uB984\uC744 \uBB34\uD6A8\uD654\uD569\uB2C8\uB2E4.\n\ -Xdock:icon=<path to icon file>\n\ \uACE0\uC815\uC73C\uB85C \uD45C\uC2DC\uB41C \uAE30\uBCF8 \uC544\uC774\uCF58\uC744 \uBB34\uD6A8\uD654\uD569\uB2C8\uB2E4.\n\n java.launcher.cls.error1=\uC624\uB958: \uAE30\uBCF8 \uD074\uB798\uC2A4 {0}\uC744(\uB97C) \uCC3E\uAC70\uB098 \uB85C\uB4DC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. java.launcher.cls.error2=\uC624\uB958: {1} \uD074\uB798\uC2A4\uC5D0\uC11C \uAE30\uBCF8 \uBA54\uC18C\uB4DC\uAC00 {0}\uC774(\uAC00) \uC544\uB2D9\uB2C8\uB2E4. \uB2E4\uC74C \uD615\uC2DD\uC73C\uB85C \uAE30\uBCF8 \uBA54\uC18C\uB4DC\uB97C \uC815\uC758\uD558\uC2ED\uC2DC\uC624.\n\ public static void main(String[] args)
--- a/src/share/classes/sun/launcher/resources/launcher_pt_BR.properties Tue Mar 20 11:00:54 2012 -0400 +++ b/src/share/classes/sun/launcher/resources/launcher_pt_BR.properties Wed Mar 28 10:24:20 2012 -0400 @@ -34,13 +34,13 @@ java.launcher.ergo.message2 =\ porque a execu\u00E7\u00E3o est\u00E1 sendo feita em uma m\u00E1quina de classe de servidor.\n # Translators please note do not translate the options themselves -java.launcher.opt.footer =\ -cp <caminho de pesquisa da classe dos diret\u00F3rios e arquivos zip/jar>\n\\ -classpath <caminho de pesquisa da classe dos diret\u00F3rios e arquivos zip/jar>\n\\ Uma lista separada por {0} de diret\u00F3rios, archives JAR\n\\ e archives ZIP nos quais ser\u00E3o procurados os arquivos de classe.\n\\ -D<nome>=<valor>\n\\ define uma propriedade do sistema\n\\ -verbose[:class|gc|jni]\n\\ ativa a sa\u00EDda detalhada\n\\ -version imprime a vers\u00E3o do produto e sai do programa\n\\ -version:<valor>\n\\ requer a execu\u00E7\u00E3o da vers\u00E3o especificada\n\\ -showversion imprime a vers\u00E3o do produto e continua\n\\ -jre-restrict-search | -no-jre-restrict-search\n\\ inclui/exclui JREs privados do usu\u00E1rio na pesquisa de vers\u00E3o\n\\ -? -help imprime esta mensagem de ajuda\n\\ -X imprime a ajuda sobre op\u00E7\u00F5es n\u00E3o padronizadas\n\\ -ea[:<nome do pacote>...|:<nome da classe>]\n\\ -enableassertions[:<nome do pacote>...|:<nome da classe>]\n\\ ativa asser\u00E7\u00F5es com granularidade especificada\n\\ -da[:<nome do pacote>...|:<nome da classe>]\n\\ -disableassertions[:<nome do pacote>...|:<nome da classe>]\n\\ desativa asser\u00E7\u00F5es com granularidade especificada\n\\ -esa | -enablesystemassertions\n\\ ativa asser\u00E7\u00F5es do sistema\n\\ -dsa | -disablesystemassertions\n\\ desativa asser\u00E7\u00F5es do sistema\n\\ -agentlib:<nome da biblioteca>[=<op\u00E7\u00F5est>]\n\\ carrega a biblioteca de agentes nativa <nome da biblioteca>, e.g. -agentlib:hprof\n\\ consulte tamb\u00E9m, -agentlib:jdwp=help and -agentlib:hprof=help\n\\ -agentpath:<nome do caminho>[=<op\u00E7\u00F5es>]\n\\ carrega a biblioteca de agentes nativa com base no nome do caminho completo\n\\ -javaagent:<caminho do arquivo jar>[=<op\u00E7\u00F5es>]\n\\ carrega o agente da linguagem de programa\u00E7\u00E3o Java; consulte java.lang.instrument\n\\ -splash:<caminho da imagem>\n\\ mostra a tela de abertura com a imagem especificada\nConsulte http://www.oracle.com/technetwork/java/javase/documentation/index.html para ver mais detalhes. +java.launcher.opt.footer =\ -cp <caminho de pesquisa da classe dos diret\u00F3rios e arquivos zip/jar>\n\ -classpath <caminho de pesquisa da classe dos diret\u00F3rios e arquivos zip/jar>\n\ Uma lista separada por {0} de diret\u00F3rios, archives JAR\n\ e archives ZIP nos quais ser\u00E3o procurados os arquivos de classe.\n\ -D<nome>=<valor>\n\ define uma propriedade do sistema\n\ -verbose[:class|gc|jni]\n\ ativa a sa\u00EDda detalhada\n\ -version imprime a vers\u00E3o do produto e sai do programa\n\ -version:<valor>\n\ requer a execu\u00E7\u00E3o da vers\u00E3o especificada\n\ -showversion imprime a vers\u00E3o do produto e continua\n\ -jre-restrict-search | -no-jre-restrict-search\n\ inclui/exclui JREs privados do usu\u00E1rio na pesquisa de vers\u00E3o\n\ -? -help imprime esta mensagem de ajuda\n\ -X imprime a ajuda sobre op\u00E7\u00F5es n\u00E3o padronizadas\n\ -ea[:<nome do pacote>...|:<nome da classe>]\n\ -enableassertions[:<nome do pacote>...|:<nome da classe>]\n\ ativa asser\u00E7\u00F5es com granularidade especificada\n\ -da[:<nome do pacote>...|:<nome da classe>]\n\ -disableassertions[:<nome do pacote>...|:<nome da classe>]\n\ desativa asser\u00E7\u00F5es com granularidade especificada\n\ -esa | -enablesystemassertions\n\ ativa asser\u00E7\u00F5es do sistema\n\ -dsa | -disablesystemassertions\n\ desativa asser\u00E7\u00F5es do sistema\n\ -agentlib:<nome da biblioteca>[=<op\u00E7\u00F5est>]\n\ carrega a biblioteca de agentes nativa <nome da biblioteca>, e.g. -agentlib:hprof\n\ consulte tamb\u00E9m, -agentlib:jdwp=help and -agentlib:hprof=help\n\ -agentpath:<nome do caminho>[=<op\u00E7\u00F5es>]\n\ carrega a biblioteca de agentes nativa com base no nome do caminho completo\n\ -javaagent:<caminho do arquivo jar>[=<op\u00E7\u00F5es>]\n\ carrega o agente da linguagem de programa\u00E7\u00E3o Java; consulte java.lang.instrument\n\ -splash:<caminho da imagem>\n\ mostra a tela de abertura com a imagem especificada\nConsulte http://www.oracle.com/technetwork/java/javase/documentation/index.html para ver mais detalhes. # Translators please note do not translate the options themselves java.launcher.X.usage=\ -Xmixed execu\u00E7\u00E3o no modo misto (default)\n\ -Xint execu\u00E7\u00E3o somente no modo interpretado\n\ -Xbootclasspath:<diret\u00F3rios e arquivos zip/jar separados por {0}>\n\ define o caminho de pesquisa para classes e recursos de inicializa\u00E7\u00E3o\n\ -Xbootclasspath/a:<diret\u00F3rios e arquivos zip/jar separados por {0}>\n\ anexa no final do caminho da classe de inicializa\u00E7\u00E3o\n\ -Xbootclasspath/p:<diret\u00F3rios e arquivos zip/jar separados por {0}>\n\ anexa no in\u00EDcio do caminho da classe de inicializa\u00E7\u00E3o\n\ -Xdiag mostra mensagens de diagn\u00F3stico adicionais\n\ -Xnoclassgc desativa a coleta de lixo da classe\n\ -Xincgc ativa a coleta de lixo incremental\n\ -Xloggc:<arquivo> registra o status do GC status em um arquivo com marca\u00E7\u00F5es de data e hor\u00E1rio\n\ -Xbatch desativa a compila\u00E7\u00E3o em segundo plano\n\ -Xms<tamanho> define o tamanho inicial do heap Java\n\ -Xmx<tamanho> define o tamanho m\u00E1ximo do heap Java\n\ -Xss<tamanho> define o tamanho da pilha de threads java\n\ -Xprof produz dados de perfil da cpu\n\ -Xfuture ativa verifica\u00E7\u00F5es de n\u00EDvel m\u00E1ximo de exig\u00EAncia, prevendo o valor default futuro\n\ -Xrs reduz o uso de sinais do SO pelo(a) Java/VM (consulte a documenta\u00E7\u00E3o)\n\ -Xcheck:jni executa verifica\u00E7\u00F5es adicionais de fun\u00E7\u00F5es da JNI\n\ -Xshare:off n\u00E3o tenta usar dados da classe compartilhada\n\ -Xshare:auto se poss\u00EDvel, usa dados da classe compartilhada (default)\n\ -Xshare:on requer o uso de dados da classe compartilhada, caso contr\u00E1rio haver\u00E1 falha.\n\ -XshowSettings mostra todas as defini\u00E7\u00F5es e continua\n\ -XshowSettings:all\n\ mostra todas as defini\u00E7\u00F5es e continua\n\ -XshowSettings:vm mostra todas as defini\u00E7\u00F5es relacionadas \u00E0 vm e continua\n\ -XshowSettings:properties\n\ mostra todas as defini\u00E7\u00F5es da propriedade e continua\n\ -XshowSettings:locale\n\ mostra todas as defini\u00E7\u00F5es relativas \u00E0s configura\u00E7\u00F5es regionais e continua\n\nAs -X options n\u00E3o s\u00E3o padronizadas e est\u00E3o sujeitas a altera\u00E7\u00F5es sem aviso.\n # Translators please note do not translate the options themselves -java.launcher.X.macosx.usage=\nAs op\u00E7\u00F5es a seguir s\u00E3o espec\u00EDficas para o Mac OS X:\n\\ -XstartOnFirstThread\n\\ executa o m\u00E9todo main() no primeiro thread (AppKit)\n\\ -Xdock:name=<nome da aplica\u00E7\u00E3o>"\n\\ substitui o nome da aplica\u00E7\u00E3o default exibido no encaixe\n\\ -Xdock:icon=<caminho para o arquivo do \u00EDcone>\n\\ substitui o \u00EDcone exibido no encaixe\n\n +java.launcher.X.macosx.usage=\nAs op\u00E7\u00F5es a seguir s\u00E3o espec\u00EDficas para o Mac OS X:\n\ -XstartOnFirstThread\n\ executa o m\u00E9todo main() no primeiro thread (AppKit)\n\ -Xdock:name=<nome da aplica\u00E7\u00E3o>"\n\ substitui o nome da aplica\u00E7\u00E3o default exibido no encaixe\n\ -Xdock:icon=<caminho para o arquivo do \u00EDcone>\n\ substitui o \u00EDcone exibido no encaixe\n\n java.launcher.cls.error1=Erro: N\u00E3o foi poss\u00EDvel localizar nem carregar a classe principal {0} java.launcher.cls.error2=Erro: O m\u00E9todo principal n\u00E3o \u00E9 {0} na classe {1}; defina o m\u00E9todo principal como:\n\ public static void main(String[] args)
--- a/src/share/classes/sun/management/Agent.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/share/classes/sun/management/Agent.java Wed Mar 28 10:24:20 2012 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2005, 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 @@ -25,30 +25,34 @@ package sun.management; +import java.io.BufferedInputStream; import java.io.File; -import java.io.InputStream; import java.io.FileInputStream; -import java.io.BufferedInputStream; import java.io.FileNotFoundException; import java.io.IOException; +import java.io.InputStream; + import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.management.ManagementFactory; + import java.text.MessageFormat; + +import java.util.MissingResourceException; import java.util.Properties; import java.util.ResourceBundle; -import java.util.MissingResourceException; -import java.lang.management.ManagementFactory; -import java.lang.reflect.Method; import javax.management.remote.JMXConnectorServer; +import static sun.management.AgentConfigurationError.*; import sun.management.jmxremote.ConnectorBootstrap; -import static sun.management.AgentConfigurationError.*; import sun.misc.VMSupport; /** * This Agent is started by the VM when -Dcom.sun.management.snmp * or -Dcom.sun.management.jmxremote is set. This class will be - * loaded by the system class loader. + * loaded by the system class loader. Also jmx framework could + * be started by jcmd */ public class Agent { // management properties @@ -69,7 +73,33 @@ "com.sun.management.jmxremote.localConnectorAddress"; private static final String SNMP_ADAPTOR_BOOTSTRAP_CLASS_NAME = - "sun.management.snmp.AdaptorBootstrap"; + "sun.management.snmp.AdaptorBootstrap"; + + // The only active agent allowed + private static JMXConnectorServer jmxServer = null; + + // Parse string com.sun.management.prop=xxx,com.sun.management.prop=yyyy + // and return property set if args is null or empty + // return empty property set + private static Properties parseString(String args){ + Properties argProps = new Properties(); + if (args != null) { + for (String option : args.split(",")) { + String s[] = option.split("=", 2); + String name = s[0].trim(); + String value = (s.length > 1) ? s[1].trim() : ""; + + if (!name.startsWith("com.sun.management.")) { + error(INVALID_OPTION, name); + } + + argProps.setProperty(name, value); + } + } + + return argProps; + } + // invoked by -javaagent or -Dcom.sun.management.agent.class public static void premain(String args) throws Exception { @@ -82,37 +112,104 @@ args = JMXREMOTE; // default to local management } - // Parse agent options into properties + Properties arg_props = parseString(args); + + // Read properties from the config file + Properties config_props = new Properties(); + String fname = arg_props.getProperty(CONFIG_FILE); + readConfiguration(fname, config_props); + + // Arguments override config file + config_props.putAll(arg_props); + startAgent(config_props); + } - Properties arg_props = new Properties(); - if (args != null) { - String[] options = args.split(","); - for (int i=0; i<options.length; i++) { - String[] option = options[i].split("="); - if (option.length >= 1 && option.length <= 2) { - String name = option[0]; - String value = (option.length == 1) ? "" : option[1]; - if (name != null && name.length() > 0) { + // jcmd ManagementAgent.start_local entry point + // Also called due to command-line via startAgent() + private static synchronized void startLocalManagementAgent(){ + Properties agentProps = VMSupport.getAgentProperties(); - // Assume that any com.sun.management.* options are okay - if (name.startsWith("com.sun.management.")) { - arg_props.setProperty(name, value); - } else { - error(INVALID_OPTION, name); - } - } - } + // start local connector if not started + if (agentProps.get(LOCAL_CONNECTOR_ADDRESS_PROP) == null) { + JMXConnectorServer cs = ConnectorBootstrap.startLocalConnectorServer(); + String address = cs.getAddress().toString(); + // Add the local connector address to the agent properties + agentProps.put(LOCAL_CONNECTOR_ADDRESS_PROP, address); + + try { + // export the address to the instrumentation buffer + ConnectorAddressLink.export(address); + } catch (Exception x) { + // Connector server started but unable to export address + // to instrumentation buffer - non-fatal error. + warning(EXPORT_ADDRESS_FAILED, x.getMessage()); } } + } - // Read properties from the config file - Properties config_props = new Properties(); - String fname = arg_props.getProperty(CONFIG_FILE); - readConfiguration(fname, config_props); + // jcmd ManagementAgent.start entry point + // This method starts the remote JMX agent and starts neither + // the local JMX agent nor the SNMP agent + // @see #startLocalManagementAgent and also @see #startAgent. + private static synchronized void startRemoteManagementAgent(String args) throws Exception { + if (jmxServer != null) { + throw new RuntimeException(getText(INVALID_STATE, "Agent already started")); + } + + Properties argProps = parseString(args); + Properties configProps = new Properties(); + + // Load the management properties from the config file + // if config file is not specified readConfiguration implicitly + // reads <java.home>/lib/management/management.properties + + String fname = System.getProperty(CONFIG_FILE); + readConfiguration(fname, configProps); + + // management properties can be overridden by system properties + // which take precedence + configProps.putAll(System.getProperties()); + + // if user specifies config file into command line for either + // jcmd utilities or attach command it overrides properties set in + // command line at the time of VM start + String fnameUser = argProps.getProperty(CONFIG_FILE); + if (fnameUser != null) { + readConfiguration(fnameUser, configProps); + } - // Arguments override config file - config_props.putAll(arg_props); - startAgent(config_props); + // arguments specified in command line of jcmd utilities + // override both system properties and one set by config file + // specified in jcmd command line + configProps.putAll(argProps); + + // jcmd doesn't allow to change ThreadContentionMonitoring, but user + // can specify this property inside config file, so enable optional + // monitoring functionality if this property is set + final String enableThreadContentionMonitoring = + configProps.getProperty(ENABLE_THREAD_CONTENTION_MONITORING); + + if (enableThreadContentionMonitoring != null) { + ManagementFactory.getThreadMXBean(). + setThreadContentionMonitoringEnabled(true); + } + + String jmxremotePort = configProps.getProperty(JMXREMOTE_PORT); + if (jmxremotePort != null) { + jmxServer = ConnectorBootstrap. + startRemoteConnectorServer(jmxremotePort, configProps); + } + } + + private static synchronized void stopRemoteManagementAgent() throws Exception { + if (jmxServer != null) { + ConnectorBootstrap.unexportRegistry(); + + // Attempt to stop already stopped agent + // Don't cause any errors. + jmxServer.stop(); + jmxServer = null; + } } private static void startAgent(Properties props) throws Exception { @@ -130,7 +227,7 @@ try { if (snmpPort != null) { - loadSnmpAgent(snmpPort, props); + loadSnmpAgent(snmpPort, props); } /* @@ -142,31 +239,14 @@ * of this "local" server is exported as a counter to the jstat * instrumentation buffer. */ - if (jmxremote != null || jmxremotePort != null) { + if (jmxremote != null || jmxremotePort != null) { if (jmxremotePort != null) { - ConnectorBootstrap.initialize(jmxremotePort, props); + jmxServer = ConnectorBootstrap. + startRemoteConnectorServer(jmxremotePort, props); } + startLocalManagementAgent(); + } - Properties agentProps = VMSupport.getAgentProperties(); - // start local connector if not started - // System.out.println("local address : " + - // agentProps.get(LOCAL_CONNECTOR_ADDRESS_PROP)); - if (agentProps.get(LOCAL_CONNECTOR_ADDRESS_PROP) == null) { - JMXConnectorServer cs = ConnectorBootstrap.startLocalConnectorServer(); - String address = cs.getAddress().toString(); - // Add the local connector address to the agent properties - agentProps.put(LOCAL_CONNECTOR_ADDRESS_PROP, address); - - try { - // export the address to the instrumentation buffer - ConnectorAddressLink.export(address); - } catch (Exception x) { - // Connector server started but unable to export address - // to instrumentation buffer - non-fatal error. - warning(EXPORT_ADDRESS_FAILED, x.getMessage()); - } - } - } } catch (AgentConfigurationError e) { error(e.getError(), e.getParams()); } catch (Exception e) { @@ -187,9 +267,9 @@ props.putAll(System.getProperties()); return props; - } + } - public static synchronized Properties getManagementProperties() { + public static synchronized Properties getManagementProperties() { if (mgmtProps == null) { String configFile = System.getProperty(CONFIG_FILE); String snmpPort = System.getProperty(SNMP_PORT);
--- a/src/share/classes/sun/management/AgentConfigurationError.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/share/classes/sun/management/AgentConfigurationError.java Wed Mar 28 10:24:20 2012 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2005, 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 @@ -53,6 +53,8 @@ "agent.err.invalid.agentclass"; public static final String INVALID_JMXREMOTE_PORT = "agent.err.invalid.jmxremote.port"; + public static final String INVALID_JMXREMOTE_RMI_PORT = + "agent.err.invalid.jmxremote.rmi.port"; public static final String PASSWORD_FILE_NOT_SET = "agent.err.password.file.notset"; public static final String PASSWORD_FILE_NOT_READABLE = @@ -105,6 +107,8 @@ "agent.err.snmp.adaptor.start.failed"; public static final String SNMP_MIB_INIT_FAILED = "agent.err.snmp.mib.init.failed"; + public static final String INVALID_STATE = + "agent.err.invalid.state"; private final String error; private final String[] params;
--- a/src/share/classes/sun/management/jmxremote/ConnectorBootstrap.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/share/classes/sun/management/jmxremote/ConnectorBootstrap.java Wed Mar 28 10:24:20 2012 -0400 @@ -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 @@ -28,25 +28,22 @@ import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; +import java.io.IOException; import java.io.InputStream; -import java.io.IOException; - +import java.lang.management.ManagementFactory; import java.net.InetAddress; import java.net.MalformedURLException; import java.net.UnknownHostException; - import java.rmi.NoSuchObjectException; import java.rmi.Remote; import java.rmi.RemoteException; import java.rmi.registry.Registry; -import java.rmi.server.RemoteObject; import java.rmi.server.RMIClientSocketFactory; import java.rmi.server.RMIServerSocketFactory; +import java.rmi.server.RemoteObject; import java.rmi.server.UnicastRemoteObject; - import java.security.KeyStore; import java.security.Principal; - import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -55,35 +52,31 @@ import java.util.Set; import java.util.StringTokenizer; -import java.lang.management.ManagementFactory; - -import javax.net.ssl.*; - import javax.management.MBeanServer; import javax.management.remote.JMXAuthenticator; import javax.management.remote.JMXConnectorServer; import javax.management.remote.JMXConnectorServerFactory; import javax.management.remote.JMXServiceURL; import javax.management.remote.rmi.RMIConnectorServer; - +import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManagerFactory; import javax.rmi.ssl.SslRMIClientSocketFactory; import javax.rmi.ssl.SslRMIServerSocketFactory; - import javax.security.auth.Subject; -import sun.rmi.server.UnicastRef; -import sun.rmi.server.UnicastServerRef; -import sun.rmi.server.UnicastServerRef2; +import com.sun.jmx.remote.internal.RMIExporter; +import com.sun.jmx.remote.security.JMXPluggableAuthenticator; +import com.sun.jmx.remote.util.ClassLogger; import sun.management.Agent; import sun.management.AgentConfigurationError; import static sun.management.AgentConfigurationError.*; import sun.management.ConnectorAddressLink; import sun.management.FileSystem; -import com.sun.jmx.remote.util.ClassLogger; - -import com.sun.jmx.remote.internal.RMIExporter; -import com.sun.jmx.remote.security.JMXPluggableAuthenticator; +import sun.rmi.server.UnicastRef; +import sun.rmi.server.UnicastServerRef; +import sun.rmi.server.UnicastServerRef2; /** * This class initializes and starts the RMIConnectorServer for JSR 163 @@ -114,6 +107,8 @@ public static final String PORT = "com.sun.management.jmxremote.port"; + public static final String RMI_PORT = + "com.sun.management.jmxremote.rmi.port"; public static final String CONFIG_FILE_NAME = "com.sun.management.config.file"; public static final String USE_LOCAL_ONLY = @@ -267,34 +262,61 @@ private final String accessFile; } - /** - * Initializes and starts the JMX Connector Server. - * If the com.sun.management.jmxremote.port property is not defined, - * simply return. Otherwise, attempts to load the config file, and - * then calls {@link #initialize(java.lang.String, java.util.Properties)}. - * - **/ - public static synchronized JMXConnectorServer initialize() { + // The variable below is here to support stop functionality + // It would be overriten if you call startRemoteCommectionServer second + // time. It's OK for now as logic in Agent.java forbids mutiple agents + private static Registry registry = null; + + public static void unexportRegistry() { + // Remove the entry from registry + try { + if (registry != null) { + UnicastRemoteObject.unexportObject(registry, true); + registry = null; + } + } catch(NoSuchObjectException ex) { + // This exception can appears only if we attempt + // to unexportRegistry second time. So it's safe + // to ignore it without additional messages. + } + } - // Load a new management properties - final Properties props = Agent.loadManagementProperties(); - if (props == null) { - return null; - } + /** + * Initializes and starts the JMX Connector Server. + * If the com.sun.management.jmxremote.port property is not defined, + * simply return. Otherwise, attempts to load the config file, and + * then calls {@link #startRemoteConnectorServer + * (java.lang.String, java.util.Properties)}. + * + * This method is used by some jtreg tests. + **/ + public static synchronized JMXConnectorServer initialize() { - final String portStr = props.getProperty(PropertyNames.PORT); - + // Load a new management properties + final Properties props = Agent.loadManagementProperties(); + if (props == null) { + return null; + } - // System.out.println("initializing: {port=" + portStr + ", - // properties="+props+"}"); - return initialize(portStr, props); + final String portStr = props.getProperty(PropertyNames.PORT); + return startRemoteConnectorServer(portStr, props); + } + + /** + * This method is used by some jtreg tests. + * + * @see #startRemoteConnectorServer + * (String portStr, Properties props) + */ + public static synchronized JMXConnectorServer initialize(String portStr, Properties props) { + return startRemoteConnectorServer(portStr, props); } /** * Initializes and starts a JMX Connector Server for remote * monitoring and management. **/ - public static synchronized JMXConnectorServer initialize(String portStr, Properties props) { + public static synchronized JMXConnectorServer startRemoteConnectorServer(String portStr, Properties props) { // Get port number final int port; @@ -307,6 +329,22 @@ throw new AgentConfigurationError(INVALID_JMXREMOTE_PORT, portStr); } + // User can specify a port to be used to export rmi object, + // in order to simplify firewall rules + // if port is not specified random one will be allocated. + int rmiPort = 0; + String rmiPortStr = props.getProperty(PropertyNames.RMI_PORT); + try { + if (rmiPortStr != null) { + rmiPort = Integer.parseInt(rmiPortStr); + } + } catch (NumberFormatException x) { + throw new AgentConfigurationError(INVALID_JMXREMOTE_RMI_PORT, x, rmiPortStr); + } + if (rmiPort < 0) { + throw new AgentConfigurationError(INVALID_JMXREMOTE_RMI_PORT, rmiPortStr); + } + // Do we use authentication? final String useAuthenticationStr = props.getProperty(PropertyNames.USE_AUTHENTICATION, @@ -388,9 +426,10 @@ } if (log.debugOn()) { - log.debug("initialize", - Agent.getText("jmxremote.ConnectorBootstrap.initialize") + + log.debug("startRemoteConnectorServer", + Agent.getText("jmxremote.ConnectorBootstrap.starting") + "\n\t" + PropertyNames.PORT + "=" + port + + "\n\t" + PropertyNames.RMI_PORT + "=" + rmiPort + "\n\t" + PropertyNames.USE_SSL + "=" + useSsl + "\n\t" + PropertyNames.USE_REGISTRY_SSL + "=" + useRegistrySsl + "\n\t" + PropertyNames.SSL_CONFIG_FILE_NAME + "=" + sslConfigFileName + @@ -405,7 +444,7 @@ (useAuthentication ? (loginConfigName == null ? ("\n\t" + PropertyNames.PASSWORD_FILE_NAME + "=" + passwordFileName) : ("\n\t" + PropertyNames.LOGIN_CONFIG_NAME + "=" + loginConfigName)) : "\n\t" + - Agent.getText("jmxremote.ConnectorBootstrap.initialize.noAuthentication")) + + Agent.getText("jmxremote.ConnectorBootstrap.noAuthentication")) + (useAuthentication ? ("\n\t" + PropertyNames.ACCESS_FILE_NAME + "=" + accessFileName) : "") + ""); @@ -416,15 +455,15 @@ JMXServiceURL url = null; try { final JMXConnectorServerData data = exportMBeanServer( - mbs, port, useSsl, useRegistrySsl, + mbs, port, rmiPort, useSsl, useRegistrySsl, sslConfigFileName, enabledCipherSuitesList, enabledProtocolsList, sslNeedClientAuth, useAuthentication, loginConfigName, passwordFileName, accessFileName); cs = data.jmxConnectorServer; url = data.jmxRemoteURL; - log.config("initialize", - Agent.getText("jmxremote.ConnectorBootstrap.initialize.ready", + log.config("startRemoteConnectorServer", + Agent.getText("jmxremote.ConnectorBootstrap.ready", url.toString())); } catch (Exception e) { throw new AgentConfigurationError(AGENT_EXCEPTION, e, e.toString()); @@ -443,7 +482,7 @@ // Remote connector server started but unable to export remote // connector address and associated configuration properties to // the instrumentation buffer - non-fatal error. - log.debug("initialize", e); + log.debug("startRemoteConnectorServer", e); } return cs; } @@ -518,9 +557,9 @@ try { if (fs.supportsFileSecurity(file)) { if (!fs.isAccessUserOnly(file)) { - final String msg = Agent.getText("jmxremote.ConnectorBootstrap.initialize.password.readonly", + final String msg = Agent.getText("jmxremote.ConnectorBootstrap.password.readonly", passwordFileName); - log.config("initialize", msg); + log.config("startRemoteConnectorServer", msg); throw new AgentConfigurationError(PASSWORD_FILE_ACCESS_NOT_RESTRICTED, passwordFileName); } @@ -561,9 +600,9 @@ if (fs.supportsFileSecurity(file)) { if (!fs.isAccessUserOnly(file)) { final String msg = Agent.getText( - "jmxremote.ConnectorBootstrap.initialize.file.readonly", + "jmxremote.ConnectorBootstrap.file.readonly", restrictedFileName); - log.config("initialize", msg); + log.config("startRemoteConnectorServer", msg); throw new AgentConfigurationError( FILE_ACCESS_NOT_RESTRICTED, restrictedFileName); } @@ -672,6 +711,7 @@ private static JMXConnectorServerData exportMBeanServer( MBeanServer mbs, int port, + int rmiPort, boolean useSsl, boolean useRegistrySsl, String sslConfigFileName, @@ -689,7 +729,7 @@ * IDs. */ System.setProperty("java.rmi.server.randomIDs", "true"); - JMXServiceURL url = new JMXServiceURL("rmi", null, 0); + JMXServiceURL url = new JMXServiceURL("rmi", null, rmiPort); Map<String, Object> env = new HashMap<String, Object>(); @@ -746,7 +786,6 @@ } } - final Registry registry; if (useRegistrySsl) { registry = new SingleEntryRegistry(port, csf, ssf, @@ -757,10 +796,12 @@ "jmxrmi", exporter.firstExported); } - JMXServiceURL remoteURL = new JMXServiceURL( - "service:jmx:rmi:///jndi/rmi://" + url.getHost() + ":" + - ((UnicastRef) ((RemoteObject) registry).getRef()).getLiveRef().getPort() + - "/jmxrmi"); + + int registryPort = + ((UnicastRef) ((RemoteObject) registry).getRef()).getLiveRef().getPort(); + String jmxUrlStr = String.format("service:jmx:rmi:///jndi/rmi://%s:%d/jmxrmi", + url.getHost(), registryPort); + JMXServiceURL remoteURL = new JMXServiceURL(jmxUrlStr); /* Our exporter remembers the first object it was asked to export, which will be an RMIServerImpl appropriate for
--- a/src/share/classes/sun/management/resources/agent.properties Tue Mar 20 11:00:54 2012 -0400 +++ b/src/share/classes/sun/management/resources/agent.properties Wed Mar 28 10:24:20 2012 -0400 @@ -1,6 +1,6 @@ # # -# Copyright (c) 2004, 2005, 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 @@ -43,8 +43,9 @@ agent.err.premain.notfound = premain(String) does not exist in agent class agent.err.agentclass.access.denied = Access to premain(String) is denied agent.err.invalid.agentclass = Invalid com.sun.management.agent.class property value - +agent.err.invalid.state = Invalid agent state agent.err.invalid.jmxremote.port = Invalid com.sun.management.jmxremote.port number +agent.err.invalid.jmxremote.rmi.port = Invalid com.sun.management.jmxremote.rmi.port number agent.err.file.not.set = File not specified agent.err.file.not.readable = File not readable @@ -78,11 +79,11 @@ agent.err.snmp.adaptor.start.failed = Failed to start SNMP adaptor with address agent.err.snmp.mib.init.failed = Failed to initialize SNMP MIB with error -jmxremote.ConnectorBootstrap.initialize = Starting JMX Connector Server: -jmxremote.ConnectorBootstrap.initialize.noAuthentication = No Authentication -jmxremote.ConnectorBootstrap.initialize.ready = JMX Connector ready at: {0} -jmxremote.ConnectorBootstrap.initialize.password.readonly = Password file read access must be restricted: {0} -jmxremote.ConnectorBootstrap.initialize.file.readonly = File read access must be restricted: {0} +jmxremote.ConnectorBootstrap.starting = Starting JMX Connector Server: +jmxremote.ConnectorBootstrap.noAuthentication = No Authentication +jmxremote.ConnectorBootstrap.ready = JMX Connector ready at: {0} +jmxremote.ConnectorBootstrap.password.readonly = Password file read access must be restricted: {0} +jmxremote.ConnectorBootstrap.file.readonly = File read access must be restricted: {0} jmxremote.AdaptorBootstrap.getTargetList.processing = Processing ACL jmxremote.AdaptorBootstrap.getTargetList.adding = Adding target: {0}
--- a/src/share/classes/sun/security/krb5/internal/ktab/KeyTab.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/share/classes/sun/security/krb5/internal/ktab/KeyTab.java Wed Mar 28 10:24:20 2012 -0400 @@ -141,7 +141,7 @@ if (s == null) { return getInstance(); } else { - return getInstance0(s); + return getInstance0(parse(s)); } }
--- a/src/share/classes/sun/util/calendar/ZoneInfo.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/share/classes/sun/util/calendar/ZoneInfo.java Wed Mar 28 10:24:20 2012 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -80,13 +80,18 @@ private static final int TRANSITION_NSHIFT = 12; // Flag for supporting JDK backward compatible IDs, such as "EST". - private static final boolean USE_OLDMAPPING; + static final boolean USE_OLDMAPPING; static { String oldmapping = AccessController.doPrivileged( new sun.security.action.GetPropertyAction("sun.timezone.ids.oldmapping", "false")).toLowerCase(Locale.ROOT); USE_OLDMAPPING = (oldmapping.equals("yes") || oldmapping.equals("true")); } + // IDs having conflicting data between Olson and JDK 1.1 + static final String[] conflictingIDs = { + "EST", "MST", "HST" + }; + private static final CalendarSystem gcal = CalendarSystem.getGregorianCalendar(); /** @@ -807,7 +812,17 @@ return (checksum == ((ZoneInfo)other).checksum); } - private static SoftReference<Map> aliasTable; + private static SoftReference<Map<String, String>> aliasTable; + + static Map<String, String> getCachedAliasTable() { + Map<String, String> aliases = null; + + SoftReference<Map<String, String>> cache = aliasTable; + if (cache != null) { + aliases = cache.get(); + } + return aliases; + } /** * Returns a Map from alias time zone IDs to their standard @@ -818,20 +833,19 @@ * <code>ZoneInfoMappings</code> file is not available. */ public synchronized static Map<String, String> getAliasTable() { - Map<String, String> aliases = null; - - SoftReference<Map> cache = aliasTable; - if (cache != null) { - aliases = cache.get(); + Map<String, String> aliases = getCachedAliasTable(); + if (aliases == null) { + aliases = ZoneInfoFile.getZoneAliases(); if (aliases != null) { - return aliases; + if (!USE_OLDMAPPING) { + // Remove the conflicting IDs from the alias table. + for (String key : conflictingIDs) { + aliases.remove(key); + } + } + aliasTable = new SoftReference<Map<String, String>>(aliases); } } - - aliases = ZoneInfoFile.getZoneAliases(); - if (aliases != null) { - aliasTable = new SoftReference<Map>(aliases); - } return aliases; }
--- a/src/share/classes/sun/util/calendar/ZoneInfoFile.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/share/classes/sun/util/calendar/ZoneInfoFile.java Wed Mar 28 10:24:20 2012 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -472,6 +472,7 @@ public static final byte TAG_ExcludedZones = 69; private static Map<String, ZoneInfo> zoneInfoObjects = null; + private static final ZoneInfo GMT = new ZoneInfo("GMT", 0); private static final String ziDir = AccessController.doPrivileged( new PrivilegedAction<String>() { @@ -553,8 +554,15 @@ * id. */ public static ZoneInfo getZoneInfo(String id) { + //treat GMT zone as special + if ("GMT".equals(id)) + return (ZoneInfo) GMT.clone(); ZoneInfo zi = getFromCache(id); if (zi == null) { + Map<String, String> aliases = ZoneInfo.getCachedAliasTable(); + if (aliases != null && aliases.get(id) != null) { + return null; + } zi = createZoneInfo(id); if (zi == null) { return null; @@ -1031,30 +1039,26 @@ * @return the buffer, or null if any I/O error occurred. */ private static byte[] readZoneInfoFile(final String fileName) { + if (fileName.indexOf("..") >= 0) { + return null; + } byte[] buffer = null; try { buffer = (byte[]) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws IOException { File file = new File(ziDir, fileName); - if (!file.exists() || !file.isFile()) { - return null; - } - file = file.getCanonicalFile(); - String path = file.getCanonicalPath(); byte[] buf = null; - if (path != null && path.startsWith(ziDir)) { - int filesize = (int)file.length(); - if (filesize > 0) { - FileInputStream fis = new FileInputStream(file); - buf = new byte[filesize]; - try { - if (fis.read(buf) != filesize) { - throw new IOException("read error on " + fileName); - } - } finally { - fis.close(); + int filesize = (int)file.length(); + if (filesize > 0) { + FileInputStream fis = new FileInputStream(file); + buf = new byte[filesize]; + try { + if (fis.read(buf) != filesize) { + throw new IOException("read error on " + fileName); } + } finally { + fis.close(); } } return buf;
--- a/src/share/lib/security/java.security-macosx Tue Mar 20 11:00:54 2012 -0400 +++ b/src/share/lib/security/java.security-macosx Wed Mar 28 10:24:20 2012 -0400 @@ -124,7 +124,7 @@ # passed to checkPackageAccess unless the # corresponding RuntimePermission ("accessClassInPackage."+package) has # been granted. -package.access=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,apple. +package.access=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,apple.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils. # # List of comma-separated packages that start with or equal this string
--- a/src/share/lib/security/java.security-solaris Tue Mar 20 11:00:54 2012 -0400 +++ b/src/share/lib/security/java.security-solaris Wed Mar 28 10:24:20 2012 -0400 @@ -125,7 +125,7 @@ # passed to checkPackageAccess unless the # corresponding RuntimePermission ("accessClassInPackage."+package) has # been granted. -package.access=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio. +package.access=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils. # # List of comma-separated packages that start with or equal this string
--- a/src/share/lib/security/java.security-windows Tue Mar 20 11:00:54 2012 -0400 +++ b/src/share/lib/security/java.security-windows Wed Mar 28 10:24:20 2012 -0400 @@ -124,7 +124,7 @@ # passed to checkPackageAccess unless the # corresponding RuntimePermission ("accessClassInPackage."+package) has # been granted. -package.access=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio. +package.access=sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils. # # List of comma-separated packages that start with or equal this string
--- a/src/solaris/classes/java/io/FileDescriptor.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/solaris/classes/java/io/FileDescriptor.java Wed Mar 28 10:24:20 2012 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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 @@ -24,8 +24,8 @@ */ package java.io; - -import java.util.concurrent.atomic.AtomicInteger; +import java.util.ArrayList; +import java.util.List; /** * Instances of the file descriptor class serve as an opaque handle @@ -45,13 +45,9 @@ public final class FileDescriptor { private int fd; - - /** - * A counter for tracking the FIS/FOS/RAF instances that - * use this FileDescriptor. The FIS/FOS.finalize() will not release - * the FileDescriptor if it is still under user by a stream. - */ - private AtomicInteger useCount; + private Closeable parent; + private List<Closeable> otherParents; + private boolean closed; /** * Constructs an (invalid) FileDescriptor @@ -59,12 +55,10 @@ */ public /**/ FileDescriptor() { fd = -1; - useCount = new AtomicInteger(); } private /* */ FileDescriptor(int fd) { this.fd = fd; - useCount = new AtomicInteger(); } /** @@ -164,13 +158,67 @@ ); } - // package private methods used by FIS, FOS and RAF + /* + * Package private methods to track referents. + * If multiple streams point to the same FileDescriptor, we cycle + * through the list of all referents and call close() + */ - int incrementAndGetUseCount() { - return useCount.incrementAndGet(); + /** + * Attach a Closeable to this FD for tracking. + * parent reference is added to otherParents when + * needed to make closeAll simpler. + */ + synchronized void attach(Closeable c) { + if (parent == null) { + // first caller gets to do this + parent = c; + } else if (otherParents == null) { + otherParents = new ArrayList<>(); + otherParents.add(parent); + otherParents.add(c); + } else { + otherParents.add(c); + } } - int decrementAndGetUseCount() { - return useCount.decrementAndGet(); + /** + * Cycle through all Closeables sharing this FD and call + * close() on each one. + * + * The caller closeable gets to call close0(). + */ + @SuppressWarnings("try") + synchronized void closeAll(Closeable releaser) throws IOException { + if (!closed) { + closed = true; + IOException ioe = null; + try (Closeable c = releaser) { + if (otherParents != null) { + for (Closeable referent : otherParents) { + try { + referent.close(); + } catch(IOException x) { + if (ioe == null) { + ioe = x; + } else { + ioe.addSuppressed(x); + } + } + } + } + } catch(IOException ex) { + /* + * If releaser close() throws IOException + * add other exceptions as suppressed. + */ + if (ioe != null) + ex.addSuppressed(ioe); + ioe = ex; + } finally { + if (ioe != null) + throw ioe; + } + } } }
--- a/src/windows/classes/java/io/FileDescriptor.java Tue Mar 20 11:00:54 2012 -0400 +++ b/src/windows/classes/java/io/FileDescriptor.java Wed Mar 28 10:24:20 2012 -0400 @@ -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 @@ -24,8 +24,8 @@ */ package java.io; - -import java.util.concurrent.atomic.AtomicInteger; +import java.util.ArrayList; +import java.util.List; /** * Instances of the file descriptor class serve as an opaque handle @@ -42,16 +42,10 @@ public final class FileDescriptor { private int fd; - private long handle; - - /** - * A use counter for tracking the FIS/FOS/RAF instances that - * use this FileDescriptor. The FIS/FOS.finalize() will not release - * the FileDescriptor if it is still under use by any stream. - */ - private AtomicInteger useCount; - + private Closeable parent; + private List<Closeable> otherParents; + private boolean closed; /** * Constructs an (invalid) FileDescriptor @@ -60,7 +54,6 @@ public /**/ FileDescriptor() { fd = -1; handle = -1; - useCount = new AtomicInteger(); } static { @@ -168,13 +161,67 @@ return desc; } - // package private methods used by FIS, FOS and RAF. + /* + * Package private methods to track referents. + * If multiple streams point to the same FileDescriptor, we cycle + * through the list of all referents and call close() + */ - int incrementAndGetUseCount() { - return useCount.incrementAndGet(); + /** + * Attach a Closeable to this FD for tracking. + * parent reference is added to otherParents when + * needed to make closeAll simpler. + */ + synchronized void attach(Closeable c) { + if (parent == null) { + // first caller gets to do this + parent = c; + } else if (otherParents == null) { + otherParents = new ArrayList<>(); + otherParents.add(parent); + otherParents.add(c); + } else { + otherParents.add(c); + } } - int decrementAndGetUseCount() { - return useCount.decrementAndGet(); + /** + * Cycle through all Closeables sharing this FD and call + * close() on each one. + * + * The caller closeable gets to call close0(). + */ + @SuppressWarnings("try") + synchronized void closeAll(Closeable releaser) throws IOException { + if (!closed) { + closed = true; + IOException ioe = null; + try (Closeable c = releaser) { + if (otherParents != null) { + for (Closeable referent : otherParents) { + try { + referent.close(); + } catch(IOException x) { + if (ioe == null) { + ioe = x; + } else { + ioe.addSuppressed(x); + } + } + } + } + } catch(IOException ex) { + /* + * If releaser close() throws IOException + * add other exceptions as suppressed. + */ + if (ioe != null) + ex.addSuppressed(ioe); + ioe = ex; + } finally { + if (ioe != null) + throw ioe; + } + } } }
--- a/test/ProblemList.txt Tue Mar 20 11:00:54 2012 -0400 +++ b/test/ProblemList.txt Wed Mar 28 10:24:20 2012 -0400 @@ -210,6 +210,9 @@ # Windows X64, RuntimeException: MyThread expected to have RUNNABLE but got WAITING java/lang/Thread/ThreadStateTest.java generic-all +# 7148492 +java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java generic-all + ############################################################################ # jdk_management @@ -287,6 +290,9 @@ # Windows X64, java.lang.IllegalStateException javax/management/monitor/AttributeArbitraryDataTypeTest.java generic-all +# 7149181 +sun/management/jmxremote/startstop/JMXStartStopTest.sh generic-all + ############################################################################ # jdk_math @@ -379,6 +385,10 @@ #7143960 java/net/DatagramSocket/SendDatagramToBadAddress.java macosx-all +# 7148829 +sun/net/InetAddress/nameservice/simple/CacheTest.java generic-all +sun/net/InetAddress/nameservice/simple/DefaultCaching.java generic-all + ############################################################################ # jdk_io @@ -428,6 +438,9 @@ # Fails on Linux 32 and 64bit -server?, impl not garbage collected??? java/rmi/transport/pinLastArguments/PinLastArguments.java generic-all +# 7146541 +java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java linux-all + # Times out on solaris sparc java/rmi/server/RemoteServer/AddrInUse.java generic-all
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/com/sun/jndi/ldap/LdapUnicodeURL.java Wed Mar 28 10:24:20 2012 -0400 @@ -0,0 +1,41 @@ +/* + * 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 6961765 + * @summary Double byte characters corrupted in DN for LDAP referrals + */ + +import com.sun.jndi.ldap.LdapURL; + +public class LdapUnicodeURL { + public static void main(String[] args) throws Exception { + // First 3 characters of the CJK Unified Ideographs + String uid = "uid=\u4e00\u4e01\u4e02"; + LdapURL ldURL = new LdapURL("ldap://www.example.com/" + uid); + if (!ldURL.getDN().equals(uid)) { + throw new Exception("uid changed to " + ldURL.getDN()); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/beans/PropertyChangeSupport/Test7148143.java Wed Mar 28 10:24:20 2012 -0400 @@ -0,0 +1,58 @@ +/* + * 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 7148143 + * @summary Tests ClassCastException for the PropertyChangeSupport class + * @author Sergey Malenkov + */ + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.util.EventListener; +import java.util.EventListenerProxy; + +public class Test7148143 { + + private static class CustomProxy + extends EventListenerProxy<EventListener> + implements PropertyChangeListener { + + public CustomProxy() { + super(new EventListener() { + }); + } + + public void propertyChange(PropertyChangeEvent event) { + } + } + + public static void main(String[] args) { + PropertyChangeListener listener = new CustomProxy(); + PropertyChangeSupport support = new PropertyChangeSupport(listener); + support.addPropertyChangeListener(listener); + support.addPropertyChangeListener("foo", listener); // cast class exception + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/beans/VetoableChangeSupport/Test7148143.java Wed Mar 28 10:24:20 2012 -0400 @@ -0,0 +1,58 @@ +/* + * 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 7148143 + * @summary Tests ClassCastException for the VetoableChangeSupport class + * @author Sergey Malenkov + */ + +import java.beans.PropertyChangeEvent; +import java.beans.VetoableChangeListener; +import java.beans.VetoableChangeSupport; +import java.util.EventListener; +import java.util.EventListenerProxy; + +public class Test7148143 { + + private static class CustomProxy + extends EventListenerProxy<EventListener> + implements VetoableChangeListener { + + public CustomProxy() { + super(new EventListener() { + }); + } + + public void vetoableChange(PropertyChangeEvent event) { + } + } + + public static void main(String[] args) { + VetoableChangeListener listener = new CustomProxy(); + VetoableChangeSupport support = new VetoableChangeSupport(listener); + support.addVetoableChangeListener(listener); + support.addVetoableChangeListener("foo", listener); // cast class exception + } +}
--- a/test/java/io/FileDescriptor/FileChannelFDTest.java Tue Mar 20 11:00:54 2012 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2006, 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 6322678 - * @summary Test for making sure that fd is closed during - * finalization of a stream, when an associated - * file channel is not available - */ - -import java.io.*; -import java.nio.*; -import java.nio.channels.*; - -public class FileChannelFDTest { - - static byte data[] = new byte[] {48, 49, 50, 51, 52, 53, 54, 55, 56, 57,}; - static String inFileName = "fd-in-test.txt"; - static String outFileName = "fd-out-test.txt"; - static File inFile; - static File outFile; - - private static void writeToInFile() throws IOException { - FileOutputStream out = new FileOutputStream(inFile); - out.write(data); - out.close(); - } - - public static void main(String[] args) - throws Exception { - - inFile= new File(System.getProperty("test.dir", "."), - inFileName); - inFile.createNewFile(); - inFile.deleteOnExit(); - writeToInFile(); - - outFile = new File(System.getProperty("test.dir", "."), - outFileName); - outFile.createNewFile(); - outFile.deleteOnExit(); - - doFileChannel(); - } - - private static void doFileChannel() throws Exception { - - FileInputStream fis = new FileInputStream(inFile); - FileDescriptor fd = fis.getFD(); - FileChannel fc = fis.getChannel(); - System.out.println("Created fis:" + fis); - - /** - * Encourage the GC - */ - fis = null; - fc = null; - System.gc(); - Thread.sleep(500); - - if (fd.valid()) { - throw new Exception("Finalizer either didn't run --" + - "try increasing the Thread's sleep time after System.gc();" + - "or the finalizer didn't close the file"); - } - - System.out.println("File Closed successfully"); - System.out.println(); - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/io/FileDescriptor/Sharing.java Wed Mar 28 10:24:20 2012 -0400 @@ -0,0 +1,408 @@ +/* + * 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 7105952 6322678 7082769 + * @summary Improve finalisation for FileInputStream/FileOutputStream/RandomAccessFile + * @run main/othervm Sharing + */ + +import java.io.*; +import java.nio.channels.FileChannel; +import java.nio.channels.FileLock; +import java.util.concurrent.CountDownLatch; + +public class Sharing { + + final static int numFiles = 10; + volatile static boolean fail; + + public static void main(String[] args) throws Exception { + TestFinalizer(); + TestMultipleFD(); + TestIsValid(); + MultiThreadedFD(); + TestCloseAll(); + } + + /** + * Finalizer shouldn't discard a file descriptor until all streams have + * finished with it. + */ + private static void TestFinalizer() throws Exception { + FileDescriptor fd = null; + File tempFile = new File("TestFinalizer1.txt"); + tempFile.deleteOnExit(); + try (Writer writer = new FileWriter(tempFile)) { + for (int i=0; i<5; i++) { + writer.write("test file content test file content"); + } + } + + FileInputStream fis1 = new FileInputStream(tempFile); + fd = fis1.getFD(); + // Create a new FIS based on the existing FD (so the two FIS's share the same native fd) + try (FileInputStream fis2 = new FileInputStream(fd)) { + // allow fis1 to be gc'ed + fis1 = null; + int ret = 0; + while(ret >= 0) { + // encourage gc + System.gc(); + // read from fis2 - when fis1 is gc'ed and finalizer is run, read will fail + System.out.print("."); + ret = fis2.read(); + } + } + + // variation of above. Use RandomAccessFile to obtain a filedescriptor + File testFinalizerFile = new File("TestFinalizer"); + RandomAccessFile raf = new RandomAccessFile(testFinalizerFile, "rw"); + raf.writeBytes("test file content test file content"); + raf.seek(0L); + fd = raf.getFD(); + try (FileInputStream fis3 = new FileInputStream(fd)) { + // allow raf to be gc'ed + raf = null; + int ret = 0; + while (ret >= 0) { + // encourage gc + System.gc(); + /* + * read from fis3 - when raf is gc'ed and finalizer is run, + * fd should still be valid. + */ + System.out.print("."); + ret = fis3.read(); + } + } finally { + testFinalizerFile.delete(); + } + } + + /** + * Exercise FileDispatcher close()/preClose() + */ + private static void TestMultipleFD() throws Exception { + RandomAccessFile raf = null; + FileOutputStream fos = null; + FileInputStream fis = null; + FileChannel fc = null; + FileLock fileLock = null; + + File test1 = new File("test1"); + try { + raf = new RandomAccessFile(test1, "rw"); + fos = new FileOutputStream(raf.getFD()); + fis = new FileInputStream(raf.getFD()); + fc = raf.getChannel(); + fileLock = fc.lock(); + raf.setLength(0L); + fos.flush(); + fos.write("TEST".getBytes()); + } finally { + if (fileLock != null) fileLock.release(); + if (fis != null) fis.close(); + if (fos != null) fos.close(); + if (raf != null) raf.close(); + test1.delete(); + } + + /* + * Close out in different order to ensure FD is not + * closed out too early + */ + File test2 = new File("test2"); + try { + raf = new RandomAccessFile(test2, "rw"); + fos = new FileOutputStream(raf.getFD()); + fis = new FileInputStream(raf.getFD()); + fc = raf.getChannel(); + fileLock = fc.lock(); + raf.setLength(0L); + fos.flush(); + fos.write("TEST".getBytes()); + } finally { + if (fileLock != null) fileLock.release(); + if (raf != null) raf.close(); + if (fos != null) fos.close(); + if (fis != null) fis.close(); + test2.delete(); + } + + // one more time, fos first this time + File test3 = new File("test3"); + try { + raf = new RandomAccessFile(test3, "rw"); + fos = new FileOutputStream(raf.getFD()); + fis = new FileInputStream(raf.getFD()); + fc = raf.getChannel(); + fileLock = fc.lock(); + raf.setLength(0L); + fos.flush(); + fos.write("TEST".getBytes()); + } finally { + if (fileLock != null) fileLock.release(); + if (fos != null) fos.close(); + if (raf != null) raf.close(); + if (fis != null) fis.close(); + test3.delete(); + } + } + + /** + * Similar to TestMultipleFD() but this time we + * just get and use FileDescriptor.valid() for testing. + */ + private static void TestIsValid() throws Exception { + FileDescriptor fd = null; + RandomAccessFile raf = null; + FileOutputStream fos = null; + FileInputStream fis = null; + FileChannel fc = null; + + File test1 = new File("test1"); + try { + raf = new RandomAccessFile(test1, "rw"); + fd = raf.getFD(); + fos = new FileOutputStream(fd); + fis = new FileInputStream(fd); + } finally { + try { + if (fis != null) fis.close(); + if (fd.valid()) { + throw new RuntimeException("[FIS close()] FileDescriptor shouldn't be valid"); + } + if (fos != null) fos.close(); + if (raf != null) raf.close(); + } finally { + test1.delete(); + } + } + + /* + * Close out in different order to ensure FD is + * closed correctly. + */ + File test2 = new File("test2"); + try { + raf = new RandomAccessFile(test2, "rw"); + fd = raf.getFD(); + fos = new FileOutputStream(fd); + fis = new FileInputStream(fd); + } finally { + try { + if (raf != null) raf.close(); + if (fd.valid()) { + throw new RuntimeException("[RAF close()] FileDescriptor shouldn't be valid"); + } + if (fos != null) fos.close(); + if (fis != null) fis.close(); + } finally { + test2.delete(); + } + } + + // one more time, fos first this time + File test3 = new File("test3"); + try { + raf = new RandomAccessFile(test3, "rw"); + fd = raf.getFD(); + fos = new FileOutputStream(fd); + fis = new FileInputStream(fd); + } finally { + try { + if (fos != null) fos.close(); + if (fd.valid()) { + throw new RuntimeException("[FOS close()] FileDescriptor shouldn't be valid"); + } + if (raf != null) raf.close(); + if (fis != null) fis.close(); + } finally { + test3.delete(); + } + } + } + + /** + * Test concurrent access to the same FileDescriptor + */ + private static void MultiThreadedFD() throws Exception { + RandomAccessFile raf = null; + FileDescriptor fd = null; + int numThreads = 2; + CountDownLatch done = new CountDownLatch(numThreads); + OpenClose[] fileOpenClose = new OpenClose[numThreads]; + File MultipleThreadedFD = new File("MultipleThreadedFD"); + try { + raf = new RandomAccessFile(MultipleThreadedFD, "rw"); + fd = raf.getFD(); + for(int count=0;count<numThreads;count++) { + fileOpenClose[count] = new OpenClose(fd, done); + fileOpenClose[count].start(); + } + done.await(); + } finally { + try { + if(raf != null) raf.close(); + // fd should now no longer be valid + if(fd.valid()) { + throw new RuntimeException("FileDescriptor should not be valid"); + } + // OpenClose thread tests failed + if(fail) { + throw new RuntimeException("OpenClose thread tests failed."); + } + } finally { + MultipleThreadedFD.delete(); + } + } + } + + /** + * Test closeAll handling in FileDescriptor + */ + private static void TestCloseAll() throws Exception { + File testFile = new File("test"); + testFile.deleteOnExit(); + RandomAccessFile raf = new RandomAccessFile(testFile, "rw"); + FileInputStream fis = new FileInputStream(raf.getFD()); + fis.close(); + if (raf.getFD().valid()) { + throw new RuntimeException("FD should not be valid."); + } + + // Test the suppressed exception handling - FileInputStream + + raf = new RandomAccessFile(testFile, "rw"); + fis = new FileInputStream(raf.getFD()); + BadFileInputStream bfis1 = new BadFileInputStream(raf.getFD()); + BadFileInputStream bfis2 = new BadFileInputStream(raf.getFD()); + BadFileInputStream bfis3 = new BadFileInputStream(raf.getFD()); + // extra test - set bfis3 to null + bfis3 = null; + try { + fis.close(); + } catch (IOException ioe) { + ioe.printStackTrace(); + if (ioe.getSuppressed().length != 2) { + throw new RuntimeException("[FIS]Incorrect number of suppressed " + + "exceptions received : " + ioe.getSuppressed().length); + } + } + if (raf.getFD().valid()) { + // we should still have closed the FD + // even with the exception. + throw new RuntimeException("[FIS]TestCloseAll : FD still valid."); + } + + // Now test with FileOutputStream + + raf = new RandomAccessFile(testFile, "rw"); + FileOutputStream fos = new FileOutputStream(raf.getFD()); + BadFileOutputStream bfos1 = new BadFileOutputStream(raf.getFD()); + BadFileOutputStream bfos2 = new BadFileOutputStream(raf.getFD()); + BadFileOutputStream bfos3 = new BadFileOutputStream(raf.getFD()); + // extra test - set bfos3 to null + bfos3 = null; + try { + fos.close(); + } catch (IOException ioe) { + ioe.printStackTrace(); + if (ioe.getSuppressed().length != 2) { + throw new RuntimeException("[FOS]Incorrect number of suppressed " + + "exceptions received : " + ioe.getSuppressed().length); + } + } + if (raf.getFD().valid()) { + // we should still have closed the FD + // even with the exception. + throw new RuntimeException("[FOS]TestCloseAll : FD still valid."); + } + } + + /** + * A thread which will open and close a number of FileInputStreams and + * FileOutputStreams referencing the same native file descriptor. + */ + private static class OpenClose extends Thread { + private FileDescriptor fd = null; + private CountDownLatch done; + FileInputStream[] fisArray = new FileInputStream[numFiles]; + FileOutputStream[] fosArray = new FileOutputStream[numFiles]; + + OpenClose(FileDescriptor filedescriptor, CountDownLatch done) { + this.fd = filedescriptor; + this.done = done; + } + + public void run() { + try { + for(int i=0;i<numFiles;i++) { + fisArray[i] = new FileInputStream(fd); + fosArray[i] = new FileOutputStream(fd); + } + + // Now close out + for(int i=0;i<numFiles;i++) { + if(fisArray[i] != null) fisArray[i].close(); + if(fosArray[i] != null) fosArray[i].close(); + } + + } catch(IOException ioe) { + System.out.println("OpenClose encountered IO issue :" + ioe); + fail = true; + } finally { + if (fd.valid()) { // fd should not be valid after first close() call + System.out.println("OpenClose: FileDescriptor shouldn't be valid"); + fail = true; + } + done.countDown(); + } + } + } + + private static class BadFileInputStream extends FileInputStream { + + BadFileInputStream(FileDescriptor fd) { + super(fd); + } + + public void close() throws IOException { + throw new IOException("Bad close operation"); + } + } + + private static class BadFileOutputStream extends FileOutputStream { + + BadFileOutputStream(FileDescriptor fd) { + super(fd); + } + + public void close() throws IOException { + throw new IOException("Bad close operation"); + } + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/lang/SecurityManager/CheckPackageAccess.java Wed Mar 28 10:24:20 2012 -0400 @@ -0,0 +1,47 @@ +/* + * 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 7146431 + * @summary Test that internal JAXP packages cannot be accessed + */ + +public class CheckPackageAccess { + + public static void main(String[] args) throws Exception { + + String[] pkgs = new String[] { + "com.sun.org.apache.xerces.internal.utils.", + "com.sun.org.apache.xalan.internal.utils." }; + SecurityManager sm = new SecurityManager(); + System.setSecurityManager(sm); + for (String pkg : pkgs) { + System.out.println("Checking package access for " + pkg); + try { + sm.checkPackageAccess(pkg); + throw new Exception("Expected SecurityException not thrown"); + } catch (SecurityException se) { } + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/util/Collections/EqualsTest.java Wed Mar 28 10:24:20 2012 -0400 @@ -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 7144488 + * @summary Infinite recursion for some equals tests in Collections + */ + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +public class EqualsTest { + public static void main(String[] args) { + boolean test; + + /* synchronizedList test */ + List list = Collections.synchronizedList(new ArrayList()); + list.add(list); + test = list.equals(list); + assertTrue(test); + list.remove(list); + + /* synchronizedSet test */ + Set s = Collections.synchronizedSet(new HashSet()); + s.add(s); + test = s.equals(s); + assertTrue(test); + + /* synchronizedMap test */ + Map m = Collections.synchronizedMap(new HashMap()); + test = m.equals(m); + assertTrue(test); + + } + + private static void assertTrue(boolean b) { + if (!b) + throw new RuntimeException("assertion failed"); + } +}
--- a/test/java/util/concurrent/locks/Lock/TimedAcquireLeak.java Tue Mar 20 11:00:54 2012 -0400 +++ b/test/java/util/concurrent/locks/Lock/TimedAcquireLeak.java Wed Mar 28 10:24:20 2012 -0400 @@ -28,6 +28,8 @@ * @author Martin Buchholz */ +// Note: this file is now out of sync with the jsr166 CVS repository due to the fix for 7092140 + import java.util.*; import java.util.regex.*; import java.util.concurrent.*; @@ -148,7 +150,7 @@ String.valueOf(new Random().nextInt(Integer.MAX_VALUE)); final String[] jobCmd = { - java, "-Xmx8m", + java, "-Xmx8m", "-XX:+UsePerfData", "-classpath", System.getProperty("test.classes", "."), childClassName, uniqueID };
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/util/jar/Manifest/CreateManifest.java Wed Mar 28 10:24:20 2012 -0400 @@ -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"; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/swing/JMenuItem/6209975/bug6209975.java Wed Mar 28 10:24:20 2012 -0400 @@ -0,0 +1,172 @@ +/* + * 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 6209975 + * @summary regression: JMenuItem icons overimposed on JMenuItem labels under Metal LAF + * @library ../../regtesthelpers + * @build Util + * @author Alexander Zuev + * @run main bug6209975 + */ +import javax.swing.*; +import java.awt.*; +import java.awt.event.InputEvent; +import sun.awt.SunToolkit; + +public class bug6209975 { + + private static final ReturnObject RO1 = new ReturnObject(); + private static final ReturnObject RO2 = new ReturnObject(); + + private static JMenu menu; + private static JButton button; + + public static void main(String[] args) throws Exception { + + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + Robot robot = new Robot(); + robot.setAutoDelay(500); + + + SwingUtilities.invokeAndWait(new Runnable() { + + @Override + public void run() { + createAndShowGUI(); + } + }); + + toolkit.realSync(); + + Point clickPoint = getButtonClickPoint(); + robot.mouseMove(clickPoint.x, clickPoint.y); + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + toolkit.realSync(); + + clickPoint = getMenuClickPoint(); + robot.mouseMove(clickPoint.x, clickPoint.y); + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + toolkit.realSync(); + + if (RO1.itsValue <= RO2.itsValue) { + throw new RuntimeException("Offset if the second icon is invalid."); + } + } + + private static Point getButtonClickPoint() throws Exception { + final Point[] result = new Point[1]; + + SwingUtilities.invokeAndWait(new Runnable() { + + @Override + public void run() { + Point p = button.getLocationOnScreen(); + Dimension size = button.getSize(); + result[0] = new Point(p.x + size.width / 2, p.y + size.height / 2); + } + }); + return result[0]; + } + + private static Point getMenuClickPoint() throws Exception { + final Point[] result = new Point[1]; + + SwingUtilities.invokeAndWait(new Runnable() { + + @Override + public void run() { + Point p = menu.getLocationOnScreen(); + Dimension size = menu.getSize(); + result[0] = new Point(p.x + size.width / 2, p.y + size.height / 2); + } + }); + return result[0]; + } + + private static void createAndShowGUI() { + JFrame frame = new JFrame("Test6209975"); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.applyComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); + frame.setLayout(new BorderLayout()); + button = new JButton("Focus holder"); + frame.add(button); + + JMenuBar mb = new JMenuBar(); + menu = new JMenu("File"); + + JMenuItem item; + + item = new JMenuItem("Just a menu item"); + item.setIcon(new MyIcon(RO1)); + item.setHorizontalTextPosition(SwingConstants.LEADING); + menu.add(item); + + item = new JMenuItem("Menu Item with another icon"); + item.setIcon(new MyIcon(RO2)); + item.setHorizontalTextPosition(SwingConstants.TRAILING); + menu.add(item); + + mb.add(menu); + + frame.setJMenuBar(mb); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.pack(); + frame.setLocation(400, 300); + frame.setVisible(true); + } + + public static class ReturnObject { + + public volatile int itsValue; + } + + public static class MyIcon implements Icon { + + ReturnObject thisObject = null; + + public MyIcon(ReturnObject ro) { + super(); + thisObject = ro; + } + + public void paintIcon(Component c, Graphics g, int x, int y) { + Color color = g.getColor(); + g.setColor(Color.BLACK); + g.fillRect(x, y, 10, 10); + g.setColor(color); + thisObject.itsValue = x; + } + + public int getIconWidth() { + return 10; + } + + public int getIconHeight() { + return 10; + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/swing/JTable/7027139/bug7027139.java Wed Mar 28 10:24:20 2012 -0400 @@ -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"); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/swing/JToolBar/4247996/bug4247996.java Wed Mar 28 10:24:20 2012 -0400 @@ -0,0 +1,115 @@ +/* + * 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 4247996 4260485 + * @summary Test that rollover toolbar doesn't corrupt buttons + * @author Peter Zhelezniakov + * @run main bug4247996 + */ +import java.awt.*; +import javax.swing.*; +import sun.awt.SunToolkit; + +public class bug4247996 { + + private static JButton button; + private static JToggleButton toogleButton; + + public static void main(String[] args) throws Exception { + + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + Robot robot = new Robot(); + robot.setAutoDelay(50); + + UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); + + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + + public void run() { + createAndShowGUI(); + } + }); + + toolkit.realSync(); + + Point point = getButtonCenter(); + robot.mouseMove(point.x, point.y); + toolkit.realSync(); + + checkButtonsSize(); + + } + + private static void checkButtonsSize() throws Exception { + SwingUtilities.invokeAndWait(new Runnable() { + + @Override + public void run() { + if (!button.getSize().equals(toogleButton.getSize())) { + throw new RuntimeException("Button sizes are different!"); + } + } + }); + } + + private static Point getButtonCenter() throws Exception { + final Point[] result = new Point[1]; + + SwingUtilities.invokeAndWait(new Runnable() { + + @Override + public void run() { + Point p = button.getLocationOnScreen(); + Dimension size = button.getSize(); + result[0] = new Point(p.x + size.width / 2, p.y + size.height / 2); + } + }); + return result[0]; + } + + private static void createAndShowGUI() { + JFrame frame = new JFrame("Test"); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setSize(200, 200); + + JButton rButton = new JButton("Rollover"); + rButton.setRolloverEnabled(true); + JToolBar nrToolbar = new JToolBar(); + nrToolbar.add(rButton); + nrToolbar.remove(rButton); + + if (!rButton.isRolloverEnabled()) { + throw new Error("Failed (bug 4260485): " + + "toolbar overrode button's rollover property"); + } + + JToolBar rToolbar = new JToolBar(); + rToolbar.putClientProperty("JToolBar.isRollover", Boolean.TRUE); + rToolbar.add(button = new JButton("Test")); + rToolbar.add(toogleButton = new JToggleButton("Test")); + + frame.getContentPane().add(rToolbar, BorderLayout.NORTH); + frame.setVisible(true); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/javax/swing/JViewport/7107099/bug7107099.java Wed Mar 28 10:24:20 2012 -0400 @@ -0,0 +1,104 @@ +/* + * 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 7107099 + @summary JScrollBar does not show up even if there are enough lebgth of textstring in textField + @author Pavel Porvatov +*/ + +import sun.awt.SunToolkit; + +import javax.swing.*; +import java.awt.*; + +public class bug7107099 { + private static JFrame frame; + private static JTextArea textarea; + private static JScrollPane scrollPane; + + private static int value; + private static int min; + private static int max; + private static int extent; + + public static void main(String[] args) throws Exception { + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + textarea = new JTextArea("before###1###\nbefore###2###\nbefore###3###\nbefore###4###\nbefore###5###\n"); + + scrollPane = new JScrollPane(textarea); + scrollPane.setPreferredSize(new Dimension(100, 50)); + + frame = new JFrame(); + frame.setLayout(new BorderLayout()); + frame.setSize(200, 200); + frame.add(scrollPane, BorderLayout.SOUTH); + frame.setVisible(true); + } + }); + + toolkit.realSync(); + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + BoundedRangeModel model = scrollPane.getVerticalScrollBar().getModel(); + + value = model.getValue(); + min = model.getMinimum(); + max = model.getMaximum(); + extent = model.getExtent(); + + // Do tricky manipulation for testing purpose + textarea.setText(null); + scrollPane.setViewportView(textarea); + textarea.setText("after###1###\nafter###1###\nafter###1###\nafter###1###\nafter###1###\n"); + textarea.setCaretPosition(0); + } + }); + + toolkit.realSync(); + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + BoundedRangeModel model = scrollPane.getVerticalScrollBar().getModel(); + + if (value != model.getValue() || + min != model.getMinimum() || + max != model.getMaximum() || + extent != model.getExtent()) { + throw new RuntimeException("Test bug7107099 failed"); + } + + System.out.println("Test bug7107099 passed"); + + frame.dispose(); + } + }); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/java2d/loops/Bug7049339.java Wed Mar 28 10:24:20 2012 -0400 @@ -0,0 +1,77 @@ +/* + * Copyright 2011 Red Hat, Inc. All Rights Reserved. + * Copyright (c) 2011, 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 7049339 + @summary Copying images with a non-rectangular clip and a custom composite + fails + @author Denis Lila <dlila@redhat.com> + @run main Bug7049339 + */ + +import java.awt.Composite; +import java.awt.CompositeContext; +import java.awt.Graphics2D; +import java.awt.RenderingHints; +import java.awt.Shape; +import java.awt.geom.Ellipse2D; +import java.awt.image.BufferedImage; +import java.awt.image.ColorModel; +import java.awt.image.Raster; +import java.awt.image.WritableRaster; + +public class Bug7049339 { + public static void main(String[] argv) { + int x = 100, y = 100; + BufferedImage src = new BufferedImage(x, y, BufferedImage.TYPE_INT_ARGB); + BufferedImage dst = new BufferedImage(x, y, BufferedImage.TYPE_3BYTE_BGR); + + Graphics2D dstg2d = dst.createGraphics(); + dstg2d.setComposite(new Composite() { + @Override + public CompositeContext createContext( + ColorModel srcColorModel, + ColorModel dstColorModel, + RenderingHints hints) + { + return new CompositeContext() { + @Override + public void compose(Raster src, Raster dstIn, + WritableRaster dstOut) + { + // do nothing + } + @Override + public void dispose() { + } + }; + } + }); + Shape clip = new Ellipse2D.Double(x/4, y/4, x/2, y/2); + dstg2d.setClip(clip); + // This will throw a RasterFormatException if the bug is present. + dstg2d.drawImage(src, 0, 0, null); + } +}
--- a/test/sun/management/AgentCheckTest.java Tue Mar 20 11:00:54 2012 -0400 +++ b/test/sun/management/AgentCheckTest.java Wed Mar 28 10:24:20 2012 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 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,10 +35,10 @@ public static void main(String[] args){ String [][] testStrings = { {"agent.err.error", "", ""}, - {"jmxremote.ConnectorBootstrap.initialize", "", ""}, - {"jmxremote.ConnectorBootstrap.initialize.noAuthentication", "", ""}, - {"jmxremote.ConnectorBootstrap.initialize.ready", "Phony JMXServiceURL", ""}, - {"jmxremote.ConnectorBootstrap.initialize.password.readonly", "Phony passwordFileName", ""}, + {"jmxremote.ConnectorBootstrap.starting", "", ""}, + {"jmxremote.ConnectorBootstrap.noAuthentication", "", ""}, + {"jmxremote.ConnectorBootstrap.ready", "Phony JMXServiceURL", ""}, + {"jmxremote.ConnectorBootstrap.password.readonly", "Phony passwordFileName", ""}, {"jmxremote.AdaptorBootstrap.getTargetList.processing", "", ""}, {"jmxremote.AdaptorBootstrap.getTargetList.adding", "Phony target", ""}, {"jmxremote.AdaptorBootstrap.getTargetList.starting", "", ""},
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/management/jmxremote/startstop/JMXStartStopDoSomething.java Wed Mar 28 10:24:20 2012 -0400 @@ -0,0 +1,52 @@ +/* + * 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. + */ + +import java.io.RandomAccessFile; + +public class JMXStartStopDoSomething { + + + public void doSomething(){ + try { + for (int i=0; i < 10; ++i) { + RandomAccessFile f = new RandomAccessFile("/dev/null","r"); + int n = f.read(); + f.close(); + } + + } catch (Throwable e) { + System.err.println("Something bad happens:" +e); + } + } + + public static void main(String args[]) throws Exception { + System.err.println("main enter"); + int count = 1; + while(count > 0) { + JMXStartStopDoSomething p = new JMXStartStopDoSomething(); + p.doSomething(); + Thread.sleep(1); + } + // System.err.println("main exit"); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/management/jmxremote/startstop/JMXStartStopTest.java Wed Mar 28 10:24:20 2012 -0400 @@ -0,0 +1,181 @@ +/* + * 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. + */ + +import java.io.File; +import java.io.FileInputStream; +import java.io.FilenameFilter; +import java.io.IOException; +import java.io.InputStream; +import java.rmi.registry.LocateRegistry; +import java.rmi.registry.Registry; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Properties; +import java.util.Set; + +import javax.management.*; +import javax.management.remote.*; + +import sun.management.AgentConfigurationError; +import sun.management.jmxremote.ConnectorBootstrap; + +public class JMXStartStopTest { + + static boolean verbose = false; + + static void dbg_print(String msg){ + if (verbose) { + System.err.println("DBG: " +msg); + } + } + + static void dbg_print(String msg, Throwable ex){ + if (verbose) { + System.err.println("DBG: " + msg + " " + ex.getMessage() ); + ex.printStackTrace(System.err); + } + } + + public static int listMBeans(MBeanServerConnection server, ObjectName pattern, QueryExp query) + throws Exception { + + Set names = server.queryNames(pattern,query); + for (Iterator i=names.iterator(); i.hasNext(); ) { + ObjectName name = (ObjectName)i.next(); + MBeanInfo info = server.getMBeanInfo(name); + dbg_print("Got MBean: " + name); + + MBeanAttributeInfo[] attrs = info.getAttributes(); + if (attrs == null) + continue; + + for (int j=0; j<attrs.length; j++) { + if (attrs[j].isReadable()) { + Object o = server.getAttribute(name,attrs[j].getName()); + } + } + } + return names.size(); + } + + + public void run_local(String strPid) + throws Exception { + + String jmxUrlStr = null; + int pid = Integer.parseInt(strPid); + + try { + jmxUrlStr = sun.management.ConnectorAddressLink.importFrom(pid); + dbg_print("Local Service URL: " +jmxUrlStr); + if ( jmxUrlStr == null ) { + throw new Exception("No Service URL. Local agent not started?"); + } + + JMXServiceURL url = new JMXServiceURL(jmxUrlStr); + Map m = new HashMap(); + + JMXConnector c = JMXConnectorFactory.connect(url,m); + + MBeanServerConnection conn = c.getMBeanServerConnection(); + ObjectName pattern = new ObjectName("java.lang:type=Memory,*"); + + int count = listMBeans(conn,pattern,null); + if (count == 0) + throw new Exception("Expected at least one matching "+ "MBean for "+pattern); + + + } catch (IOException e) { + dbg_print("Cannot find process : " + pid); + throw e; + } + } + + public void run(String args[]) throws Exception { + + dbg_print("RmiRegistry lookup..."); + + int port = 4567; + if (args != null && args.length > 0) { + port = Integer.parseInt(args[0]); + } + dbg_print("Using port: " + port); + + int rmiPort = 0; + if (args != null && args.length > 1) { + rmiPort = Integer.parseInt(args[1]); + } + dbg_print("Using rmi port: " + rmiPort); + + Registry registry = LocateRegistry.getRegistry(port); + + // "jmxrmi" + String[] relist = registry.list(); + for (int i = 0; i < relist.length; ++i) { + dbg_print("Got registry: " + relist[i]); + } + + String jmxUrlStr = (rmiPort != 0) ? + String.format("service:jmx:rmi://localhost:%d/jndi/rmi://localhost:%d/jmxrmi", rmiPort, port) : + String.format("service:jmx:rmi:///jndi/rmi://localhost:%d/jmxrmi",port); + + JMXServiceURL url = new JMXServiceURL(jmxUrlStr); + Map m = new HashMap(); + + JMXConnector c = JMXConnectorFactory.connect(url,m); + + MBeanServerConnection conn = c.getMBeanServerConnection(); + ObjectName pattern = new ObjectName("java.lang:type=Memory,*"); + + int count = listMBeans(conn,pattern,null); + if (count == 0) + throw new Exception("Expected at least one matching "+ "MBean for "+pattern); + } + + + public static void main(String args[]) { + JMXStartStopTest manager = new JMXStartStopTest(); + try { + if (args!=null && args[0].equals("local")) { + manager.run_local(args[1]); + } else { + manager.run(args); + } + } catch (RuntimeException r) { + dbg_print("No connection: ", r); + System.out.println("NO_CONN"); + System.exit(1); + } catch (Throwable t) { + dbg_print("No connection: ", t); + System.out.println("NO_CONN"); + System.exit(2); + } + System.out.println("OK_CONN"); + System.exit(0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/management/jmxremote/startstop/JMXStartStopTest.sh Wed Mar 28 10:24:20 2012 -0400 @@ -0,0 +1,603 @@ +#!/bin/sh + +# Copyright (c) 2011, 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 7110104 +# @build JMXStartStopTest JMXStartStopDoSomething +# @run shell JMXStartStopTest.sh --jtreg --no-compile +# @summary No word Failed expected in the test output + +_verbose=no +_server=no +_jtreg=no +_compile=yes +_testsuite="01,02,03,04,05,06,07,08,09,10,11,12,13" +_port_one=50234 +_port_two=50235 + + +_testclasses=".classes" +_testsrc=`pwd` + +_logname=".classes/JMXStartStopTest_output.txt" + + +_compile(){ + + if [ ! -e ${_testclasses} ] + then + mkdir -p ${_testclasses} + fi + + rm -f ${_testclasses}/JMXStartStopTest.class + + # Compile testcase + ${TESTJAVA}/bin/javac -d ${_testclasses} JMXStartStopDoSomething.java JMXStartStopTest.java + + if [ ! -e ${_testclasses}/JMXStartStopTest.class ] + then + echo "ERROR: Can't compile" + exit -1 + fi +} + +_app_start(){ + + if [ "${_verbose}" = "yes" ] + then + echo "RUN: ${TESTJAVA}/bin/java -server $* -cp ${_testclasses} JMXStartStopDoSomething " + fi + ${TESTJAVA}/bin/java -server $* -cp ${_testclasses} JMXStartStopDoSomething >> ${_logname} 2>&1 & + sleep 1 + + pid=`_get_pid` + if [ "x${pid}" = "x" ] + then + echo "ERROR: Test app not started" + exit -1 + fi + +} + +_get_pid(){ + ${TESTJAVA}/bin/jps | sed -n "/JMXStartStopDoSomething/s/ .*//p" +} + +_app_stop(){ + pid=`_get_pid` + if [ "x${pid}" != "x" ] + then + kill $pid + fi + + # Stop on first failed test under jtreg + if [ "x$1" = "xFailed" -a "${_jtreg}" = "yes" ] + then + exit -1 + fi +} + +testme(){ + ${TESTJAVA}/bin/java -cp ${_testclasses} JMXStartStopTest $* +} + + +_jcmd(){ + if [ "${_verbose}" = "yes" ] + then + echo "RUN: ${TESTJAVA}/bin/jcmd JMXStartStopDoSomething $*" + ${TESTJAVA}/bin/jcmd JMXStartStopDoSomething $* + else + ${TESTJAVA}/bin/jcmd JMXStartStopDoSomething $* > /dev/null 2>/dev/null + fi +} + +_echo(){ + echo "$*" + echo "$*" >> ${_logname} +} + +# ============= TESTS ====================================== + +test_01(){ +# Run an app with JMX enabled stop it and +# restart on other port + + _echo "**** Test one ****" + + _app_start -Dcom.sun.management.jmxremote.port=$1 \ + -Dcom.sun.management.jmxremote.authenticate=false \ + -Dcom.sun.management.jmxremote.ssl=false + + res1=`testme $1` + + _jcmd ManagementAgent.stop + + res2=`testme $1` + + _jcmd ManagementAgent.start jmxremote.port=$2 + + res3=`testme $2` + + + if [ "${res1}" = "OK_CONN" -a "${res2}" = "NO_CONN" -a "${res3}" = "OK_CONN" ] + then + _echo "Passed" + else + _echo "Failed r1(OK):${res1} r2(NO):${res2} r3(OK):${res3}" + _app_stop "Failed" + fi + + _app_stop + +} + +test_02(){ +# Run an app without JMX enabled +# start JMX by jcmd + +_echo "**** Test two ****" +_app_start + +_jcmd ManagementAgent.start jmxremote.port=$1 jmxremote.authenticate=false jmxremote.ssl=false + +res1=`testme $1` + +if [ "${res1}" = "OK_CONN" ] +then + _echo "Passed" +else + _echo "Failed r1(OK):${res1}" + _app_stop "Failed" +fi + +_app_stop + +} + +test_03(){ +# Run an app without JMX enabled +# start JMX by jcmd on one port than on other one + +_echo "**** Test three ****" +_app_start + +_jcmd ManagementAgent.start jmxremote.port=$1 jmxremote.authenticate=false jmxremote.ssl=false + +# Second agent shouldn't start +_jcmd ManagementAgent.start jmxremote.port=$2 jmxremote.authenticate=false jmxremote.ssl=false + +# First agent should connect +res1=`testme $1` + +if [ "${res1}" = "OK_CONN" ] +then + _echo "Passed $1" +else + _echo "Failed r1(NO):${res1}" + _app_stop "Failed" +fi + +#Second agent shouldn't connect +res1=`testme $2` + +if [ "${res1}" = "NO_CONN" ] +then + _echo "Passed $2" +else + _echo "Failed r1(OK):${res1}" +fi + +_app_stop +} + +test_04(){ +# Run an app without JMX enabled +# start JMX by jcmd on one port, specify rmi port explicitly + +_echo "**** Test four ****" +_app_start + +_jcmd ManagementAgent.start jmxremote.port=$1 jmxremote.rmi.port=$2 jmxremote.authenticate=false jmxremote.ssl=false + +# First agent should connect +res1=`testme $1 $2` + +if [ "${res1}" = "OK_CONN" ] +then + _echo "Passed $1 $2" +else + _echo "Failed r1(NO):${res1}" + _app_stop "Failed" +fi + +_app_stop +} + +test_05(){ +# Run an app without JMX enabled, it will enable local server +# but should leave remote server disabled + +_echo "**** Test five ****" +_app_start + +_jcmd ManagementAgent.start jmxremote=1 + +# First agent should connect +res1=`testme $1` + +if [ "${res1}" = "NO_CONN" ] +then + _echo "Passed $1 $2" +else + _echo "Failed r1(OK):${res1}" + _app_stop "Failed" +fi + +_app_stop +} + +test_06(){ +# Run an app without JMX enabled +# start JMX by jcmd on one port, specify rmi port explicitly +# attempt to start it again +# 1) with the same port +# 2) with other port +# 3) attempt to stop it twice +# Check for valid messages in the output + +_echo "**** Test six ****" +_app_start + +_jcmd ManagementAgent.start jmxremote.port=$1 jmxremote.authenticate=false jmxremote.ssl=false + +# First agent should connect +res1=`testme $1 $2` + +if [ "${res1}" = "OK_CONN" ] +then + _echo "Passed $1 $2" +else + _echo "Failed r1(NO):${res1}" + _app_stop "Failed" +fi + +_jcmd ManagementAgent.start jmxremote.port=$1 jmxremote.authenticate=false jmxremote.ssl=false + +_jcmd ManagementAgent.start jmxremote.port=$2 jmxremote.authenticate=false jmxremote.ssl=false + +_jcmd ManagementAgent.stop + +_jcmd ManagementAgent.stop + +_jcmd ManagementAgent.start jmxremote.port=22 jmxremote.rmi.port=$2 jmxremote.authenticate=false jmxremote.ssl=false + +_app_stop +} + +test_07(){ +# Run an app without JMX enabled, but with some properties set +# in command line. +# make sure these properties overriden corectly + +_echo "**** Test seven ****" + +_app_start -Dcom.sun.management.jmxremote.authenticate=false \ + -Dcom.sun.management.jmxremote.ssl=true + +res1=`testme $1` + +_jcmd ManagementAgent.start jmxremote.port=$2 jmxremote.authenticate=false jmxremote.ssl=false + +res2=`testme $2` + + +if [ "${res1}" = "NO_CONN" -a "${res2}" = "OK_CONN" ] +then + echo "Passed" +else + _echo "Failed r1(NO):${res1} r2(OK):${res2}" + _app_stop "Failed" +fi + +_app_stop +} + +test_08(){ +# Run an app with JMX enabled and with some properties set +# in command line. +# stop JMX agent and then start it again with different property values +# make sure these properties overriden corectly + +_echo "**** Test eight ****" + +_app_start -Dcom.sun.management.jmxremote.port=$1 \ + -Dcom.sun.management.jmxremote.authenticate=false \ + -Dcom.sun.management.jmxremote.ssl=true + +res1=`testme $1` + +_jcmd ManagementAgent.stop + +res2=`testme $1` + +_jcmd ManagementAgent.start jmxremote.port=$2 jmxremote.authenticate=false jmxremote.ssl=false + +res3=`testme $2` + + +if [ "${res1}" = "NO_CONN" -a "${res2}" = "NO_CONN" -a "${res3}" = "OK_CONN" ] +then + _echo "Passed" +else + _echo "Failed r1(NO):${res1} r2(NO):${res2} r3(OK):${res3}" + _app_stop "Failed" +fi + +_app_stop +} + +test_09(){ +# Run an app with JMX enabled and with some properties set +# in command line. +# stop JMX agent and then start it again with different property values +# specifing some property in management config file and some of them +# in command line +# make sure these properties overriden corectly + +_echo "**** Test nine ****" + +_app_start -Dcom.sun.management.config.file=${_testsrc}/management_cl.properties \ + -Dcom.sun.management.jmxremote.authenticate=false + +res1=`testme $1` + +_jcmd ManagementAgent.stop + +res2=`testme $1` + +_jcmd ManagementAgent.start config.file=${_testsrc}/management_jcmd.properties \ + jmxremote.authenticate=false jmxremote.port=$2 + +res3=`testme $2` + +if [ "${res1}" = "NO_CONN" -a "${res2}" = "NO_CONN" -a "${res3}" = "OK_CONN" ] +then + _echo "Passed" +else + _echo "Failed r1(NO):${res1} r2(NO):${res2} r3(OK):${res3}" + _app_stop "Failed" +fi + +_app_stop +} + +test_10(){ +# Run an app with JMX enabled and with some properties set +# in command line. +# stop JMX agent and then start it again with different property values +# stop JMX agent again and then start it without property value +# make sure these properties overriden corectly + +_echo "**** Test ten ****" + +_app_start -Dcom.sun.management.jmxremote.port=$1 \ + -Dcom.sun.management.jmxremote.authenticate=false \ + -Dcom.sun.management.jmxremote.ssl=true + +res1=`testme $1` + +_jcmd ManagementAgent.stop +_jcmd ManagementAgent.start jmxremote.ssl=false jmxremote.port=$1 + + +res2=`testme $1` + +_jcmd ManagementAgent.stop +_jcmd ManagementAgent.start jmxremote.port=$1 + +res3=`testme $1` + +if [ "${res1}" = "NO_CONN" -a "${res2}" = "OK_CONN" -a "${res3}" = "NO_CONN" ] +then + _echo "Passed" +else + _echo "Failed r1(NO):${res1} r2(OK):${res2} r3(NO):${res3}" + _app_stop "Failed" +fi + +_app_stop +} + +test_11(){ +# Run an app with JMX enabled +# stop remote agent +# make sure local agent is not affected + +_echo "**** Test eleven ****" + +_app_start -Dcom.sun.management.jmxremote.port=$2 \ + -Dcom.sun.management.jmxremote.authenticate=false \ + -Dcom.sun.management.jmxremote.ssl=false + +res1=`testme $2` + +_jcmd ManagementAgent.stop + +pid=`${TESTJAVA}/bin/jps | sed -n "/JMXStartStopDoSomething/s/ .*//p"` +res2=`testme local ${pid}` + +if [ "${res1}" = "OK_CONN" -a "${res2}" = "OK_CONN" ] +then + _echo "Passed" +else + _echo "Failed r1(OK):${res1} r2(OK):${res2}" + _app_stop "Failed" +fi + +_app_stop +} + +test_12(){ +# Run an app with JMX disabled +# start local agent only + +_echo "**** Test twelve ****" + +_app_start + +res1=`testme $1` + +_jcmd ManagementAgent.start_local + +pid=`_get_pid` +if [ "x${pid}" = "x" ] +then + res2="NO_CONN" +else + res2=`testme local ${pid}` +fi + +if [ "${res1}" = "NO_CONN" -a "${res2}" = "OK_CONN" ] +then + _echo "Passed" +else + _echo "Failed r1(NO):${res1} r2(OK):${res2}" + _app_stop "Failed" +fi + +_app_stop +} + +test_13(){ +# Run an app with -javaagent make sure it works as expected - system properties are ignored + +_echo "**** Test 13 ****" + +AGENT="${TESTJAVA}/jre/lib/management-agent.jar" +if [ ! -f ${AGENT} ] + then + AGENT="${TESTJAVA}/lib/management-agent.jar" +fi + +_app_start -javaagent:${AGENT}=com.sun.management.jmxremote.port=$1,com.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false + +res1=`testme $1` + +if [ "${res1}" = "NO_CONN" ] +then + _echo "Passed" +else + _echo "Failed r1(NO):${res1}" + _app_stop "Failed" +fi + +_app_stop +} + + +#============== Server tests ======================= + +server_test_01(){ + + _echo "**** Server test one ****" + + _app_start -Dcom.sun.management.jmxremote.port=$1 \ + -Dcom.sun.management.jmxremote.rmi.port=$2 \ + -Dcom.sun.management.jmxremote.authenticate=false \ + -Dcom.sun.management.jmxremote.ssl=false + +} + + +# ============= MAIN ======================================= + +if [ "x${TESTJAVA}" = "x" ] +then + echo "TESTJAVA env have to be set" + exit +fi + +if [ ! -x "${TESTJAVA}/bin/jcmd" ] +then + echo "${TESTJAVA}/bin/jcmd" + echo "Doesn't exist or not an executable" + + if [ "${_verbose}" != "yes" ] + then + exit + fi +fi + + +#------------------------------------------------------------------------------ +# reading parameters + +for parm in "$@" +do + case $parm in + --verbose) _verbose=yes ;; + --server) _server=yes ;; + --jtreg) _jtreg=yes ;; + --no-compile) _compile=no ;; + --testsuite=*) _testsuite=`_echo $parm | sed "s,^--.*=\(.*\),\1,"` ;; + --port-one=*) _port_one=`_echo $parm | sed "s,^--.*=\(.*\),\1,"` ;; + --port-two=*) _port_two=`_echo $parm | sed "s,^--.*=\(.*\),\1,"` ;; + *) + echo "Undefined parameter $parm. Try --help for help" + exit + ;; + esac +done + +if [ ${_compile} = "yes" ] +then + _compile +fi + +if [ ${_jtreg} = "yes" ] +then + _testclasses=${TESTCLASSES} + _testsrc=${TESTSRC} + _logname="JMXStartStopTest_output.txt" +fi + +rm -f ${_logname} + +# Start server mode tests +# All of them require manual cleanup +if [ "x${_server}" = "xyes" ] +then + + server_test_01 ${_port_one} ${_port_two} + +else + + # Local mode tests + for i in `echo ${_testsuite} | sed -e "s/,/ /g"` + do + test_${i} ${_port_one} ${_port_two} + done + +fi +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/management/jmxremote/startstop/REMOTE_TESTING.txt Wed Mar 28 10:24:20 2012 -0400 @@ -0,0 +1,11 @@ +1. Setup two hosts +2. Make sure tcp connection between them works +3. run tcpdump -i <interface> host <host2_name> and 'tcp[13] & 2!=0' + on host 1 +4. run JMXStartStopTest.sh --server on host2 +5. run jconsole on host1 +6. connect jconsole to host2:50234 + Make sure jconsole works + Make sure only host2.50234 and host2.50235 appears in tcpdump output. + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/management/jmxremote/startstop/management_cl.properties Wed Mar 28 10:24:20 2012 -0400 @@ -0,0 +1,2 @@ +com.sun.management.jmxremote.ssl=true +com.sun.management.internal.read_from_config_file_cl=true
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/management/jmxremote/startstop/management_jcmd.properties Wed Mar 28 10:24:20 2012 -0400 @@ -0,0 +1,3 @@ +com.sun.management.jmxremote.ssl=false +jmxremote.authenticate=true +com.sun.management.internal.read_from_config_file_jcmd=true
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/security/krb5/ktab/FileKeyTab.java Wed Mar 28 10:24:20 2012 -0400 @@ -0,0 +1,58 @@ +/* + * 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 7144530 + * @summary KeyTab.getInstance(String) no longer handles keyTabNames with "file:" prefix + */ +import java.io.File; +import sun.security.krb5.PrincipalName; +import sun.security.krb5.internal.ktab.KeyTab; + +public class FileKeyTab { + public static void main(String[] args) throws Exception { + String name = "ktab"; + KeyTab kt = KeyTab.create(name); + kt.addEntry(new PrincipalName("a@A"), "x".toCharArray(), 1, true); + kt.save(); + check(name); + check("FILE:" + name); + + name = new File(name).getAbsolutePath().toString(); + + check(name); + check("FILE:" + name); + + // The bug reporter uses this style, should only work for + // absolute path + check("FILE:/" + name); + } + + static void check(String file) throws Exception { + System.out.println("Checking for " + file + "..."); + KeyTab kt2 = KeyTab.getInstance(file); + if (kt2.isMissing()) { + throw new Exception("FILE:ktab cannot be loaded"); + } + } +}
--- a/test/sun/security/pkcs11/KeyStore/SecretKeysBasic.sh Tue Mar 20 11:00:54 2012 -0400 +++ b/test/sun/security/pkcs11/KeyStore/SecretKeysBasic.sh Wed Mar 28 10:24:20 2012 -0400 @@ -1,5 +1,5 @@ # -# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2008, 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 @@ -95,7 +95,6 @@ ;; esac -TOKENS="nss solaris" CP="cp -f" RM="rm -rf" MKDIR="mkdir -p"
--- a/test/tools/launcher/Arrrghs.java Tue Mar 20 11:00:54 2012 -0400 +++ b/test/tools/launcher/Arrrghs.java Wed Mar 28 10:24:20 2012 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -24,9 +24,9 @@ /** * @test * @bug 5030233 6214916 6356475 6571029 6684582 6742159 4459600 6758881 6753938 - * 6894719 6968053 7067922 + * 6894719 6968053 * @summary Argument parsing validation. - * @compile -XDignore.symbol.file Arrrghs.java TestHelper.java + * @compile -XDignore.symbol.file Arrrghs.java * @run main Arrrghs */ @@ -38,7 +38,7 @@ import java.io.InputStreamReader; import java.util.Map; -public class Arrrghs { +public class Arrrghs extends TestHelper { private Arrrghs(){} /** * This class provides various tests for arguments processing. @@ -62,7 +62,7 @@ * SIGH, On Windows all strings are quoted, we need to unwrap it */ private static String removeExtraQuotes(String in) { - if (TestHelper.isWindows) { + if (isWindows) { // Trim the string and remove the enclosed quotes if any. in = in.trim(); if (in.startsWith("\"") && in.endsWith("\"")) { @@ -82,7 +82,7 @@ String in = rd.readLine(); while (in != null) { - if (TestHelper.debug) System.out.println(in); + if (debug) System.out.println(in); if (in.startsWith(Cookie)) { String detectedArgument = removeExtraQuotes(in.substring(Cookie.length())); if (expectedArguments.equals(detectedArgument)) { @@ -94,7 +94,7 @@ detectedArgument + "'"); } // Return the value asap if not in debug mode. - if (!TestHelper.debug) { + if (!debug) { rd.close(); istream.close(); return retval; @@ -125,7 +125,7 @@ * Quoting could cause dissimilar testArguments and expected arguments. */ static int doTest(String testArguments, String expectedPattern) { - ProcessBuilder pb = new ProcessBuilder(TestHelper.javaCmd, + ProcessBuilder pb = new ProcessBuilder(javaCmd, VersionStr, testArguments); Map<String, String> env = pb.environment(); @@ -146,47 +146,47 @@ * These tests require that a JVM (any JVM) be installed in the system registry. * If none is installed, skip this test. */ - TestHelper.TestResult tr = - TestHelper.doExec(TestHelper.javaCmd, VersionStr, "-version"); + TestResult tr = doExec(javaCmd, VersionStr, "-version"); if (!tr.isOK()) { System.err.println("Warning:Argument Passing Tests were skipped, " + "no java found in system registry."); return; } + // Basic test - TestHelper.testExitValue += doTest("-a -b -c -d"); + testExitValue += doTest("-a -b -c -d"); // Basic test with many spaces - TestHelper.testExitValue += doTest("-a -b -c -d"); + testExitValue += doTest("-a -b -c -d"); // Quoted whitespace does matter ? - TestHelper.testExitValue += doTest("-a \"\"-b -c\"\" -d"); + testExitValue += doTest("-a \"\"-b -c\"\" -d"); // Escaped quotes outside of quotes as literals - TestHelper.testExitValue += doTest("-a \\\"-b -c\\\" -d"); + testExitValue += doTest("-a \\\"-b -c\\\" -d"); // Check for escaped quotes inside of quotes as literal - TestHelper.testExitValue += doTest("-a \"-b \\\"stuff\\\"\" -c -d"); + testExitValue += doTest("-a \"-b \\\"stuff\\\"\" -c -d"); // A quote preceeded by an odd number of slashes is a literal quote - TestHelper.testExitValue += doTest("-a -b\\\\\\\" -c -d"); + testExitValue += doTest("-a -b\\\\\\\" -c -d"); // A quote preceeded by an even number of slashes is a literal quote // see 6214916. - TestHelper.testExitValue += doTest("-a -b\\\\\\\\\" -c -d"); + testExitValue += doTest("-a -b\\\\\\\\\" -c -d"); // Make sure that whitespace doesn't interfere with the removal of the // appropriate tokens. (space-tab-space preceeds -jre-restict-search). - TestHelper.testExitValue += doTest("-a -b \t -jre-restrict-search -c -d","-a -b -c -d"); + testExitValue += doTest("-a -b \t -jre-restrict-search -c -d","-a -b -c -d"); // Make sure that the mJRE tokens being stripped, aren't stripped if // they happen to appear as arguments to the main class. - TestHelper.testExitValue += doTest("foo -version:1.1+"); + testExitValue += doTest("foo -version:1.1+"); System.out.println("Completed arguments quoting tests with " + - TestHelper.testExitValue + " errors"); + testExitValue + " errors"); } /* @@ -194,156 +194,167 @@ */ static void runBasicErrorMessageTests() { // Tests for 5030233 - TestHelper.TestResult tr = TestHelper.doExec(TestHelper.javaCmd, "-cp"); + TestResult tr = doExec(javaCmd, "-cp"); tr.checkNegative(); tr.isNotZeroOutput(); System.out.println(tr); - tr = TestHelper.doExec(TestHelper.javaCmd, "-classpath"); + tr = doExec(javaCmd, "-classpath"); tr.checkNegative(); tr.isNotZeroOutput(); System.out.println(tr); - tr = TestHelper.doExec(TestHelper.javaCmd, "-jar"); + tr = doExec(javaCmd, "-jar"); tr.checkNegative(); tr.isNotZeroOutput(); System.out.println(tr); - tr = TestHelper.doExec(TestHelper.javacCmd, "-cp"); + tr = doExec(javacCmd, "-cp"); tr.checkNegative(); tr.isNotZeroOutput(); System.out.println(tr); // Test for 6356475 "REGRESSION:"java -X" from cmdline fails" - tr = TestHelper.doExec(TestHelper.javaCmd, "-X"); + tr = doExec(javaCmd, "-X"); tr.checkPositive(); tr.isNotZeroOutput(); System.out.println(tr); - tr = TestHelper.doExec(TestHelper.javaCmd, "-help"); + tr = doExec(javaCmd, "-help"); tr.checkPositive(); tr.isNotZeroOutput(); System.out.println(tr); // 6753938, test for non-negative exit value for an incorrectly formed // command line, '% java' - tr = TestHelper.doExec(TestHelper.javaCmd); + tr = doExec(javaCmd); tr.checkNegative(); tr.isNotZeroOutput(); System.out.println(tr); // 6753938, test for non-negative exit value for an incorrectly formed // command line, '% java -Xcomp' - tr = TestHelper.doExec(TestHelper.javaCmd, "-Xcomp"); + tr = doExec(javaCmd, "-Xcomp"); tr.checkNegative(); tr.isNotZeroOutput(); System.out.println(tr); } /* - * A set of tests which tests various dispositions of the main method. + * Tests various dispositions of the main method, these tests are limited + * to English locales as they check for error messages that are localized. */ static void runMainMethodTests() throws FileNotFoundException { - TestHelper.TestResult tr = null; + if (!isEnglishLocale()) { + return; + } + + TestResult tr = null; // a missing class - TestHelper.createJar("MIA", new File("some.jar"), new File("Foo"), + createJar("MIA", new File("some.jar"), new File("Foo"), (String[])null); - tr = TestHelper.doExec(TestHelper.javaCmd, "-jar", "some.jar"); + tr = doExec(javaCmd, "-jar", "some.jar"); tr.contains("Error: Could not find or load main class MIA"); System.out.println(tr); // use classpath to check - tr = TestHelper.doExec(TestHelper.javaCmd, "-cp", "some.jar", "MIA"); + tr = doExec(javaCmd, "-cp", "some.jar", "MIA"); tr.contains("Error: Could not find or load main class MIA"); System.out.println(tr); // incorrect method access - TestHelper.createJar(new File("some.jar"), new File("Foo"), + createJar(new File("some.jar"), new File("Foo"), "private static void main(String[] args){}"); - tr = TestHelper.doExec(TestHelper.javaCmd, "-jar", "some.jar"); + tr = doExec(javaCmd, "-jar", "some.jar"); tr.contains("Error: Main method not found in class Foo"); System.out.println(tr); // use classpath to check - tr = TestHelper.doExec(TestHelper.javaCmd, "-cp", "some.jar", "Foo"); + tr = doExec(javaCmd, "-cp", "some.jar", "Foo"); tr.contains("Error: Main method not found in class Foo"); System.out.println(tr); // incorrect return type - TestHelper.createJar(new File("some.jar"), new File("Foo"), + createJar(new File("some.jar"), new File("Foo"), "public static int main(String[] args){return 1;}"); - tr = TestHelper.doExec(TestHelper.javaCmd, "-jar", "some.jar"); + tr = doExec(javaCmd, "-jar", "some.jar"); tr.contains("Error: Main method must return a value of type void in class Foo"); System.out.println(tr); // use classpath to check - tr = TestHelper.doExec(TestHelper.javaCmd, "-cp", "some.jar", "Foo"); + tr = doExec(javaCmd, "-cp", "some.jar", "Foo"); tr.contains("Error: Main method must return a value of type void in class Foo"); System.out.println(tr); // incorrect parameter type - TestHelper.createJar(new File("some.jar"), new File("Foo"), + createJar(new File("some.jar"), new File("Foo"), "public static void main(Object[] args){}"); - tr = TestHelper.doExec(TestHelper.javaCmd, "-jar", "some.jar"); + tr = doExec(javaCmd, "-jar", "some.jar"); tr.contains("Error: Main method not found in class Foo"); System.out.println(tr); // use classpath to check - tr = TestHelper.doExec(TestHelper.javaCmd, "-cp", "some.jar", "Foo"); + tr = doExec(javaCmd, "-cp", "some.jar", "Foo"); tr.contains("Error: Main method not found in class Foo"); System.out.println(tr); // incorrect method type - non-static - TestHelper.createJar(new File("some.jar"), new File("Foo"), + createJar(new File("some.jar"), new File("Foo"), "public void main(String[] args){}"); - tr = TestHelper.doExec(TestHelper.javaCmd, "-jar", "some.jar"); + tr = doExec(javaCmd, "-jar", "some.jar"); tr.contains("Error: Main method is not static in class Foo"); System.out.println(tr); // use classpath to check - tr = TestHelper.doExec(TestHelper.javaCmd, "-cp", "some.jar", "Foo"); + tr = doExec(javaCmd, "-cp", "some.jar", "Foo"); tr.contains("Error: Main method is not static in class Foo"); System.out.println(tr); // amongst a potpourri of kindred main methods, is the right one chosen ? - TestHelper.createJar(new File("some.jar"), new File("Foo"), + createJar(new File("some.jar"), new File("Foo"), "void main(Object[] args){}", "int main(Float[] args){return 1;}", "private void main() {}", "private static void main(int x) {}", "public int main(int argc, String[] argv) {return 1;}", "public static void main(String[] args) {System.out.println(\"THE_CHOSEN_ONE\");}"); - tr = TestHelper.doExec(TestHelper.javaCmd, "-jar", "some.jar"); + tr = doExec(javaCmd, "-jar", "some.jar"); tr.contains("THE_CHOSEN_ONE"); System.out.println(tr); // use classpath to check - tr = TestHelper.doExec(TestHelper.javaCmd, "-cp", "some.jar", "Foo"); + tr = doExec(javaCmd, "-cp", "some.jar", "Foo"); tr.contains("THE_CHOSEN_ONE"); System.out.println(tr); // test for extraneous whitespace in the Main-Class attribute - TestHelper.createJar(" Foo ", new File("some.jar"), new File("Foo"), + createJar(" Foo ", new File("some.jar"), new File("Foo"), "public static void main(String... args){}"); - tr = TestHelper.doExec(TestHelper.javaCmd, "-jar", "some.jar"); + tr = doExec(javaCmd, "-jar", "some.jar"); tr.checkPositive(); System.out.println(tr); } - // tests 6968053, ie. we turn on the -Xdiag (for now) flag and check if - // the suppressed stack traces are exposed. + /* + * tests 6968053, ie. we turn on the -Xdiag (for now) flag and check if + * the suppressed stack traces are exposed, ignore these tests for localized + * locales, limiting to English only. + */ static void runDiagOptionTests() throws FileNotFoundException { - TestHelper.TestResult tr = null; + if (!isEnglishLocale()) { // only english version + return; + } + TestResult tr = null; // a missing class - TestHelper.createJar("MIA", new File("some.jar"), new File("Foo"), + createJar("MIA", new File("some.jar"), new File("Foo"), (String[])null); - tr = TestHelper.doExec(TestHelper.javaCmd, "-Xdiag", "-jar", "some.jar"); + tr = doExec(javaCmd, "-Xdiag", "-jar", "some.jar"); tr.contains("Error: Could not find or load main class MIA"); tr.contains("java.lang.ClassNotFoundException: MIA"); System.out.println(tr); // use classpath to check - tr = TestHelper.doExec(TestHelper.javaCmd, "-Xdiag", "-cp", "some.jar", "MIA"); + tr = doExec(javaCmd, "-Xdiag", "-cp", "some.jar", "MIA"); tr.contains("Error: Could not find or load main class MIA"); tr.contains("java.lang.ClassNotFoundException: MIA"); System.out.println(tr); // a missing class on the classpath - tr = TestHelper.doExec(TestHelper.javaCmd, "-Xdiag", "NonExistentClass"); + tr = doExec(javaCmd, "-Xdiag", "NonExistentClass"); tr.contains("Error: Could not find or load main class NonExistentClass"); tr.contains("java.lang.ClassNotFoundException: NonExistentClass"); System.out.println(tr); @@ -351,43 +362,33 @@ static void test6894719() { // test both arguments to ensure they exist - TestHelper.TestResult tr = null; - tr = TestHelper.doExec(TestHelper.javaCmd, + TestResult tr = null; + tr = doExec(javaCmd, "-no-jre-restrict-search", "-version"); tr.checkPositive(); System.out.println(tr); - tr = TestHelper.doExec(TestHelper.javaCmd, + tr = doExec(javaCmd, "-jre-restrict-search", "-version"); tr.checkPositive(); System.out.println(tr); } - static void test7067922() { - // a missing manifest entry 7067922 - TestHelper.TestResult tr = null; - TestHelper.createJar("cvf", "missingmainentry.jar", "."); - tr = TestHelper.doExec(TestHelper.javaCmd, "-jar", "missingmainentry.jar"); - tr.contains("no main manifest attribute"); - System.out.println(tr); - } - /** * @param args the command line arguments * @throws java.io.FileNotFoundException */ public static void main(String[] args) throws FileNotFoundException { - if (TestHelper.debug) { + if (debug) { System.out.println("Starting Arrrghs tests"); } quoteParsingTests(); runBasicErrorMessageTests(); runMainMethodTests(); test6894719(); - test7067922(); runDiagOptionTests(); - if (TestHelper.testExitValue > 0) { - System.out.println("Total of " + TestHelper.testExitValue + " failed"); + if (testExitValue > 0) { + System.out.println("Total of " + testExitValue + " failed"); System.exit(1); } else { System.out.println("All tests pass");
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/launcher/MainClassAttributeTest.java Wed Mar 28 10:24:20 2012 -0400 @@ -0,0 +1,104 @@ +/* + * 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 7067922 + * @author sogoel + * @summary Test negative scenarios for main class attribute + * @compile -XDignore.symbol.file MainClassAttributeTest.java + * @run main MainClassAttributeTest + */ + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/* + * This class tests negative scenarios for Main class entry in jar file + * An error should be thrown for each of the test cases when such a jar + * is executed. These tests can only run on non-localized locales, thus + * only English is seleced and will pass vacuosly for other locales. + * + */ + +public class MainClassAttributeTest extends TestHelper { + + static void runTest(File jarFile, String expectedErrorMessage) { + TestResult tr = doExec(TestHelper.javaCmd, + "-jar", jarFile.getAbsolutePath()); + if (isEnglishLocale() && !tr.contains(expectedErrorMessage)) { + System.out.println(tr); + throw new RuntimeException("expected string not found"); + } + if (tr.isOK()) { + System.out.println(tr); + throw new RuntimeException("test exit with status 0"); + } + } + + // Missing manifest entry + static void test1() throws Exception { + File jarFile = new File("missingmainentry.jar"); + createJar("cvf", jarFile.getName(), "."); + runTest(jarFile, "no main manifest attribute"); + } + + // Entry point in manifest file has .class extension + static void test2() throws FileNotFoundException { + File jarFile = new File("extensionmainentry.jar"); + createJar("Foo.class", jarFile, new File("Foo"), (String[])null); + runTest(jarFile, "Error: Could not find or load main class"); + } + + // Entry point in manifest file is misspelled + static void test3() throws FileNotFoundException { + File jarFile = new File("misspelledmainentry.jar"); + createJar("FooMIS", jarFile, new File("Foo"), (String[])null); + runTest(jarFile, "Error: Could not find or load main class"); + } + + // Main-Class attribute is misspelled in manifest file + static void test4() throws Exception { + File jarFile = new File("misspelledMainAttribute.jar"); + File manifestFile = new File("manifest.txt"); + try { + List<String> contents = new ArrayList<>(); + contents.add("MainClassName: Foo"); + createFile(manifestFile, contents); + } catch (IOException e) { + throw new Exception("Creation of manifest file for test3 failed"); + } + createJar("-cmf", manifestFile.getName(), jarFile.getName()); + runTest(jarFile, "no main manifest attribute"); + } + + public static void main(String[] args) throws Throwable { + test1(); + test2(); + test3(); + test4(); + } +}
--- a/test/tools/launcher/Settings.java Tue Mar 20 11:00:54 2012 -0400 +++ b/test/tools/launcher/Settings.java Wed Mar 28 10:24:20 2012 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 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 @@ -25,7 +25,7 @@ /* * @test - * @bug 6994753 + * @bug 6994753 7123582 * @summary tests -XshowSettings options * @compile -XDignore.symbol.file Settings.java TestHelper.java * @run main Settings @@ -75,14 +75,14 @@ static void runTestOptionDefault() throws IOException { TestHelper.TestResult tr = null; tr = TestHelper.doExec(TestHelper.javaCmd, "-Xms64m", "-Xmx512m", - "-Xss128k", "-XshowSettings", "-jar", testJar.getAbsolutePath()); + "-Xss256k", "-XshowSettings", "-jar", testJar.getAbsolutePath()); containsAllOptions(tr); if (!tr.isOK()) { System.out.println(tr.status); throw new RuntimeException("test fails"); } tr = TestHelper.doExec(TestHelper.javaCmd, "-Xms65536k", "-Xmx712m", - "-Xss122880", "-XshowSettings", "-jar", testJar.getAbsolutePath()); + "-Xss256000", "-XshowSettings", "-jar", testJar.getAbsolutePath()); containsAllOptions(tr); if (!tr.isOK()) { System.out.println(tr.status); @@ -129,6 +129,17 @@ checkNoContains(tr, LOCALE_SETTINGS); checkContains(tr, "Unrecognized option: -XshowSettingsBadOption"); } + + static void runTest7123582() throws IOException { + TestHelper.TestResult tr = null; + tr = TestHelper.doExec(TestHelper.javaCmd, "-XshowSettings", "-version"); + if (!tr.isOK()) { + System.out.println(tr.status); + throw new RuntimeException("test fails"); + } + containsAllOptions(tr); + } + public static void main(String... args) { try { runTestOptionAll(); @@ -137,6 +148,7 @@ runTestOptionProperty(); runTestOptionLocale(); runTestBadOptions(); + runTest7123582(); } catch (IOException ioe) { throw new RuntimeException(ioe); }
--- a/test/tools/launcher/TestHelper.java Tue Mar 20 11:00:54 2012 -0400 +++ b/test/tools/launcher/TestHelper.java Wed Mar 28 10:24:20 2012 -0400 @@ -29,6 +29,7 @@ import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintStream; +import java.nio.charset.Charset; import java.nio.file.attribute.BasicFileAttributes; import java.nio.file.Files; import java.nio.file.FileVisitResult; @@ -36,20 +37,26 @@ import java.nio.file.Path; import java.util.ArrayList; import java.util.List; +import java.util.Locale; import java.util.Map; import javax.tools.JavaCompiler; import javax.tools.ToolProvider; import static java.nio.file.StandardCopyOption.*; +import static java.nio.file.StandardOpenOption.*; /** * This class provides some common utilities for the launcher tests. */ -public enum TestHelper { - INSTANCE; +public class TestHelper { + // commonly used jtreg constants + static final File TEST_CLASSES_DIR; + static final File TEST_SOURCES_DIR; + static final String JAVAHOME = System.getProperty("java.home"); static final boolean isSDK = JAVAHOME.endsWith("jre"); static final String javaCmd; + static final String javawCmd; static final String java64Cmd; static final String javacCmd; static final JavaCompiler compiler; @@ -70,13 +77,30 @@ static final boolean isDualMode = isSolaris; static final boolean isSparc = System.getProperty("os.arch").startsWith("sparc"); + // make a note of the golden default locale + static final Locale DefaultLocale = Locale.getDefault(); + static final String JAVA_FILE_EXT = ".java"; static final String CLASS_FILE_EXT = ".class"; static final String JAR_FILE_EXT = ".jar"; + static final String JLDEBUG_KEY = "_JAVA_LAUNCHER_DEBUG"; + static final String EXPECTED_MARKER = "TRACER_MARKER:About to EXEC"; static int testExitValue = 0; static { + String tmp = System.getProperty("test.classes", null); + if (tmp == null) { + throw new Error("property test.classes not defined ??"); + } + TEST_CLASSES_DIR = new File(tmp).getAbsoluteFile(); + + tmp = System.getProperty("test.src", null); + if (tmp == null) { + throw new Error("property test.src not defined ??"); + } + TEST_SOURCES_DIR = new File(tmp).getAbsoluteFile(); + if (is64Bit && is32Bit) { throw new RuntimeException("arch model cannot be both 32 and 64 bit"); } @@ -91,15 +115,29 @@ : new File(binDir, "java"); javaCmd = javaCmdFile.getAbsolutePath(); if (!javaCmdFile.canExecute()) { - throw new RuntimeException("java <" + TestHelper.javaCmd + "> must exist"); + throw new RuntimeException("java <" + TestHelper.javaCmd + + "> must exist and should be executable"); } File javacCmdFile = (isWindows) ? new File(binDir, "javac.exe") : new File(binDir, "javac"); javacCmd = javacCmdFile.getAbsolutePath(); + + if (isWindows) { + File javawCmdFile = new File(binDir, "javaw.exe"); + javawCmd = javawCmdFile.getAbsolutePath(); + if (!javawCmdFile.canExecute()) { + throw new RuntimeException("java <" + javawCmd + + "> must exist and should be executable"); + } + } else { + javawCmd = null; + } + if (!javacCmdFile.canExecute()) { - throw new RuntimeException("java <" + javacCmd + "> must exist"); + throw new RuntimeException("java <" + javacCmd + + "> must exist and should be executable"); } if (isSolaris) { File sparc64BinDir = new File(binDir,isSparc ? "sparcv9" : "amd64"); @@ -168,6 +206,19 @@ } /* + * A convenience method to compile java files. + */ + static void compile(String... compilerArgs) { + if (compiler.run(null, null, null, compilerArgs) != 0) { + String sarg = ""; + for (String x : compilerArgs) { + sarg.concat(x + " "); + } + throw new Error("compilation failed: " + sarg); + } + } + + /* * A generic jar file creator to create a java file, compile it * and jar it up, a specific Main-Class entry name in the * manifest can be specified or a null to use the sole class file name @@ -226,6 +277,11 @@ Files.copy(src.toPath(), dst.toPath(), COPY_ATTRIBUTES, REPLACE_EXISTING); } + static void createFile(File outFile, List<String> content) throws IOException { + Files.write(outFile.getAbsoluteFile().toPath(), content, + Charset.defaultCharset(), CREATE_NEW); + } + static void recursiveDelete(File target) throws IOException { if (!target.exists()) { return; @@ -308,6 +364,10 @@ }; } + static boolean isEnglishLocale() { + return Locale.getDefault().getLanguage().equals("en"); + } + /* * A class to encapsulate the test results and stuff, with some ease * of use methods to check the test results.