提交 cd6e598c 编写于 作者: M mfang

Merge

...@@ -197,7 +197,7 @@ examples_help: ...@@ -197,7 +197,7 @@ examples_help:
# #
# 'all' target intro # 'all' target intro
# #
all:: all::
@$(ECHO) $(PLATFORM) $(ARCH) $(RELEASE) build started: $(shell $(DATE) '+%y-%m-%d %H:%M') @$(ECHO) $(PLATFORM) $(ARCH) $(RELEASE) build started: $(shell $(DATE) '+%y-%m-%d %H:%M')
# Just in case anyone uses this old name, same as 'build' # Just in case anyone uses this old name, same as 'build'
...@@ -234,7 +234,17 @@ all build:: sanity-all post-sanity-all ...@@ -234,7 +234,17 @@ all build:: sanity-all post-sanity-all
SUBDIRS = tools java javax sun com SUBDIRS = tools java javax sun com
SUBDIRS_tools = launchers SUBDIRS_tools = launchers
SUBDIRS_misc = org sunw jpda mkdemo mksample SUBDIRS_misc = org sunw jpda
# demos
ifndef NO_DEMOS
SUBDIRS_misc += mkdemo
endif
# samples
ifndef NO_SAMPLES
SUBDIRS_misc += mksample
endif
# Alternate classes implementation # Alternate classes implementation
ifndef OPENJDK ifndef OPENJDK
...@@ -383,4 +393,3 @@ include jprt.gmk ...@@ -383,4 +393,3 @@ include jprt.gmk
.PHONY: all build clean clobber optimized debug fastdebug create_links \ .PHONY: all build clean clobber optimized debug fastdebug create_links \
import import_product import_fastdebug import_debug \ import import_product import_fastdebug import_debug \
test test_run test_start test_clean test_summary test test_run test_start test_clean test_summary
...@@ -234,7 +234,7 @@ images:: sanity-images post-sanity-images \ ...@@ -234,7 +234,7 @@ images:: sanity-images post-sanity-images \
$(INITIAL_IMAGE_JRE) $(INITIAL_IMAGE_JDK) \ $(INITIAL_IMAGE_JRE) $(INITIAL_IMAGE_JDK) \
trim-image-jre trim-image-jdk \ trim-image-jre trim-image-jdk \
identify-image-jre identify-image-jdk \ identify-image-jre identify-image-jdk \
process-image-jre process-image-jdk sec-files sec-files-win jgss-files process-image-jre process-image-jdk sec-files sec-files-win jgss-files
# Don't use these # Don't use these
image-jre:: initial-image-jre trim-image-jre identify-image-jre process-image-jre image-jre:: initial-image-jre trim-image-jre identify-image-jre process-image-jre
...@@ -496,7 +496,7 @@ $(JDK_IMAGE_DIR)/demo/DEMOS_LICENSE: $(SHARE_JDK_DOC_SRC)/DEMOS_LICENSE ...@@ -496,7 +496,7 @@ $(JDK_IMAGE_DIR)/demo/DEMOS_LICENSE: $(SHARE_JDK_DOC_SRC)/DEMOS_LICENSE
$(JDK_IMAGE_DIR)/sample/SAMPLES_LICENSE: $(SHARE_JDK_DOC_SRC)/SAMPLES_LICENSE $(JDK_IMAGE_DIR)/sample/SAMPLES_LICENSE: $(SHARE_JDK_DOC_SRC)/SAMPLES_LICENSE
$(process-doc-file) $(process-doc-file)
# JRE files # JRE files
$(JRE_IMAGE_DIR)/%: $(SHARE_JRE_DOC_SRC)/% $(JRE_IMAGE_DIR)/%: $(SHARE_JRE_DOC_SRC)/%
$(process-doc-file) $(process-doc-file)
ifeq ($(PLATFORM), windows) ifeq ($(PLATFORM), windows)
...@@ -1095,8 +1095,12 @@ initial-image-jdk:: initial-image-jdk-setup \ ...@@ -1095,8 +1095,12 @@ initial-image-jdk:: initial-image-jdk-setup \
@# @#
@# demo, include @# demo, include
@# @#
ifndef NO_DEMOS
$(CP) -r -f $(DEMODIR) $(JDK_IMAGE_DIR) $(CP) -r -f $(DEMODIR) $(JDK_IMAGE_DIR)
endif
ifndef NO_SAMPLES
$(CP) -r -f $(SAMPLEDIR) $(JDK_IMAGE_DIR) $(CP) -r -f $(SAMPLEDIR) $(JDK_IMAGE_DIR)
endif
$(CP) -r $(INCLUDEDIR) $(JDK_IMAGE_DIR) $(CP) -r $(INCLUDEDIR) $(JDK_IMAGE_DIR)
@# @#
@# Swing BeanInfo generation @# Swing BeanInfo generation
...@@ -1359,4 +1363,3 @@ images images-clobber:: ...@@ -1359,4 +1363,3 @@ images images-clobber::
# Force rule # Force rule
FRC: FRC:
...@@ -134,6 +134,8 @@ ALL_SETTINGS+=$(call addOptionalSetting,USE_HOTSPOT_INTERPRETER_MODE) ...@@ -134,6 +134,8 @@ ALL_SETTINGS+=$(call addOptionalSetting,USE_HOTSPOT_INTERPRETER_MODE)
ALL_SETTINGS+=$(call addOptionalSetting,PEDANTIC) ALL_SETTINGS+=$(call addOptionalSetting,PEDANTIC)
ALL_SETTINGS+=$(call addOptionalSetting,DEV_ONLY) ALL_SETTINGS+=$(call addOptionalSetting,DEV_ONLY)
ALL_SETTINGS+=$(call addOptionalSetting,NO_DOCS) ALL_SETTINGS+=$(call addOptionalSetting,NO_DOCS)
ALL_SETTINGS+=$(call addOptionalSetting,NO_DEMOS)
ALL_SETTINGS+=$(call addOptionalSetting,NO_SAMPLES)
ALL_SETTINGS+=$(call addOptionalSetting,NO_IMAGES) ALL_SETTINGS+=$(call addOptionalSetting,NO_IMAGES)
ALL_SETTINGS+=$(call addOptionalSetting,TOOLS_ONLY) ALL_SETTINGS+=$(call addOptionalSetting,TOOLS_ONLY)
ALL_SETTINGS+=$(call addOptionalSetting,INSANE) ALL_SETTINGS+=$(call addOptionalSetting,INSANE)
...@@ -263,4 +265,3 @@ ifdef OPENJDK ...@@ -263,4 +265,3 @@ ifdef OPENJDK
ALL_SETTINGS+=$(call addAltSetting,PREVIOUS_JRE_FILE) ALL_SETTINGS+=$(call addAltSetting,PREVIOUS_JRE_FILE)
ALL_SETTINGS+=$(call addAltSetting,PREVIOUS_RELEASE_IMAGE) ALL_SETTINGS+=$(call addAltSetting,PREVIOUS_RELEASE_IMAGE)
endif endif
/* /*
* 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
package build.tools.javazic; package build.tools.javazic;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -162,6 +163,20 @@ class Mappings { ...@@ -162,6 +163,20 @@ class Mappings {
for (String key : toBeRemoved) { for (String key : toBeRemoved) {
aliases.remove(key); 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() { Map<String,String> getAliases() {
......
...@@ -55,7 +55,6 @@ import javax.swing.text.DefaultEditorKit; ...@@ -55,7 +55,6 @@ import javax.swing.text.DefaultEditorKit;
import java.awt.Font; import java.awt.Font;
import java.awt.Color; import java.awt.Color;
import java.awt.event.KeyEvent;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.security.AccessController; import java.security.AccessController;
...@@ -523,6 +522,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel ...@@ -523,6 +522,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
Object ScrollbarBackgroundColor = new DesktopProperty( Object ScrollbarBackgroundColor = new DesktopProperty(
"win.scrollbar.backgroundColor", "win.scrollbar.backgroundColor",
table.get("scrollbar")); table.get("scrollbar"));
Object buttonFocusColor = new FocusColorProperty();
Object TextBackground = new XPColorValue(Part.EP_EDIT, null, Prop.FILLCOLOR, Object TextBackground = new XPColorValue(Part.EP_EDIT, null, Prop.FILLCOLOR,
WindowBackgroundColor); WindowBackgroundColor);
...@@ -629,7 +629,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel ...@@ -629,7 +629,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
"Button.highlight", ControlHighlightColor, "Button.highlight", ControlHighlightColor,
"Button.disabledForeground", InactiveTextColor, "Button.disabledForeground", InactiveTextColor,
"Button.disabledShadow", ControlHighlightColor, "Button.disabledShadow", ControlHighlightColor,
"Button.focus", black, "Button.focus", buttonFocusColor,
"Button.dashedRectGapX", new XPValue(Integer.valueOf(3), Integer.valueOf(5)), "Button.dashedRectGapX", new XPValue(Integer.valueOf(3), Integer.valueOf(5)),
"Button.dashedRectGapY", new XPValue(Integer.valueOf(3), Integer.valueOf(4)), "Button.dashedRectGapY", new XPValue(Integer.valueOf(3), Integer.valueOf(4)),
"Button.dashedRectGapWidth", new XPValue(Integer.valueOf(6), Integer.valueOf(10)), "Button.dashedRectGapWidth", new XPValue(Integer.valueOf(6), Integer.valueOf(10)),
...@@ -652,7 +652,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel ...@@ -652,7 +652,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
"CheckBox.darkShadow", ControlDarkShadowColor, "CheckBox.darkShadow", ControlDarkShadowColor,
"CheckBox.light", ControlLightColor, "CheckBox.light", ControlLightColor,
"CheckBox.highlight", ControlHighlightColor, "CheckBox.highlight", ControlHighlightColor,
"CheckBox.focus", black, "CheckBox.focus", buttonFocusColor,
"CheckBox.focusInputMap", "CheckBox.focusInputMap",
new UIDefaults.LazyInputMap(new Object[] { new UIDefaults.LazyInputMap(new Object[] {
"SPACE", "pressed", "SPACE", "pressed",
...@@ -1007,7 +1007,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel ...@@ -1007,7 +1007,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
"RadioButton.darkShadow", ControlDarkShadowColor, "RadioButton.darkShadow", ControlDarkShadowColor,
"RadioButton.light", ControlLightColor, "RadioButton.light", ControlLightColor,
"RadioButton.highlight", ControlHighlightColor, "RadioButton.highlight", ControlHighlightColor,
"RadioButton.focus", black, "RadioButton.focus", buttonFocusColor,
"RadioButton.focusInputMap", "RadioButton.focusInputMap",
new UIDefaults.LazyInputMap(new Object[] { new UIDefaults.LazyInputMap(new Object[] {
"SPACE", "pressed", "SPACE", "pressed",
...@@ -2614,4 +2614,19 @@ public class WindowsLookAndFeel extends BasicLookAndFeel ...@@ -2614,4 +2614,19 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
} }
} }
private static class FocusColorProperty extends DesktopProperty {
public FocusColorProperty () {
// Fallback value is never used bacause of the configureValue method doesn't return null
super("win.3d.backgroundColor", Color.BLACK);
}
@Override
protected Object configureValue(Object value) {
if (! ((Boolean)Toolkit.getDefaultToolkit().getDesktopProperty("win.highContrast.on")).booleanValue()){
return Color.BLACK;
}
return Color.BLACK.equals(value) ? Color.WHITE : Color.BLACK;
}
}
} }
...@@ -89,6 +89,11 @@ public class WindowsRadioButtonUI extends BasicRadioButtonUI ...@@ -89,6 +89,11 @@ public class WindowsRadioButtonUI extends BasicRadioButtonUI
} }
} }
protected void uninstallDefaults(AbstractButton b) {
super.uninstallDefaults(b);
initialized = false;
}
protected Color getFocusColor() { protected Color getFocusColor() {
return focusColor; return focusColor;
} }
......
...@@ -10070,11 +10070,12 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -10070,11 +10070,12 @@ public abstract class Component implements ImageObserver, MenuContainer,
} }
Window window = getContainingWindow(); Window window = getContainingWindow();
if (window != null) { if (window != null) {
if (!window.hasHeavyweightDescendants() || !window.hasLightweightDescendants()) { if (!window.hasHeavyweightDescendants() || !window.hasLightweightDescendants() || window.isDisposing()) {
if (mixingLog.isLoggable(PlatformLogger.FINE)) { if (mixingLog.isLoggable(PlatformLogger.FINE)) {
mixingLog.fine("containing window = " + window + mixingLog.fine("containing window = " + window +
"; has h/w descendants = " + window.hasHeavyweightDescendants() + "; has h/w descendants = " + window.hasHeavyweightDescendants() +
"; has l/w descendants = " + window.hasLightweightDescendants()); "; has l/w descendants = " + window.hasLightweightDescendants() +
"; disposing = " + window.isDisposing());
} }
return false; return false;
} }
......
...@@ -226,6 +226,7 @@ public class Window extends Container implements Accessible { ...@@ -226,6 +226,7 @@ public class Window extends Container implements Accessible {
static boolean systemSyncLWRequests = false; static boolean systemSyncLWRequests = false;
boolean syncLWRequests = false; boolean syncLWRequests = false;
transient boolean beforeFirstShow = true; transient boolean beforeFirstShow = true;
private transient boolean disposing = false;
static final int OPENED = 0x01; static final int OPENED = 0x01;
...@@ -1162,36 +1163,41 @@ public class Window extends Container implements Accessible { ...@@ -1162,36 +1163,41 @@ public class Window extends Container implements Accessible {
void doDispose() { void doDispose() {
class DisposeAction implements Runnable { class DisposeAction implements Runnable {
public void run() { public void run() {
// Check if this window is the fullscreen window for the disposing = true;
// device. Exit the fullscreen mode prior to disposing try {
// of the window if that's the case. // Check if this window is the fullscreen window for the
GraphicsDevice gd = getGraphicsConfiguration().getDevice(); // device. Exit the fullscreen mode prior to disposing
if (gd.getFullScreenWindow() == Window.this) { // of the window if that's the case.
gd.setFullScreenWindow(null); GraphicsDevice gd = getGraphicsConfiguration().getDevice();
} if (gd.getFullScreenWindow() == Window.this) {
gd.setFullScreenWindow(null);
}
Object[] ownedWindowArray; Object[] ownedWindowArray;
synchronized(ownedWindowList) { synchronized(ownedWindowList) {
ownedWindowArray = new Object[ownedWindowList.size()]; ownedWindowArray = new Object[ownedWindowList.size()];
ownedWindowList.copyInto(ownedWindowArray); ownedWindowList.copyInto(ownedWindowArray);
}
for (int i = 0; i < ownedWindowArray.length; i++) {
Window child = (Window) (((WeakReference)
(ownedWindowArray[i])).get());
if (child != null) {
child.disposeImpl();
} }
} for (int i = 0; i < ownedWindowArray.length; i++) {
hide(); Window child = (Window) (((WeakReference)
beforeFirstShow = true; (ownedWindowArray[i])).get());
removeNotify(); if (child != null) {
synchronized (inputContextLock) { child.disposeImpl();
if (inputContext != null) { }
inputContext.dispose(); }
inputContext = null; hide();
beforeFirstShow = true;
removeNotify();
synchronized (inputContextLock) {
if (inputContext != null) {
inputContext.dispose();
inputContext = null;
}
} }
clearCurrentFocusCycleRootOnHide();
} finally {
disposing = false;
} }
clearCurrentFocusCycleRootOnHide();
} }
} }
DisposeAction action = new DisposeAction(); DisposeAction action = new DisposeAction();
...@@ -2734,6 +2740,10 @@ public class Window extends Container implements Accessible { ...@@ -2734,6 +2740,10 @@ public class Window extends Container implements Accessible {
return visible; return visible;
} }
boolean isDisposing() {
return disposing;
}
/** /**
* @deprecated As of J2SE 1.4, replaced by * @deprecated As of J2SE 1.4, replaced by
* {@link Component#applyComponentOrientation Component.applyComponentOrientation}. * {@link Component#applyComponentOrientation Component.applyComponentOrientation}.
......
...@@ -180,7 +180,7 @@ public abstract class Executable extends AccessibleObject ...@@ -180,7 +180,7 @@ public abstract class Executable extends AccessibleObject
/** /**
* Returns the {@code Class} object representing the class or interface * Returns the {@code Class} object representing the class or interface
* that declares the method represented by this executable object. * that declares the executable represented by this object.
*/ */
public abstract Class<?> getDeclaringClass(); public abstract Class<?> getDeclaringClass();
...@@ -215,18 +215,18 @@ public abstract class Executable extends AccessibleObject ...@@ -215,18 +215,18 @@ public abstract class Executable extends AccessibleObject
* Returns an array of {@code Class} objects that represent the formal * Returns an array of {@code Class} objects that represent the formal
* parameter types, in declaration order, of the executable * parameter types, in declaration order, of the executable
* represented by this object. Returns an array of length * represented by this object. Returns an array of length
* 0 if the underlying method takes no parameters. * 0 if the underlying executable takes no parameters.
* *
* @return the parameter types for the method this object * @return the parameter types for the executable this object
* represents * represents
*/ */
public abstract Class<?>[] getParameterTypes(); public abstract Class<?>[] getParameterTypes();
/** /**
* Returns an array of {@code Type} objects that represent the formal * Returns an array of {@code Type} objects that represent the formal
* parameter types, in declaration order, of the method represented by * parameter types, in declaration order, of the executable represented by
* this executable object. Returns an array of length 0 if the * this object. Returns an array of length 0 if the
* underlying method takes no parameters. * underlying executable takes no parameters.
* *
* <p>If a formal parameter type is a parameterized type, * <p>If a formal parameter type is a parameterized type,
* the {@code Type} object returned for it must accurately reflect * the {@code Type} object returned for it must accurately reflect
...@@ -236,16 +236,16 @@ public abstract class Executable extends AccessibleObject ...@@ -236,16 +236,16 @@ public abstract class Executable extends AccessibleObject
* type, it is created. Otherwise, it is resolved. * type, it is created. Otherwise, it is resolved.
* *
* @return an array of {@code Type}s that represent the formal * @return an array of {@code Type}s that represent the formal
* parameter types of the underlying method, in declaration order * parameter types of the underlying executable, in declaration order
* @throws GenericSignatureFormatError * @throws GenericSignatureFormatError
* if the generic method signature does not conform to the format * if the generic method signature does not conform to the format
* specified in * specified in
* <cite>The Java&trade; Virtual Machine Specification</cite> * <cite>The Java&trade; Virtual Machine Specification</cite>
* @throws TypeNotPresentException if any of the parameter * @throws TypeNotPresentException if any of the parameter
* types of the underlying method refers to a non-existent type * types of the underlying executable refers to a non-existent type
* declaration * declaration
* @throws MalformedParameterizedTypeException if any of * @throws MalformedParameterizedTypeException if any of
* the underlying method's parameter types refer to a parameterized * the underlying executable's parameter types refer to a parameterized
* type that cannot be instantiated for any reason * type that cannot be instantiated for any reason
*/ */
public Type[] getGenericParameterTypes() { public Type[] getGenericParameterTypes() {
...@@ -277,15 +277,15 @@ public abstract class Executable extends AccessibleObject ...@@ -277,15 +277,15 @@ public abstract class Executable extends AccessibleObject
* type, it is created. Otherwise, it is resolved. * type, it is created. Otherwise, it is resolved.
* *
* @return an array of Types that represent the exception types * @return an array of Types that represent the exception types
* thrown by the underlying method * thrown by the underlying executable
* @throws GenericSignatureFormatError * @throws GenericSignatureFormatError
* if the generic method signature does not conform to the format * if the generic method signature does not conform to the format
* specified in * specified in
* <cite>The Java&trade; Virtual Machine Specification</cite> * <cite>The Java&trade; Virtual Machine Specification</cite>
* @throws TypeNotPresentException if the underlying method's * @throws TypeNotPresentException if the underlying executable's
* {@code throws} clause refers to a non-existent type declaration * {@code throws} clause refers to a non-existent type declaration
* @throws MalformedParameterizedTypeException if * @throws MalformedParameterizedTypeException if
* the underlying method's {@code throws} clause refers to a * the underlying executable's {@code throws} clause refers to a
* parameterized type that cannot be instantiated for any reason * parameterized type that cannot be instantiated for any reason
*/ */
public Type[] getGenericExceptionTypes() { public Type[] getGenericExceptionTypes() {
...@@ -330,7 +330,7 @@ public abstract class Executable extends AccessibleObject ...@@ -330,7 +330,7 @@ public abstract class Executable extends AccessibleObject
* Returns an array of arrays that represent the annotations on * Returns an array of arrays that represent the annotations on
* the formal parameters, in declaration order, of the executable * the formal parameters, in declaration order, of the executable
* represented by this object. (Returns an array of length zero if * represented by this object. (Returns an array of length zero if
* the underlying method is parameterless. If the executable has * the underlying executable is parameterless. If the executable has
* one or more parameters, a nested array of length zero is * one or more parameters, a nested array of length zero is
* returned for each parameter with no annotations.) The * returned for each parameter with no annotations.) The
* annotation objects contained in the returned arrays are * annotation objects contained in the returned arrays are
...@@ -339,7 +339,7 @@ public abstract class Executable extends AccessibleObject ...@@ -339,7 +339,7 @@ public abstract class Executable extends AccessibleObject
* to other callers. * to other callers.
* *
* @return an array of arrays that represent the annotations on the formal * @return an array of arrays that represent the annotations on the formal
* parameters, in declaration order, of the exectuable represented by this * parameters, in declaration order, of the executable represented by this
* object * object
*/ */
public abstract Annotation[][] getParameterAnnotations(); public abstract Annotation[][] getParameterAnnotations();
......
/* /*
* 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -1489,6 +1489,8 @@ public class Collections { ...@@ -1489,6 +1489,8 @@ public class Collections {
} }
public int hashCode() {return e.hashCode();} public int hashCode() {return e.hashCode();}
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o)
return true;
if (!(o instanceof Map.Entry)) if (!(o instanceof Map.Entry))
return false; return false;
Map.Entry t = (Map.Entry)o; Map.Entry t = (Map.Entry)o;
...@@ -1709,6 +1711,8 @@ public class Collections { ...@@ -1709,6 +1711,8 @@ public class Collections {
} }
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o)
return true;
synchronized (mutex) {return c.equals(o);} synchronized (mutex) {return c.equals(o);}
} }
public int hashCode() { public int hashCode() {
...@@ -1863,6 +1867,8 @@ public class Collections { ...@@ -1863,6 +1867,8 @@ public class Collections {
} }
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o)
return true;
synchronized (mutex) {return list.equals(o);} synchronized (mutex) {return list.equals(o);}
} }
public int hashCode() { public int hashCode() {
...@@ -2073,6 +2079,8 @@ public class Collections { ...@@ -2073,6 +2079,8 @@ public class Collections {
} }
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o)
return true;
synchronized (mutex) {return m.equals(o);} synchronized (mutex) {return m.equals(o);}
} }
public int hashCode() { public int hashCode() {
......
...@@ -27,9 +27,7 @@ package javax.swing; ...@@ -27,9 +27,7 @@ package javax.swing;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
import java.awt.image.VolatileImage;
import java.awt.peer.ComponentPeer; import java.awt.peer.ComponentPeer;
import java.applet.Applet;
import java.beans.Transient; import java.beans.Transient;
import javax.swing.plaf.ViewportUI; import javax.swing.plaf.ViewportUI;
...@@ -265,6 +263,14 @@ public class JViewport extends JComponent implements Accessible ...@@ -265,6 +263,14 @@ public class JViewport extends JComponent implements Accessible
*/ */
private boolean hasHadValidView; 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>. */ /** Creates a <code>JViewport</code>. */
public JViewport() { public JViewport() {
super(); super();
...@@ -830,7 +836,9 @@ public class JViewport extends JComponent implements Accessible ...@@ -830,7 +836,9 @@ public class JViewport extends JComponent implements Accessible
backingStoreImage = null; backingStoreImage = null;
} }
super.reshape(x, y, w, h); super.reshape(x, y, w, h);
if (sizeChanged) { if (sizeChanged || viewChanged) {
viewChanged = false;
fireStateChanged(); fireStateChanged();
} }
} }
...@@ -967,6 +975,8 @@ public class JViewport extends JComponent implements Accessible ...@@ -967,6 +975,8 @@ public class JViewport extends JComponent implements Accessible
hasHadValidView = true; hasHadValidView = true;
} }
viewChanged = true;
revalidate(); revalidate();
repaint(); repaint();
} }
......
...@@ -2619,10 +2619,6 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE { ...@@ -2619,10 +2619,6 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
physicalFonts.remove(oldFont.fullName); physicalFonts.remove(oldFont.fullName);
fullNameToFont.remove(oldFont.fullName.toLowerCase(Locale.ENGLISH)); fullNameToFont.remove(oldFont.fullName.toLowerCase(Locale.ENGLISH));
FontFamily.remove(oldFont); FontFamily.remove(oldFont);
if (oldFont instanceof FileFont) {
((FileFont)oldFont).deregisterFontAndClearStrikeCache();
}
if (localeFullNamesToFont != null) { if (localeFullNamesToFont != null) {
Map.Entry[] mapEntries = Map.Entry[] mapEntries =
(Map.Entry[])localeFullNamesToFont.entrySet(). (Map.Entry[])localeFullNamesToFont.entrySet().
......
/* /*
* 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -25,30 +25,34 @@ ...@@ -25,30 +25,34 @@
package sun.management; package sun.management;
import java.io.BufferedInputStream;
import java.io.File; import java.io.File;
import java.io.InputStream;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.BufferedInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.management.ManagementFactory;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.Properties; import java.util.Properties;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import java.util.MissingResourceException;
import java.lang.management.ManagementFactory;
import java.lang.reflect.Method;
import javax.management.remote.JMXConnectorServer; import javax.management.remote.JMXConnectorServer;
import sun.management.jmxremote.ConnectorBootstrap;
import static sun.management.AgentConfigurationError.*; import static sun.management.AgentConfigurationError.*;
import sun.management.jmxremote.ConnectorBootstrap;
import sun.misc.VMSupport; import sun.misc.VMSupport;
/** /**
* This Agent is started by the VM when -Dcom.sun.management.snmp * This Agent is started by the VM when -Dcom.sun.management.snmp
* or -Dcom.sun.management.jmxremote is set. This class will be * 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 { public class Agent {
// management properties // management properties
...@@ -69,7 +73,33 @@ public class Agent { ...@@ -69,7 +73,33 @@ public class Agent {
"com.sun.management.jmxremote.localConnectorAddress"; "com.sun.management.jmxremote.localConnectorAddress";
private static final String SNMP_ADAPTOR_BOOTSTRAP_CLASS_NAME = 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 // invoked by -javaagent or -Dcom.sun.management.agent.class
public static void premain(String args) throws Exception { public static void premain(String args) throws Exception {
...@@ -82,37 +112,104 @@ public class Agent { ...@@ -82,37 +112,104 @@ public class Agent {
args = JMXREMOTE; // default to local management args = JMXREMOTE; // default to local management
} }
// Parse agent options into properties Properties arg_props = parseString(args);
Properties arg_props = new Properties(); // Read properties from the config file
if (args != null) { Properties config_props = new Properties();
String[] options = args.split(","); String fname = arg_props.getProperty(CONFIG_FILE);
for (int i=0; i<options.length; i++) { readConfiguration(fname, config_props);
String[] option = options[i].split("=");
if (option.length >= 1 && option.length <= 2) { // Arguments override config file
String name = option[0]; config_props.putAll(arg_props);
String value = (option.length == 1) ? "" : option[1]; startAgent(config_props);
if (name != null && name.length() > 0) { }
// Assume that any com.sun.management.* options are okay // jcmd ManagementAgent.start_local entry point
if (name.startsWith("com.sun.management.")) { // Also called due to command-line via startAgent()
arg_props.setProperty(name, value); private static synchronized void startLocalManagementAgent(){
} else { Properties agentProps = VMSupport.getAgentProperties();
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 // jcmd ManagementAgent.start entry point
Properties config_props = new Properties(); // This method starts the remote JMX agent and starts neither
String fname = arg_props.getProperty(CONFIG_FILE); // the local JMX agent nor the SNMP agent
readConfiguration(fname, config_props); // @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
// Arguments override config file String fname = System.getProperty(CONFIG_FILE);
config_props.putAll(arg_props); readConfiguration(fname, configProps);
startAgent(config_props);
// 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 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 { private static void startAgent(Properties props) throws Exception {
...@@ -130,7 +227,7 @@ public class Agent { ...@@ -130,7 +227,7 @@ public class Agent {
try { try {
if (snmpPort != null) { if (snmpPort != null) {
loadSnmpAgent(snmpPort, props); loadSnmpAgent(snmpPort, props);
} }
/* /*
...@@ -142,31 +239,14 @@ public class Agent { ...@@ -142,31 +239,14 @@ public class Agent {
* of this "local" server is exported as a counter to the jstat * of this "local" server is exported as a counter to the jstat
* instrumentation buffer. * instrumentation buffer.
*/ */
if (jmxremote != null || jmxremotePort != null) { if (jmxremote != null || jmxremotePort != null) {
if (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) { } catch (AgentConfigurationError e) {
error(e.getError(), e.getParams()); error(e.getError(), e.getParams());
} catch (Exception e) { } catch (Exception e) {
...@@ -187,9 +267,9 @@ public class Agent { ...@@ -187,9 +267,9 @@ public class Agent {
props.putAll(System.getProperties()); props.putAll(System.getProperties());
return props; return props;
} }
public static synchronized Properties getManagementProperties() { public static synchronized Properties getManagementProperties() {
if (mgmtProps == null) { if (mgmtProps == null) {
String configFile = System.getProperty(CONFIG_FILE); String configFile = System.getProperty(CONFIG_FILE);
String snmpPort = System.getProperty(SNMP_PORT); String snmpPort = System.getProperty(SNMP_PORT);
......
/* /*
* 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -53,6 +53,8 @@ public class AgentConfigurationError extends Error { ...@@ -53,6 +53,8 @@ public class AgentConfigurationError extends Error {
"agent.err.invalid.agentclass"; "agent.err.invalid.agentclass";
public static final String INVALID_JMXREMOTE_PORT = public static final String INVALID_JMXREMOTE_PORT =
"agent.err.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 = public static final String PASSWORD_FILE_NOT_SET =
"agent.err.password.file.notset"; "agent.err.password.file.notset";
public static final String PASSWORD_FILE_NOT_READABLE = public static final String PASSWORD_FILE_NOT_READABLE =
...@@ -105,6 +107,8 @@ public class AgentConfigurationError extends Error { ...@@ -105,6 +107,8 @@ public class AgentConfigurationError extends Error {
"agent.err.snmp.adaptor.start.failed"; "agent.err.snmp.adaptor.start.failed";
public static final String SNMP_MIB_INIT_FAILED = public static final String SNMP_MIB_INIT_FAILED =
"agent.err.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 error;
private final String[] params; private final String[] params;
......
/* /*
* 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -28,25 +28,22 @@ package sun.management.jmxremote; ...@@ -28,25 +28,22 @@ package sun.management.jmxremote;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.InputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.lang.management.ManagementFactory;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.rmi.NoSuchObjectException; import java.rmi.NoSuchObjectException;
import java.rmi.Remote; import java.rmi.Remote;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.rmi.registry.Registry; import java.rmi.registry.Registry;
import java.rmi.server.RemoteObject;
import java.rmi.server.RMIClientSocketFactory; import java.rmi.server.RMIClientSocketFactory;
import java.rmi.server.RMIServerSocketFactory; import java.rmi.server.RMIServerSocketFactory;
import java.rmi.server.RemoteObject;
import java.rmi.server.UnicastRemoteObject; import java.rmi.server.UnicastRemoteObject;
import java.security.KeyStore; import java.security.KeyStore;
import java.security.Principal; import java.security.Principal;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
...@@ -55,35 +52,31 @@ import java.util.Properties; ...@@ -55,35 +52,31 @@ import java.util.Properties;
import java.util.Set; import java.util.Set;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.lang.management.ManagementFactory;
import javax.net.ssl.*;
import javax.management.MBeanServer; import javax.management.MBeanServer;
import javax.management.remote.JMXAuthenticator; import javax.management.remote.JMXAuthenticator;
import javax.management.remote.JMXConnectorServer; import javax.management.remote.JMXConnectorServer;
import javax.management.remote.JMXConnectorServerFactory; import javax.management.remote.JMXConnectorServerFactory;
import javax.management.remote.JMXServiceURL; import javax.management.remote.JMXServiceURL;
import javax.management.remote.rmi.RMIConnectorServer; 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.SslRMIClientSocketFactory;
import javax.rmi.ssl.SslRMIServerSocketFactory; import javax.rmi.ssl.SslRMIServerSocketFactory;
import javax.security.auth.Subject; import javax.security.auth.Subject;
import sun.rmi.server.UnicastRef; import com.sun.jmx.remote.internal.RMIExporter;
import sun.rmi.server.UnicastServerRef; import com.sun.jmx.remote.security.JMXPluggableAuthenticator;
import sun.rmi.server.UnicastServerRef2; import com.sun.jmx.remote.util.ClassLogger;
import sun.management.Agent; import sun.management.Agent;
import sun.management.AgentConfigurationError; import sun.management.AgentConfigurationError;
import static sun.management.AgentConfigurationError.*; import static sun.management.AgentConfigurationError.*;
import sun.management.ConnectorAddressLink; import sun.management.ConnectorAddressLink;
import sun.management.FileSystem; import sun.management.FileSystem;
import com.sun.jmx.remote.util.ClassLogger; import sun.rmi.server.UnicastRef;
import sun.rmi.server.UnicastServerRef;
import com.sun.jmx.remote.internal.RMIExporter; import sun.rmi.server.UnicastServerRef2;
import com.sun.jmx.remote.security.JMXPluggableAuthenticator;
/** /**
* This class initializes and starts the RMIConnectorServer for JSR 163 * This class initializes and starts the RMIConnectorServer for JSR 163
...@@ -114,6 +107,8 @@ public final class ConnectorBootstrap { ...@@ -114,6 +107,8 @@ public final class ConnectorBootstrap {
public static final String PORT = public static final String PORT =
"com.sun.management.jmxremote.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 = public static final String CONFIG_FILE_NAME =
"com.sun.management.config.file"; "com.sun.management.config.file";
public static final String USE_LOCAL_ONLY = public static final String USE_LOCAL_ONLY =
...@@ -266,34 +261,61 @@ public final class ConnectorBootstrap { ...@@ -266,34 +261,61 @@ public final class ConnectorBootstrap {
private final String accessFile; private final String accessFile;
} }
/** // The variable below is here to support stop functionality
* Initializes and starts the JMX Connector Server. // It would be overriten if you call startRemoteCommectionServer second
* If the com.sun.management.jmxremote.port property is not defined, // time. It's OK for now as logic in Agent.java forbids mutiple agents
* simply return. Otherwise, attempts to load the config file, and private static Registry registry = null;
* then calls {@link #initialize(java.lang.String, java.util.Properties)}.
*
**/
public static synchronized JMXConnectorServer initialize() {
// Load a new management properties public static void unexportRegistry() {
final Properties props = Agent.loadManagementProperties(); // Remove the entry from registry
if (props == null) { try {
return null; 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.
} }
}
final String portStr = props.getProperty(PropertyNames.PORT); /**
* 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() {
// Load a new management properties
final Properties props = Agent.loadManagementProperties();
if (props == null) {
return null;
}
final String portStr = props.getProperty(PropertyNames.PORT);
return startRemoteConnectorServer(portStr, props);
}
// System.out.println("initializing: {port=" + portStr + ", /**
// properties="+props+"}"); * This method is used by some jtreg tests.
return initialize(portStr, props); *
* @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 * Initializes and starts a JMX Connector Server for remote
* monitoring and management. * monitoring and management.
**/ **/
public static synchronized JMXConnectorServer initialize(String portStr, Properties props) { public static synchronized JMXConnectorServer startRemoteConnectorServer(String portStr, Properties props) {
// Get port number // Get port number
final int port; final int port;
...@@ -306,6 +328,22 @@ public final class ConnectorBootstrap { ...@@ -306,6 +328,22 @@ public final class ConnectorBootstrap {
throw new AgentConfigurationError(INVALID_JMXREMOTE_PORT, portStr); 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? // Do we use authentication?
final String useAuthenticationStr = final String useAuthenticationStr =
props.getProperty(PropertyNames.USE_AUTHENTICATION, props.getProperty(PropertyNames.USE_AUTHENTICATION,
...@@ -387,9 +425,10 @@ public final class ConnectorBootstrap { ...@@ -387,9 +425,10 @@ public final class ConnectorBootstrap {
} }
if (log.debugOn()) { if (log.debugOn()) {
log.debug("initialize", log.debug("startRemoteConnectorServer",
Agent.getText("jmxremote.ConnectorBootstrap.initialize") + Agent.getText("jmxremote.ConnectorBootstrap.starting") +
"\n\t" + PropertyNames.PORT + "=" + port + "\n\t" + PropertyNames.PORT + "=" + port +
"\n\t" + PropertyNames.RMI_PORT + "=" + rmiPort +
"\n\t" + PropertyNames.USE_SSL + "=" + useSsl + "\n\t" + PropertyNames.USE_SSL + "=" + useSsl +
"\n\t" + PropertyNames.USE_REGISTRY_SSL + "=" + useRegistrySsl + "\n\t" + PropertyNames.USE_REGISTRY_SSL + "=" + useRegistrySsl +
"\n\t" + PropertyNames.SSL_CONFIG_FILE_NAME + "=" + sslConfigFileName + "\n\t" + PropertyNames.SSL_CONFIG_FILE_NAME + "=" + sslConfigFileName +
...@@ -404,7 +443,7 @@ public final class ConnectorBootstrap { ...@@ -404,7 +443,7 @@ public final class ConnectorBootstrap {
(useAuthentication ? (loginConfigName == null ? ("\n\t" + PropertyNames.PASSWORD_FILE_NAME + "=" + (useAuthentication ? (loginConfigName == null ? ("\n\t" + PropertyNames.PASSWORD_FILE_NAME + "=" +
passwordFileName) : ("\n\t" + PropertyNames.LOGIN_CONFIG_NAME + "=" + passwordFileName) : ("\n\t" + PropertyNames.LOGIN_CONFIG_NAME + "=" +
loginConfigName)) : "\n\t" + loginConfigName)) : "\n\t" +
Agent.getText("jmxremote.ConnectorBootstrap.initialize.noAuthentication")) + Agent.getText("jmxremote.ConnectorBootstrap.noAuthentication")) +
(useAuthentication ? ("\n\t" + PropertyNames.ACCESS_FILE_NAME + "=" + (useAuthentication ? ("\n\t" + PropertyNames.ACCESS_FILE_NAME + "=" +
accessFileName) : "") + accessFileName) : "") +
""); "");
...@@ -415,15 +454,15 @@ public final class ConnectorBootstrap { ...@@ -415,15 +454,15 @@ public final class ConnectorBootstrap {
JMXServiceURL url = null; JMXServiceURL url = null;
try { try {
final JMXConnectorServerData data = exportMBeanServer( final JMXConnectorServerData data = exportMBeanServer(
mbs, port, useSsl, useRegistrySsl, mbs, port, rmiPort, useSsl, useRegistrySsl,
sslConfigFileName, enabledCipherSuitesList, sslConfigFileName, enabledCipherSuitesList,
enabledProtocolsList, sslNeedClientAuth, enabledProtocolsList, sslNeedClientAuth,
useAuthentication, loginConfigName, useAuthentication, loginConfigName,
passwordFileName, accessFileName); passwordFileName, accessFileName);
cs = data.jmxConnectorServer; cs = data.jmxConnectorServer;
url = data.jmxRemoteURL; url = data.jmxRemoteURL;
log.config("initialize", log.config("startRemoteConnectorServer",
Agent.getText("jmxremote.ConnectorBootstrap.initialize.ready", Agent.getText("jmxremote.ConnectorBootstrap.ready",
url.toString())); url.toString()));
} catch (Exception e) { } catch (Exception e) {
throw new AgentConfigurationError(AGENT_EXCEPTION, e, e.toString()); throw new AgentConfigurationError(AGENT_EXCEPTION, e, e.toString());
...@@ -442,7 +481,7 @@ public final class ConnectorBootstrap { ...@@ -442,7 +481,7 @@ public final class ConnectorBootstrap {
// Remote connector server started but unable to export remote // Remote connector server started but unable to export remote
// connector address and associated configuration properties to // connector address and associated configuration properties to
// the instrumentation buffer - non-fatal error. // the instrumentation buffer - non-fatal error.
log.debug("initialize", e); log.debug("startRemoteConnectorServer", e);
} }
return cs; return cs;
} }
...@@ -517,9 +556,9 @@ public final class ConnectorBootstrap { ...@@ -517,9 +556,9 @@ public final class ConnectorBootstrap {
try { try {
if (fs.supportsFileSecurity(file)) { if (fs.supportsFileSecurity(file)) {
if (!fs.isAccessUserOnly(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); passwordFileName);
log.config("initialize", msg); log.config("startRemoteConnectorServer", msg);
throw new AgentConfigurationError(PASSWORD_FILE_ACCESS_NOT_RESTRICTED, throw new AgentConfigurationError(PASSWORD_FILE_ACCESS_NOT_RESTRICTED,
passwordFileName); passwordFileName);
} }
...@@ -560,9 +599,9 @@ public final class ConnectorBootstrap { ...@@ -560,9 +599,9 @@ public final class ConnectorBootstrap {
if (fs.supportsFileSecurity(file)) { if (fs.supportsFileSecurity(file)) {
if (!fs.isAccessUserOnly(file)) { if (!fs.isAccessUserOnly(file)) {
final String msg = Agent.getText( final String msg = Agent.getText(
"jmxremote.ConnectorBootstrap.initialize.file.readonly", "jmxremote.ConnectorBootstrap.file.readonly",
restrictedFileName); restrictedFileName);
log.config("initialize", msg); log.config("startRemoteConnectorServer", msg);
throw new AgentConfigurationError( throw new AgentConfigurationError(
FILE_ACCESS_NOT_RESTRICTED, restrictedFileName); FILE_ACCESS_NOT_RESTRICTED, restrictedFileName);
} }
...@@ -662,6 +701,7 @@ public final class ConnectorBootstrap { ...@@ -662,6 +701,7 @@ public final class ConnectorBootstrap {
private static JMXConnectorServerData exportMBeanServer( private static JMXConnectorServerData exportMBeanServer(
MBeanServer mbs, MBeanServer mbs,
int port, int port,
int rmiPort,
boolean useSsl, boolean useSsl,
boolean useRegistrySsl, boolean useRegistrySsl,
String sslConfigFileName, String sslConfigFileName,
...@@ -679,7 +719,7 @@ public final class ConnectorBootstrap { ...@@ -679,7 +719,7 @@ public final class ConnectorBootstrap {
* IDs. */ * IDs. */
System.setProperty("java.rmi.server.randomIDs", "true"); 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<>(); Map<String, Object> env = new HashMap<>();
...@@ -736,7 +776,6 @@ public final class ConnectorBootstrap { ...@@ -736,7 +776,6 @@ public final class ConnectorBootstrap {
} }
} }
final Registry registry;
if (useRegistrySsl) { if (useRegistrySsl) {
registry = registry =
new SingleEntryRegistry(port, csf, ssf, new SingleEntryRegistry(port, csf, ssf,
...@@ -747,10 +786,12 @@ public final class ConnectorBootstrap { ...@@ -747,10 +786,12 @@ public final class ConnectorBootstrap {
"jmxrmi", exporter.firstExported); "jmxrmi", exporter.firstExported);
} }
JMXServiceURL remoteURL = new JMXServiceURL(
"service:jmx:rmi:///jndi/rmi://" + url.getHost() + ":" + int registryPort =
((UnicastRef) ((RemoteObject) registry).getRef()).getLiveRef().getPort() + ((UnicastRef) ((RemoteObject) registry).getRef()).getLiveRef().getPort();
"/jmxrmi"); 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 /* Our exporter remembers the first object it was asked to
export, which will be an RMIServerImpl appropriate for export, which will be an RMIServerImpl appropriate for
......
# #
# #
# 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. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -43,8 +43,9 @@ agent.err.agentclass.failed = Management agent class failed ...@@ -43,8 +43,9 @@ agent.err.agentclass.failed = Management agent class failed
agent.err.premain.notfound = premain(String) does not exist in agent class 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.agentclass.access.denied = Access to premain(String) is denied
agent.err.invalid.agentclass = Invalid com.sun.management.agent.class property value 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.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.set = File not specified
agent.err.file.not.readable = File not readable agent.err.file.not.readable = File not readable
...@@ -78,11 +79,11 @@ agent.err.acl.file.access.notrestricted = Password file read access must be rest ...@@ -78,11 +79,11 @@ agent.err.acl.file.access.notrestricted = Password file read access must be rest
agent.err.snmp.adaptor.start.failed = Failed to start SNMP adaptor with address 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 agent.err.snmp.mib.init.failed = Failed to initialize SNMP MIB with error
jmxremote.ConnectorBootstrap.initialize = Starting JMX Connector Server: jmxremote.ConnectorBootstrap.starting = Starting JMX Connector Server:
jmxremote.ConnectorBootstrap.initialize.noAuthentication = No Authentication jmxremote.ConnectorBootstrap.noAuthentication = No Authentication
jmxremote.ConnectorBootstrap.initialize.ready = JMX Connector ready at: {0} jmxremote.ConnectorBootstrap.ready = JMX Connector ready at: {0}
jmxremote.ConnectorBootstrap.initialize.password.readonly = Password file read access must be restricted: {0} jmxremote.ConnectorBootstrap.password.readonly = Password file read access must be restricted: {0}
jmxremote.ConnectorBootstrap.initialize.file.readonly = 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.processing = Processing ACL
jmxremote.AdaptorBootstrap.getTargetList.adding = Adding target: {0} jmxremote.AdaptorBootstrap.getTargetList.adding = Adding target: {0}
......
...@@ -1246,7 +1246,10 @@ public class PolicyFile extends java.security.Policy { ...@@ -1246,7 +1246,10 @@ public class PolicyFile extends java.security.Policy {
* @return the set of permissions according to the policy. * @return the set of permissions according to the policy.
*/ */
private PermissionCollection getPermissions(Permissions perms, private PermissionCollection getPermissions(Permissions perms,
final CodeSource cs) { final CodeSource cs) {
if (cs == null)
return perms;
CodeSource canonCodeSource = AccessController.doPrivileged( CodeSource canonCodeSource = AccessController.doPrivileged(
new java.security.PrivilegedAction<CodeSource>(){ new java.security.PrivilegedAction<CodeSource>(){
......
/* /*
* 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -79,13 +79,18 @@ public class ZoneInfo extends TimeZone { ...@@ -79,13 +79,18 @@ public class ZoneInfo extends TimeZone {
private static final int TRANSITION_NSHIFT = 12; private static final int TRANSITION_NSHIFT = 12;
// Flag for supporting JDK backward compatible IDs, such as "EST". // Flag for supporting JDK backward compatible IDs, such as "EST".
private static final boolean USE_OLDMAPPING; static final boolean USE_OLDMAPPING;
static { static {
String oldmapping = AccessController.doPrivileged( String oldmapping = AccessController.doPrivileged(
new sun.security.action.GetPropertyAction("sun.timezone.ids.oldmapping", "false")).toLowerCase(Locale.ROOT); new sun.security.action.GetPropertyAction("sun.timezone.ids.oldmapping", "false")).toLowerCase(Locale.ROOT);
USE_OLDMAPPING = (oldmapping.equals("yes") || oldmapping.equals("true")); 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(); private static final CalendarSystem gcal = CalendarSystem.getGregorianCalendar();
/** /**
...@@ -808,32 +813,41 @@ public class ZoneInfo extends TimeZone { ...@@ -808,32 +813,41 @@ public class ZoneInfo extends TimeZone {
private static SoftReference<Map<String, String>> aliasTable; private static SoftReference<Map<String, String>> aliasTable;
/** static Map<String, String> getCachedAliasTable() {
* Returns a Map from alias time zone IDs to their standard
* time zone IDs.
*
* @return the Map that holds the mappings from alias time zone IDs
* to their standard time zone IDs, or null if
* <code>ZoneInfoMappings</code> file is not available.
*/
public synchronized static Map<String, String> getAliasTable() {
Map<String, String> aliases = null; Map<String, String> aliases = null;
SoftReference<Map<String, String>> cache = aliasTable; SoftReference<Map<String, String>> cache = aliasTable;
if (cache != null) { if (cache != null) {
aliases = cache.get(); aliases = cache.get();
if (aliases != null) {
return aliases;
}
}
aliases = ZoneInfoFile.getZoneAliases();
if (aliases != null) {
aliasTable = new SoftReference<>(aliases);
} }
return aliases; return aliases;
} }
/**
* Returns a Map from alias time zone IDs to their standard
* time zone IDs.
*
* @return the Map that holds the mappings from alias time zone IDs
* to their standard time zone IDs, or null if
* <code>ZoneInfoMappings</code> file is not available.
*/
public synchronized static Map<String, String> getAliasTable() {
Map<String, String> aliases = getCachedAliasTable();
if (aliases == null) {
aliases = ZoneInfoFile.getZoneAliases();
if (aliases != null) {
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);
}
}
return aliases;
}
private void readObject(ObjectInputStream stream) private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException { throws IOException, ClassNotFoundException {
stream.defaultReadObject(); stream.defaultReadObject();
......
/* /*
* 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -473,6 +473,8 @@ public class ZoneInfoFile { ...@@ -473,6 +473,8 @@ public class ZoneInfoFile {
private static Map<String, ZoneInfo> zoneInfoObjects = null; private static Map<String, ZoneInfo> zoneInfoObjects = null;
private static final ZoneInfo GMT = new ZoneInfo("GMT", 0);
private static final String ziDir = AccessController.doPrivileged( private static final String ziDir = AccessController.doPrivileged(
new PrivilegedAction<String>() { new PrivilegedAction<String>() {
public String run() { public String run() {
...@@ -553,8 +555,15 @@ public class ZoneInfoFile { ...@@ -553,8 +555,15 @@ public class ZoneInfoFile {
* id. * id.
*/ */
public static ZoneInfo getZoneInfo(String id) { public static ZoneInfo getZoneInfo(String id) {
//treat GMT zone as special
if ("GMT".equals(id))
return (ZoneInfo) GMT.clone();
ZoneInfo zi = getFromCache(id); ZoneInfo zi = getFromCache(id);
if (zi == null) { if (zi == null) {
Map<String, String> aliases = ZoneInfo.getCachedAliasTable();
if (aliases != null && aliases.get(id) != null) {
return null;
}
zi = createZoneInfo(id); zi = createZoneInfo(id);
if (zi == null) { if (zi == null) {
return null; return null;
...@@ -1031,30 +1040,26 @@ public class ZoneInfoFile { ...@@ -1031,30 +1040,26 @@ public class ZoneInfoFile {
* @return the buffer, or null if any I/O error occurred. * @return the buffer, or null if any I/O error occurred.
*/ */
private static byte[] readZoneInfoFile(final String fileName) { private static byte[] readZoneInfoFile(final String fileName) {
if (fileName.indexOf("..") >= 0) {
return null;
}
byte[] buffer = null; byte[] buffer = null;
try { try {
buffer = AccessController.doPrivileged(new PrivilegedExceptionAction<byte[]>() { buffer = AccessController.doPrivileged(new PrivilegedExceptionAction<byte[]>() {
public byte[] run() throws IOException { public byte[] run() throws IOException {
File file = new File(ziDir, fileName); File file = new File(ziDir, fileName);
if (!file.exists() || !file.isFile()) {
return null;
}
file = file.getCanonicalFile();
String path = file.getCanonicalPath();
byte[] buf = null; byte[] buf = null;
if (path != null && path.startsWith(ziDir)) { int filesize = (int)file.length();
int filesize = (int)file.length(); if (filesize > 0) {
if (filesize > 0) { FileInputStream fis = new FileInputStream(file);
FileInputStream fis = new FileInputStream(file); buf = new byte[filesize];
buf = new byte[filesize]; try {
try { if (fis.read(buf) != filesize) {
if (fis.read(buf) != filesize) { throw new IOException("read error on " + fileName);
throw new IOException("read error on " + fileName);
}
} finally {
fis.close();
} }
} finally {
fis.close();
} }
} }
return buf; return buf;
......
...@@ -105,7 +105,6 @@ class XTextAreaPeer extends XComponentPeer implements TextAreaPeer { ...@@ -105,7 +105,6 @@ class XTextAreaPeer extends XComponentPeer implements TextAreaPeer {
this.target = target; this.target = target;
//ComponentAccessor.enableEvents(target,AWTEvent.MOUSE_WHEEL_EVENT_MASK); //ComponentAccessor.enableEvents(target,AWTEvent.MOUSE_WHEEL_EVENT_MASK);
target.enableInputMethods(true);
firstChangeSkipped = false; firstChangeSkipped = false;
String text = ((TextArea)target).getText(); String text = ((TextArea)target).getText();
...@@ -113,7 +112,6 @@ class XTextAreaPeer extends XComponentPeer implements TextAreaPeer { ...@@ -113,7 +112,6 @@ class XTextAreaPeer extends XComponentPeer implements TextAreaPeer {
jtext.setWrapStyleWord(true); jtext.setWrapStyleWord(true);
jtext.getDocument().addDocumentListener(jtext); jtext.getDocument().addDocumentListener(jtext);
XToolkit.specialPeerMap.put(jtext,this); XToolkit.specialPeerMap.put(jtext,this);
jtext.enableInputMethods(true);
textPane = new AWTTextPane(jtext,this, target.getParent()); textPane = new AWTTextPane(jtext,this, target.getParent());
setBounds(x, y, width, height, SET_BOUNDS); setBounds(x, y, width, height, SET_BOUNDS);
......
...@@ -73,8 +73,6 @@ public class XTextFieldPeer extends XComponentPeer implements TextFieldPeer { ...@@ -73,8 +73,6 @@ public class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
xtext = new XAWTTextField(text,this, target.getParent()); xtext = new XAWTTextField(text,this, target.getParent());
xtext.getDocument().addDocumentListener(xtext); xtext.getDocument().addDocumentListener(xtext);
xtext.setCursor(target.getCursor()); xtext.setCursor(target.getCursor());
target.enableInputMethods(true);
xtext.enableInputMethods(true);
XToolkit.specialPeerMap.put(xtext,this); XToolkit.specialPeerMap.put(xtext,this);
TextField txt = (TextField) target; TextField txt = (TextField) target;
......
########################################################################### ###########################################################################
# #
# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -125,15 +125,15 @@ ...@@ -125,15 +125,15 @@
# 7123972 # 7123972
java/lang/annotation/loaderLeak/Main.java generic-all java/lang/annotation/loaderLeak/Main.java generic-all
# 7079093
java/lang/instrument/ManifestTest.sh windows-all
# 6944188 # 6944188
java/lang/management/ThreadMXBean/ThreadStateTest.java generic-all java/lang/management/ThreadMXBean/ThreadStateTest.java generic-all
# 7067973 # 7067973
java/lang/management/MemoryMXBean/CollectionUsageThreshold.java generic-all java/lang/management/MemoryMXBean/CollectionUsageThreshold.java generic-all
# 7148492
java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java generic-all
############################################################################ ############################################################################
# jdk_management # jdk_management
...@@ -144,9 +144,8 @@ javax/management/loading/LibraryLoader/LibraryLoaderTest.java windows-all ...@@ -144,9 +144,8 @@ javax/management/loading/LibraryLoader/LibraryLoaderTest.java windows-all
# 7144846 # 7144846
javax/management/remote/mandatory/connection/ReconnectTest.java generic-all javax/management/remote/mandatory/connection/ReconnectTest.java generic-all
# 7073626 # 7149181
sun/management/jmxremote/bootstrap/RmiBootstrapTest.sh windows-all sun/management/jmxremote/startstop/JMXStartStopTest.sh generic-all
sun/management/jmxremote/bootstrap/RmiSslBootstrapTest.sh windows-all
############################################################################ ############################################################################
...@@ -185,6 +184,10 @@ java/net/InetAddress/CheckJNI.java linux-all ...@@ -185,6 +184,10 @@ java/net/InetAddress/CheckJNI.java linux-all
# 7102702 # 7102702
java/net/PortUnreachableException/OneExceptionOnly.java windows-all java/net/PortUnreachableException/OneExceptionOnly.java windows-all
# 7148829
sun/net/InetAddress/nameservice/simple/CacheTest.java generic-all
sun/net/InetAddress/nameservice/simple/DefaultCaching.java generic-all
############################################################################ ############################################################################
# jdk_io # jdk_io
...@@ -215,6 +218,9 @@ java/rmi/server/Unreferenced/finiteGCLatency/FiniteGCLatency.java generic-all ...@@ -215,6 +218,9 @@ java/rmi/server/Unreferenced/finiteGCLatency/FiniteGCLatency.java generic-all
# 6948101 # 6948101
java/rmi/transport/pinLastArguments/PinLastArguments.java generic-all java/rmi/transport/pinLastArguments/PinLastArguments.java generic-all
# 7146541
java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java linux-all
# 7132247 # 7132247
java/rmi/registry/readTest/readTest.sh windows-all java/rmi/registry/readTest/readTest.sh windows-all
...@@ -339,4 +345,3 @@ java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java generic-all ...@@ -339,4 +345,3 @@ java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java generic-all
java/util/TimeZone/TimeZoneDatePermissionCheck.sh solaris-all java/util/TimeZone/TimeZoneDatePermissionCheck.sh solaris-all
############################################################################ ############################################################################
/*
* 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.
*/
/*
* Portions Copyright (c) 2012 IBM Corporation
*/
/* @test
* @bug 7089914
* @summary Focus on image icons are not visible in javaws cache with high contrast mode
* @author Sean Chou
*/
import javax.swing.*;
import java.lang.reflect.Field;
public class bug7089914 {
public static void main(String[] args) throws Exception {
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
} catch (Exception e) {
System.out.println("Not WindowsLookAndFeel, test skipped");
return;
}
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
JRadioButton rb = new JRadioButton();
if (!"com.sun.java.swing.plaf.windows.WindowsRadioButtonUI".equals(rb.getUI().getClass().getName())) {
throw new RuntimeException("Unexpected UI class of JRadioButton");
}
try {
Field initializedField = rb.getUI().getClass().getDeclaredField("initialized");
initializedField.setAccessible(true);
if (!initializedField.getBoolean(rb.getUI())) {
throw new RuntimeException("initialized is false");
}
rb.getUI().uninstallUI(rb);
if (initializedField.getBoolean(rb.getUI())) {
throw new RuntimeException("initialized is true");
}
} catch (NoSuchFieldException | IllegalAccessException e) {
throw new RuntimeException(e);
}
}
});
}
}
# #
# Copyright (c) 2008, 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. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -396,7 +396,7 @@ while read token; do ...@@ -396,7 +396,7 @@ while read token; do
touch $FAIL_MARKER touch $FAIL_MARKER
fi fi
MESG=`cat expect_boot_cp_line` MESG=`cat expect_boot_cp_line | tr -d '\n\r'`
grep -s "$MESG" output.log > /dev/null grep -s "$MESG" output.log > /dev/null
result=$? result=$?
if [ "$result" = 0 ]; then if [ "$result" = 0 ]; then
...@@ -406,7 +406,7 @@ while read token; do ...@@ -406,7 +406,7 @@ while read token; do
touch $FAIL_MARKER touch $FAIL_MARKER
fi fi
MESG=`cat expect_redef_line` MESG=`cat expect_redef_line | tr -d '\n\r'`
grep -s "$MESG" output.log > /dev/null grep -s "$MESG" output.log > /dev/null
result=$? result=$?
if [ "$result" = 0 ]; then if [ "$result" = 0 ]; then
...@@ -416,7 +416,7 @@ while read token; do ...@@ -416,7 +416,7 @@ while read token; do
touch $FAIL_MARKER touch $FAIL_MARKER
fi fi
MESG=`cat expect_retrans_line` MESG=`cat expect_retrans_line | tr -d '\n\r'`
grep -s "$MESG" output.log > /dev/null grep -s "$MESG" output.log > /dev/null
result=$? result=$?
if [ "$result" = 0 ]; then if [ "$result" = 0 ]; then
...@@ -426,7 +426,7 @@ while read token; do ...@@ -426,7 +426,7 @@ while read token; do
touch $FAIL_MARKER touch $FAIL_MARKER
fi fi
MESG=`cat expect_set_nmp_line` MESG=`cat expect_set_nmp_line | tr -d '\n\r'`
grep -s "$MESG" output.log > /dev/null grep -s "$MESG" output.log > /dev/null
result=$? result=$?
if [ "$result" = 0 ]; then if [ "$result" = 0 ]; then
......
/*
* 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");
}
}
/*
* 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 4220171
* @author Konstantin Eremin
* @summary Tests
* @library ../../regtesthelpers
* @build Util
* @run main bug4220171
*/
import java.awt.Color;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import javax.swing.*;
import javax.swing.border.LineBorder;
import sun.awt.SunToolkit;
public class bug4220171 {
private static JTable table;
public static void main(String args[]) throws Exception {
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
Robot robot = new Robot();
robot.setAutoDelay(50);
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
createAndShowGUI();
}
});
toolkit.realSync();
clickMouse(robot, 0, 0);
Util.hitKeys(robot, KeyEvent.VK_A, KeyEvent.VK_B, KeyEvent.VK_ENTER);
toolkit.realSync();
checkCell(0, 0);
clickMouse(robot, 0, 1);
Util.hitKeys(robot, KeyEvent.VK_D, KeyEvent.VK_E, KeyEvent.VK_ENTER);
toolkit.realSync();
checkCell(0, 1);
clickMouse(robot, 1, 0);
Util.hitKeys(robot, KeyEvent.VK_1, KeyEvent.VK_2, KeyEvent.VK_ENTER);
toolkit.realSync();
checkCell(1, 0);
clickMouse(robot, 1, 1);
Util.hitKeys(robot, KeyEvent.VK_4, KeyEvent.VK_5, KeyEvent.VK_ENTER);
toolkit.realSync();
checkCell(1, 1);
}
static void checkCell(final int row, final int column) throws Exception {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
if (table.getValueAt(row, column) != null) {
throw new RuntimeException(
String.format("Cell (%d, %d) is editable", row, column));
}
}
});
}
static void clickMouse(Robot robot, int row, int column) throws Exception {
Point point = getCellClickPoint(row, column);
robot.mouseMove(point.x, point.y);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
}
private static Point getCellClickPoint(final int row, final int column) throws Exception {
final Point[] result = new Point[1];
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
Rectangle rect = table.getCellRect(row, column, false);
Point point = new Point(rect.x + rect.width / 2,
rect.y + rect.height / 2);
SwingUtilities.convertPointToScreen(point, table);
result[0] = point;
}
});
return result[0];
}
private static void createAndShowGUI() {
JFrame frame = new JFrame("Test");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(200, 200);
table = new JTable(2, 2);
table.setEnabled(false);
frame.getContentPane().add(table);
frame.setVisible(true);
}
}
/*
* 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);
}
}
/*
* 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 4846413
* @summary Checks if No tooltip modification when no KeyStroke modifier
* @library ../../regtesthelpers
* @build Util
* @author Konstantin Eremin
* @run main bug4846413
*/
import java.awt.Dimension;
import java.awt.Point;
import java.awt.Robot;
import java.awt.Toolkit;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.plaf.metal.MetalToolTipUI;
import sun.awt.SunToolkit;
public class bug4846413 {
private static volatile boolean isTooltipAdded;
private static JButton button;
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 movePoint = getButtonPoint();
robot.mouseMove(movePoint.x, movePoint.y);
toolkit.realSync();
long timeout = System.currentTimeMillis() + 9000;
while (!isTooltipAdded && (System.currentTimeMillis() < timeout)) {
try {Thread.sleep(500);} catch (Exception e) {}
}
checkToolTip();
}
private static void checkToolTip() throws Exception {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
JToolTip tooltip = (JToolTip) Util.findSubComponent(
JFrame.getFrames()[0], "JToolTip");
if (tooltip == null) {
throw new RuntimeException("Tooltip has not been found!");
}
MetalToolTipUI tooltipUI = (MetalToolTipUI) MetalToolTipUI.createUI(tooltip);
tooltipUI.installUI(tooltip);
if (!"-Insert".equals(tooltipUI.getAcceleratorString())) {
throw new RuntimeException("Tooltip acceleration is not properly set!");
}
}
});
}
private static Point getButtonPoint() 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);
button = new JButton("Press me");
button.setToolTipText("test");
button.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, 0, true), "someCommand");
button.getActionMap().put("someCommand", null);
frame.getContentPane().add(button);
JLayeredPane layeredPane = (JLayeredPane) Util.findSubComponent(
frame, "JLayeredPane");
layeredPane.addContainerListener(new ContainerAdapter() {
@Override
public void componentAdded(ContainerEvent e) {
isTooltipAdded = true;
}
});
frame.setVisible(true);
}
}
/*
* 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 4330357
* @summary Tests that real editor in JTree cleans up after editing was stopped
* @library ../../regtesthelpers
* @build Util
* @author Peter Zhelezniakov
* @run main bug4330357
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.tree.*;
import sun.awt.SunToolkit;
public class bug4330357 {
private static JTree tree;
private static JButton button;
private static Robot robot;
public static void main(String[] args) throws Exception {
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
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();
clickMouse(getTreeRowClickPoint(1));
Util.hitKeys(robot, KeyEvent.VK_F2);
Util.hitKeys(robot, KeyEvent.VK_A, KeyEvent.VK_B, KeyEvent.VK_C);
toolkit.realSync();
if (!hasComponent(JTextField.class)) {
throw new RuntimeException("Cell editor is missed for path: color");
}
clickMouse(getButtonClickPoint());
toolkit.realSync();
clickMouse(getTreeRowClickPoint(2));
Util.hitKeys(robot, KeyEvent.VK_F2);
toolkit.realSync();
if (!hasComponent(JComboBox.class)) {
throw new RuntimeException("Cell editor is missed for path: sports");
}
if (hasComponent(JTextField.class)) {
throw new RuntimeException("Cell editor is wrongly shown for path: color");
}
}
static void clickMouse(Point point) {
robot.mouseMove(point.x, point.y);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
}
private static Point getTreeRowClickPoint(final int row) throws Exception {
final Point[] result = new Point[1];
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
Rectangle rect = tree.getRowBounds(row);
Point p = new Point(rect.x + rect.width / 2, rect.y + 2);
SwingUtilities.convertPointToScreen(p, tree);
result[0] = p;
}
});
return result[0];
}
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];
}
static boolean hasComponent(final Class cls) throws Exception {
final boolean[] result = new boolean[1];
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
result[0] = Util.findSubComponent(tree, cls.getName()) != null;
}
});
return result[0];
}
private static void createAndShowGUI() {
JFrame frame = new JFrame("Test");
frame.setSize(200, 200);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
tree = new JTree();
tree.setEditable(true);
final TestEditor testEditor = new TestEditor();
tree.setCellEditor(new DefaultTreeCellEditor(tree,
(DefaultTreeCellRenderer) tree.getCellRenderer(),
testEditor));
button = new JButton("stop");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
testEditor.stopCellEditing();
}
});
frame.getContentPane().add(new JScrollPane(tree), BorderLayout.CENTER);
frame.getContentPane().add(button, BorderLayout.SOUTH);
frame.setVisible(true);
}
static class TestEditor extends AbstractCellEditor implements TreeCellEditor {
private JComboBox comboBox;
private JTextField textField;
private boolean comboBoxActive;
TestEditor() {
comboBox = new JComboBox(new String[]{"one", "two"});
textField = new JTextField();
}
public Component getTreeCellEditorComponent(JTree tree, Object value,
boolean isSelected,
boolean expanded,
boolean leaf, int row) {
if (row % 2 == 0) {
comboBoxActive = true;
return comboBox;
}
comboBoxActive = false;
return textField;
}
public Object getCellEditorValue() {
if (comboBoxActive) {
return comboBox.getSelectedItem();
}
return textField.getText();
}
}
}
/*
* 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();
}
});
}
}
/* /*
* 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -35,10 +35,10 @@ public class AgentCheckTest { ...@@ -35,10 +35,10 @@ public class AgentCheckTest {
public static void main(String[] args){ public static void main(String[] args){
String [][] testStrings = { String [][] testStrings = {
{"agent.err.error", "", ""}, {"agent.err.error", "", ""},
{"jmxremote.ConnectorBootstrap.initialize", "", ""}, {"jmxremote.ConnectorBootstrap.starting", "", ""},
{"jmxremote.ConnectorBootstrap.initialize.noAuthentication", "", ""}, {"jmxremote.ConnectorBootstrap.noAuthentication", "", ""},
{"jmxremote.ConnectorBootstrap.initialize.ready", "Phony JMXServiceURL", ""}, {"jmxremote.ConnectorBootstrap.ready", "Phony JMXServiceURL", ""},
{"jmxremote.ConnectorBootstrap.initialize.password.readonly", "Phony passwordFileName", ""}, {"jmxremote.ConnectorBootstrap.password.readonly", "Phony passwordFileName", ""},
{"jmxremote.AdaptorBootstrap.getTargetList.processing", "", ""}, {"jmxremote.AdaptorBootstrap.getTargetList.processing", "", ""},
{"jmxremote.AdaptorBootstrap.getTargetList.adding", "Phony target", ""}, {"jmxremote.AdaptorBootstrap.getTargetList.adding", "Phony target", ""},
{"jmxremote.AdaptorBootstrap.getTargetList.starting", "", ""}, {"jmxremote.AdaptorBootstrap.getTargetList.starting", "", ""},
......
# #
# Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -34,6 +34,13 @@ ...@@ -34,6 +34,13 @@
OS=`uname -s` OS=`uname -s`
UMASK=`umask` UMASK=`umask`
if [[ $OS == CYGWIN_NT* ]] ; then
OS="Windows_NT"
if [ -z "$SystemRoot" ] ; then
SystemRoot=$SYSTEMROOT
fi
fi
case $OS in case $OS in
SunOS | Linux) SunOS | Linux)
PATHSEP=":" PATHSEP=":"
......
/*
* 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");
}
}
/*
* 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);
}
}
#!/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
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.
com.sun.management.jmxremote.ssl=true
com.sun.management.internal.read_from_config_file_cl=true
com.sun.management.jmxremote.ssl=false
jmxremote.authenticate=true
com.sun.management.internal.read_from_config_file_jcmd=true
/*
* 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 7147830
* @summary PolicyFile.getPermissions(CodeSource) should return
* empty permissions when passed in null code source
*/
import java.security.CodeSource;
import java.security.PermissionCollection;
import java.security.Policy;
public class NullCodeSource {
public static void main(String[] args) throws Exception {
Policy policy = Policy.getPolicy();
PermissionCollection perms = policy.getPermissions((CodeSource)null);
if (perms.elements().hasMoreElements()) {
System.err.println(perms);
throw new Exception("PermissionCollection is not empty");
}
}
}
...@@ -75,14 +75,14 @@ public class Settings extends TestHelper { ...@@ -75,14 +75,14 @@ public class Settings extends TestHelper {
static void runTestOptionDefault() throws IOException { static void runTestOptionDefault() throws IOException {
TestResult tr = null; TestResult tr = null;
tr = doExec(javaCmd, "-Xms64m", "-Xmx512m", tr = doExec(javaCmd, "-Xms64m", "-Xmx512m",
"-Xss128k", "-XshowSettings", "-jar", testJar.getAbsolutePath()); "-Xss256k", "-XshowSettings", "-jar", testJar.getAbsolutePath());
containsAllOptions(tr); containsAllOptions(tr);
if (!tr.isOK()) { if (!tr.isOK()) {
System.out.println(tr.status); System.out.println(tr.status);
throw new RuntimeException("test fails"); throw new RuntimeException("test fails");
} }
tr = doExec(javaCmd, "-Xms65536k", "-Xmx712m", tr = doExec(javaCmd, "-Xms65536k", "-Xmx712m",
"-Xss122880", "-XshowSettings", "-jar", testJar.getAbsolutePath()); "-Xss256000", "-XshowSettings", "-jar", testJar.getAbsolutePath());
containsAllOptions(tr); containsAllOptions(tr);
if (!tr.isOK()) { if (!tr.isOK()) {
System.out.println(tr.status); System.out.println(tr.status);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册