# HG changeset patch
# User alanb
# Date 1304930825 25200
# Node ID efa758101257e4129641e34ee9bb48ce4b0d2542
# Parent 61242d00821f202520be65e0d0eeab3c95dc04dc# Parent 2d4eeef2bea2405f64c2baf8139e8af75376c8e9
Merge
diff -r 61242d00821f -r efa758101257 jdk/.hgtags
--- a/jdk/.hgtags Fri May 06 17:06:25 2011 -0700
+++ b/jdk/.hgtags Mon May 09 01:47:05 2011 -0700
@@ -114,3 +114,4 @@
29296ea6529a418037ccce95903249665ef31c11 jdk7-b137
60d3d55dcc9c31a30ced9caa6ef5c0dcd7db031d jdk7-b138
d80954a89b49fda47c0c5cace65a17f5a758b8bd jdk7-b139
+9315c733fb17ddfb9fb44be7e0ffea37bf3c727d jdk7-b140
diff -r 61242d00821f -r efa758101257 jdk/make/sun/javazic/tzdata/VERSION
--- a/jdk/make/sun/javazic/tzdata/VERSION Fri May 06 17:06:25 2011 -0700
+++ b/jdk/make/sun/javazic/tzdata/VERSION Mon May 09 01:47:05 2011 -0700
@@ -21,4 +21,4 @@
# or visit www.oracle.com if you need additional information or have any
# questions.
#
-tzdata2011e
+tzdata2011g
diff -r 61242d00821f -r efa758101257 jdk/make/sun/javazic/tzdata/africa
--- a/jdk/make/sun/javazic/tzdata/africa Fri May 06 17:06:25 2011 -0700
+++ b/jdk/make/sun/javazic/tzdata/africa Mon May 09 01:47:05 2011 -0700
@@ -234,7 +234,21 @@
Rule Egypt 1990 1994 - May 1 1:00 1:00 S
# IATA (after 1990) says transitions are at 0:00.
# Go with IATA starting in 1995, except correct 1995 entry from 09-30 to 09-29.
-Rule Egypt 1995 max - Apr lastFri 0:00s 1:00 S
+
+# From Alexander Krivenyshev (2011-04-20):
+# "...Egypt's interim cabinet decided on Wednesday to cancel daylight
+# saving time after a poll posted on its website showed the majority of
+# Egyptians would approve the cancellation."
+#
+# Egypt to cancel daylight saving time
+#
+# http://www.almasryalyoum.com/en/node/407168
+#
+# or
+#
+# http://www.worldtimezone.com/dst_news/dst_news_egypt04.html
+#
+Rule Egypt 1995 2010 - Apr lastFri 0:00s 1:00 S
Rule Egypt 1995 2005 - Sep lastThu 23:00s 0 -
# From Steffen Thorsen (2006-09-19):
# The Egyptian Gazette, issue 41,090 (2006-09-18), page 1, reports:
@@ -335,7 +349,7 @@
Rule Egypt 2009 only - Aug 20 23:00s 0 -
Rule Egypt 2010 only - Aug 11 0:00 0 -
Rule Egypt 2010 only - Sep 10 0:00 1:00 S
-Rule Egypt 2010 max - Sep lastThu 23:00s 0 -
+Rule Egypt 2010 only - Sep lastThu 23:00s 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Cairo 2:05:00 - LMT 1900 Oct
diff -r 61242d00821f -r efa758101257 jdk/make/sun/javazic/tzdata/europe
--- a/jdk/make/sun/javazic/tzdata/europe Fri May 06 17:06:25 2011 -0700
+++ b/jdk/make/sun/javazic/tzdata/europe Mon May 09 01:47:05 2011 -0700
@@ -168,7 +168,7 @@
# A monument to Willett was unveiled on 1927-05-21, in an open space in
# a 45-acre wood near Chislehurst, Kent that was purchased by popular
# subscription and open to the public. On the south face of the monolith,
-# designed by G. W. Miller, is the the William Willett Memorial Sundial,
+# designed by G. W. Miller, is the...William Willett Memorial Sundial,
# which is permanently set to Summer Time.
# From Winston Churchill (1934-04-28):
@@ -1808,7 +1808,7 @@
#
# All these events predate our cutoff date of 1970. Unless we can
# come up with more definitive info about the timekeeping during the
-# war years it's probably best just do do the following for now:
+# war years it's probably best just do...the following for now:
Link Europe/Oslo Arctic/Longyearbyen
# Poland
diff -r 61242d00821f -r efa758101257 jdk/make/sun/javazic/tzdata/southamerica
--- a/jdk/make/sun/javazic/tzdata/southamerica Fri May 06 17:06:25 2011 -0700
+++ b/jdk/make/sun/javazic/tzdata/southamerica Mon May 09 01:47:05 2011 -0700
@@ -767,7 +767,7 @@
#
# As a result of the above Decree I believe the America/Rio_Branco
# timezone shall be modified from UTC-5 to UTC-4 and a new timezone shall
-# be created to represent the the west side of the Para State. I
+# be created to represent the...west side of the Para State. I
# suggest this new timezone be called Santarem as the most
# important/populated city in the affected area.
#
@@ -1365,6 +1365,24 @@
# For now, we'll just record the time in Stanley, since we have no
# better info.
+# From Steffen Thorsen (2011-04-01):
+# The Falkland Islands will not turn back clocks this winter, but stay on
+# daylight saving time.
+#
+# One source:
+#
+# http://www.falklandnews.com/public/story.cfm?get=5914&source=3
+#
+#
+# We have gotten this confirmed by a clerk of the legislative assembly:
+# Normally the clocks revert to Local Mean Time (UTC/GMT -4 hours) on the
+# third Sunday of April at 0200hrs and advance to Summer Time (UTC/GMT -3
+# hours) on the first Sunday of September at 0200hrs.
+#
+# IMPORTANT NOTE: During 2011, on a trial basis, the Falkland Islands
+# will not revert to local mean time, but clocks will remain on Summer
+# time (UTC/GMT - 3 hours) throughout the whole of 2011. Any long term
+# change to local time following the trial period will be notified.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Falk 1937 1938 - Sep lastSun 0:00 1:00 S
Rule Falk 1938 1942 - Mar Sun>=19 0:00 0 -
@@ -1376,7 +1394,8 @@
Rule Falk 1984 only - Sep 16 0:00 1:00 S
Rule Falk 1985 2000 - Sep Sun>=9 0:00 1:00 S
Rule Falk 1986 2000 - Apr Sun>=16 0:00 0 -
-Rule Falk 2001 max - Apr Sun>=15 2:00 0 -
+Rule Falk 2001 2010 - Apr Sun>=15 2:00 0 -
+Rule Falk 2012 max - Apr Sun>=15 2:00 0 -
Rule Falk 2001 max - Sep Sun>=1 2:00 1:00 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Atlantic/Stanley -3:51:24 - LMT 1890
diff -r 61242d00821f -r efa758101257 jdk/src/share/classes/java/awt/Component.java
--- a/jdk/src/share/classes/java/awt/Component.java Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/share/classes/java/awt/Component.java Mon May 09 01:47:05 2011 -0700
@@ -2945,6 +2945,46 @@
}
/**
+ * Revalidates the component hierarchy up to the nearest validate root.
+ *
+ * This method first invalidates the component hierarchy starting from this
+ * component up to the nearest validate root. Afterwards, the component
+ * hierarchy is validated starting from the nearest validate root.
+ *
+ * This is a convenience method supposed to help application developers
+ * avoid looking for validate roots manually. Basically, it's equivalent to
+ * first calling the {@link #invalidate()} method on this component, and
+ * then calling the {@link #validate()} method on the nearest validate
+ * root.
+ *
+ * @see Container#isValidateRoot
+ * @since 1.7
+ */
+ public void revalidate() {
+ synchronized (getTreeLock()) {
+ invalidate();
+
+ Container root = getContainer();
+ if (root == null) {
+ // There's no parents. Just validate itself.
+ validate();
+ } else {
+ while (!root.isValidateRoot()) {
+ if (root.getContainer() == null) {
+ // If there's no validate roots, we'll validate the
+ // topmost container
+ break;
+ }
+
+ root = root.getContainer();
+ }
+
+ root.validate();
+ }
+ }
+ }
+
+ /**
* Creates a graphics context for this component. This method will
* return null
if this component is currently not
* displayable.
diff -r 61242d00821f -r efa758101257 jdk/src/share/classes/java/awt/GraphicsDevice.java
--- a/jdk/src/share/classes/java/awt/GraphicsDevice.java Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/share/classes/java/awt/GraphicsDevice.java Mon May 09 01:47:05 2011 -0700
@@ -257,6 +257,11 @@
* 1.0f, and the background color alpha is set to 255 (completely opaque).
* These values are not restored when returning to windowed mode.
*
+ * It is unspecified and platform-dependent how decorated windows operate
+ * in full-screen mode. For this reason, it is recommended to turn off
+ * the decorations in a {@code Frame} or {@code Dialog} object by using the
+ * {@code setUndecorated} method.
+ *
* When returning to windowed mode from an exclusive full-screen window,
* any display changes made by calling {@code setDisplayMode} are
* automatically restored to their original state.
@@ -272,6 +277,8 @@
* @see #setDisplayMode
* @see Component#enableInputMethods
* @see Component#setVisible
+ * @see Frame#setUndecorated
+ * @see Dialog#setUndecorated
*
* @since 1.4
*/
diff -r 61242d00821f -r efa758101257 jdk/src/share/classes/java/awt/RadialGradientPaint.java
--- a/jdk/src/share/classes/java/awt/RadialGradientPaint.java Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/share/classes/java/awt/RadialGradientPaint.java Mon May 09 01:47:05 2011 -0700
@@ -49,9 +49,11 @@
* from the focus point to the circumference will thus span all the gradient
* colors.
*
- * Specifying a focus point outside of the circle's radius will result in the
- * focus being set to the intersection point of the focus-center line and the
- * perimeter of the circle.
+ * Specifying a focus point outside of the radius of the circle will cause
+ * the rings of the gradient pattern to be centered on the point just inside
+ * the edge of the circle in the direction of the focus point.
+ * The rendering will internally use this modified location as if it were
+ * the specified focus point.
*
* The user must provide an array of floats specifying how to distribute the
* colors along the gradient. These values should range from 0.0 to 1.0 and
@@ -621,6 +623,11 @@
/**
* Returns a copy of the focus point of the radial gradient.
+ * Note that if the focus point specified when the radial gradient
+ * was constructed lies outside of the radius of the circle, this
+ * method will still return the original focus point even though
+ * the rendering may center the rings of color on a different
+ * point that lies inside the radius.
*
* @return a {@code Point2D} object that is a copy of the focus point
*/
diff -r 61242d00821f -r efa758101257 jdk/src/share/classes/java/awt/Toolkit.java
--- a/jdk/src/share/classes/java/awt/Toolkit.java Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/share/classes/java/awt/Toolkit.java Mon May 09 01:47:05 2011 -0700
@@ -1870,11 +1870,15 @@
/**
* Adds the specified property change listener for the named desktop
- * property.
- * If pcl is null, no exception is thrown and no action is performed.
+ * property. When a {@link PropertyChangeListenerProxy} object is added,
+ * its property name is ignored, and the wrapped listener is added.
+ * If {@code name} is {@code null} or {@code pcl} is {@code null},
+ * no exception is thrown and no action is performed.
*
* @param name The name of the property to listen for
* @param pcl The property change listener
+ * @see PropertyChangeSupport#addPropertyChangeListener(String,
+ PropertyChangeListener)
* @since 1.2
*/
public void addPropertyChangeListener(String name, PropertyChangeListener pcl) {
@@ -1883,11 +1887,16 @@
/**
* Removes the specified property change listener for the named
- * desktop property.
- * If pcl is null, no exception is thrown and no action is performed.
+ * desktop property. When a {@link PropertyChangeListenerProxy} object
+ * is removed, its property name is ignored, and
+ * the wrapped listener is removed.
+ * If {@code name} is {@code null} or {@code pcl} is {@code null},
+ * no exception is thrown and no action is performed.
*
* @param name The name of the property to remove
* @param pcl The property change listener
+ * @see PropertyChangeSupport#removePropertyChangeListener(String,
+ PropertyChangeListener)
* @since 1.2
*/
public void removePropertyChangeListener(String name, PropertyChangeListener pcl) {
@@ -1896,12 +1905,15 @@
/**
* Returns an array of all the property change listeners
- * registered on this toolkit.
+ * registered on this toolkit. The returned array
+ * contains {@code PropertyChangeListenerProxy} objects
+ * that associate listeners with the names of desktop properties.
*
- * @return all of this toolkit's PropertyChangeListener
s
- * or an empty array if no property change
- * listeners are currently registered
+ * @return all of this toolkit's {@ code PropertyChangeListener}
+ * objects wrapped in {@code PropertyChangeListenerProxy} objects
+ * or an empty array if no listeners are added
*
+ * @see PropertyChangeSupport#getPropertyChangeListeners()
* @since 1.4
*/
public PropertyChangeListener[] getPropertyChangeListeners() {
@@ -1909,13 +1921,15 @@
}
/**
- * Returns an array of all the PropertyChangeListener
s
- * associated with the named property.
+ * Returns an array of all property change listeners
+ * associated with the specified name of a desktop property.
*
* @param propertyName the named property
- * @return all of the PropertyChangeListener
s associated with
- * the named property or an empty array if no such listeners have
- * been added
+ * @return all of the {@code PropertyChangeListener} objects
+ * associated with the specified name of a desktop property
+ * or an empty array if no such listeners are added
+ *
+ * @see PropertyChangeSupport#getPropertyChangeListeners(String)
* @since 1.4
*/
public PropertyChangeListener[] getPropertyChangeListeners(String propertyName) {
diff -r 61242d00821f -r efa758101257 jdk/src/share/classes/java/awt/geom/Arc2D.java
--- a/jdk/src/share/classes/java/awt/geom/Arc2D.java Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/share/classes/java/awt/geom/Arc2D.java Mon May 09 01:47:05 2011 -0700
@@ -681,7 +681,7 @@
* @see java.awt.geom.Arc2D.Float
* @see java.awt.geom.Arc2D.Double
*/
- Arc2D() {
+ protected Arc2D() {
this(OPEN);
}
diff -r 61242d00821f -r efa758101257 jdk/src/share/classes/java/awt/geom/Path2D.java
--- a/jdk/src/share/classes/java/awt/geom/Path2D.java Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/share/classes/java/awt/geom/Path2D.java Mon May 09 01:47:05 2011 -0700
@@ -732,7 +732,7 @@
*
* @since 1.6
*/
- public PathIterator getPathIterator(AffineTransform at) {
+ public final PathIterator getPathIterator(AffineTransform at) {
if (at == null) {
return new CopyIterator(this);
} else {
@@ -1461,7 +1461,7 @@
* of this {@code Shape}'s outline
* @since 1.6
*/
- public PathIterator getPathIterator(AffineTransform at) {
+ public final PathIterator getPathIterator(AffineTransform at) {
if (at == null) {
return new CopyIterator(this);
} else {
@@ -2342,8 +2342,8 @@
*
* @since 1.6
*/
- public PathIterator getPathIterator(AffineTransform at,
- double flatness)
+ public final PathIterator getPathIterator(AffineTransform at,
+ double flatness)
{
return new FlatteningPathIterator(getPathIterator(at), flatness);
}
diff -r 61242d00821f -r efa758101257 jdk/src/share/classes/javax/swing/JPopupMenu.java
--- a/jdk/src/share/classes/javax/swing/JPopupMenu.java Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/share/classes/javax/swing/JPopupMenu.java Mon May 09 01:47:05 2011 -0700
@@ -342,8 +342,8 @@
// Calculate the screen size that popup should fit
Dimension popupSize = JPopupMenu.this.getPreferredSize();
- int popupRightX = popupLocation.x + popupSize.width;
- int popupBottomY = popupLocation.y + popupSize.height;
+ long popupRightX = (long)popupLocation.x + (long)popupSize.width;
+ long popupBottomY = (long)popupLocation.y + (long)popupSize.height;
int scrWidth = scrBounds.width;
int scrHeight = scrBounds.height;
if (!canPopupOverlapTaskBar()) {
@@ -358,13 +358,13 @@
int scrBottomY = scrBounds.y + scrHeight;
// Ensure that popup menu fits the screen
- if (popupRightX > scrRightX) {
+ if (popupRightX > (long)scrRightX) {
popupLocation.x = scrRightX - popupSize.width;
if( popupLocation.x < scrBounds.x ) {
popupLocation.x = scrBounds.x ;
}
}
- if (popupBottomY > scrBottomY) {
+ if (popupBottomY > (long)scrBottomY) {
popupLocation.y = scrBottomY - popupSize.height;
if( popupLocation.y < scrBounds.y ) {
popupLocation.y = scrBounds.y;
diff -r 61242d00821f -r efa758101257 jdk/src/share/classes/javax/swing/JSplitPane.java
--- a/jdk/src/share/classes/javax/swing/JSplitPane.java Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/share/classes/javax/swing/JSplitPane.java Mon May 09 01:47:05 2011 -0700
@@ -671,7 +671,7 @@
* which must be true
for the child components
* to be continuously
* redisplayed and laid out during user intervention.
- * The default value of this property is false
.
+ * The default value of this property is look and feel dependent.
* Some look and feels might not support continuous layout;
* they will ignore this property.
*
diff -r 61242d00821f -r efa758101257 jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneDivider.java
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneDivider.java Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneDivider.java Mon May 09 01:47:05 2011 -0700
@@ -154,7 +154,7 @@
setBackground(UIManager.getColor("SplitPane.background"));
}
- private void revalidate() {
+ private void revalidateSplitPane() {
invalidate();
if (splitPane != null) {
splitPane.revalidate();
@@ -315,7 +315,7 @@
setCursor((orientation == JSplitPane.HORIZONTAL_SPLIT) ?
Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR) :
Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR));
- revalidate();
+ revalidateSplitPane();
}
else if (e.getPropertyName() == JSplitPane.
ONE_TOUCH_EXPANDABLE_PROPERTY) {
@@ -376,7 +376,7 @@
add(rightButton);
}
}
- revalidate();
+ revalidateSplitPane();
}
diff -r 61242d00821f -r efa758101257 jdk/src/share/classes/sun/awt/ExtendedKeyCodes.java
--- a/jdk/src/share/classes/sun/awt/ExtendedKeyCodes.java Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/share/classes/sun/awt/ExtendedKeyCodes.java Mon May 09 01:47:05 2011 -0700
@@ -13,7 +13,7 @@
*/
// Keycodes declared in KeyEvent.java with corresponding Unicode values.
private final static HashMap regularKeyCodesMap =
- new HashMap(83, 1.0f);
+ new HashMap(98, 1.0f);
// Keycodes derived from Unicode values. Here should be collected codes
// for characters appearing on the primary layer of at least one
@@ -108,6 +108,21 @@
regularKeyCodesMap.put(0x5E, KeyEvent.VK_CIRCUMFLEX);
regularKeyCodesMap.put(0x5F, KeyEvent.VK_UNDERSCORE);
regularKeyCodesMap.put(0x60, KeyEvent.VK_BACK_QUOTE);
+ regularKeyCodesMap.put(0x61, KeyEvent.VK_A);
+ regularKeyCodesMap.put(0x62, KeyEvent.VK_B);
+ regularKeyCodesMap.put(0x63, KeyEvent.VK_C);
+ regularKeyCodesMap.put(0x64, KeyEvent.VK_D);
+ regularKeyCodesMap.put(0x65, KeyEvent.VK_E);
+ regularKeyCodesMap.put(0x66, KeyEvent.VK_F);
+ regularKeyCodesMap.put(0x67, KeyEvent.VK_G);
+ regularKeyCodesMap.put(0x68, KeyEvent.VK_H);
+ regularKeyCodesMap.put(0x69, KeyEvent.VK_I);
+ regularKeyCodesMap.put(0x6A, KeyEvent.VK_J);
+ regularKeyCodesMap.put(0x6B, KeyEvent.VK_K);
+ regularKeyCodesMap.put(0x6C, KeyEvent.VK_L);
+ regularKeyCodesMap.put(0x6D, KeyEvent.VK_M);
+ regularKeyCodesMap.put(0x6E, KeyEvent.VK_N);
+ regularKeyCodesMap.put(0x6F, KeyEvent.VK_O);
regularKeyCodesMap.put(0x70, KeyEvent.VK_P);
regularKeyCodesMap.put(0x71, KeyEvent.VK_Q);
regularKeyCodesMap.put(0x72, KeyEvent.VK_R);
diff -r 61242d00821f -r efa758101257 jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java
--- a/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java Mon May 09 01:47:05 2011 -0700
@@ -29,12 +29,10 @@
import java.awt.EventQueue;
import java.awt.Image;
import java.awt.Graphics;
-import java.awt.Toolkit;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.FlavorMap;
import java.awt.datatransfer.FlavorTable;
-import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
@@ -66,8 +64,6 @@
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
-import java.security.AccessControlContext;
-import java.security.AccessControlException;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
@@ -171,7 +167,26 @@
*/
public static final DataFlavor javaTextEncodingFlavor;
- private static SortedSet standardEncodings;
+ /**
+ * Lazy initialization of Standard Encodings.
+ */
+ private static class StandardEncodingsHolder {
+ private static final SortedSet standardEncodings = load();
+
+ private static SortedSet load() {
+ final Comparator comparator =
+ new CharsetComparator(IndexedComparator.SELECT_WORST);
+ final SortedSet tempSet = new TreeSet(comparator);
+ tempSet.add("US-ASCII");
+ tempSet.add("ISO-8859-1");
+ tempSet.add("UTF-8");
+ tempSet.add("UTF-16BE");
+ tempSet.add("UTF-16LE");
+ tempSet.add("UTF-16");
+ tempSet.add(getDefaultTextCharset());
+ return Collections.unmodifiableSortedSet(tempSet);
+ }
+ }
/**
* Tracks whether a particular text/* MIME type supports the charset
@@ -509,18 +524,7 @@
* non-standard, character sets are not included.
*/
public static Iterator standardEncodings() {
- if (standardEncodings == null) {
- TreeSet tempSet = new TreeSet(defaultCharsetComparator);
- tempSet.add("US-ASCII");
- tempSet.add("ISO-8859-1");
- tempSet.add("UTF-8");
- tempSet.add("UTF-16BE");
- tempSet.add("UTF-16LE");
- tempSet.add("UTF-16");
- tempSet.add(getDefaultTextCharset());
- standardEncodings = Collections.unmodifiableSortedSet(tempSet);
- }
- return standardEncodings.iterator();
+ return StandardEncodingsHolder.standardEncodings.iterator();
}
/**
@@ -2398,7 +2402,9 @@
public static DataFlavor[] setToSortedDataFlavorArray(Set flavorsSet) {
DataFlavor[] flavors = new DataFlavor[flavorsSet.size()];
flavorsSet.toArray(flavors);
- Arrays.sort(flavors, defaultFlavorComparator);
+ final Comparator comparator =
+ new DataFlavorComparator(IndexedComparator.SELECT_WORST);
+ Arrays.sort(flavors, comparator);
return flavors;
}
@@ -2455,11 +2461,6 @@
return new ArrayList();
}
- private static CharsetComparator defaultCharsetComparator =
- new CharsetComparator(IndexedComparator.SELECT_WORST);
- private static DataFlavorComparator defaultFlavorComparator =
- new DataFlavorComparator(IndexedComparator.SELECT_WORST);
-
/**
* A Comparator which includes a helper function for comparing two Objects
* which are likely to be keys in the specified Map.
diff -r 61242d00821f -r efa758101257 jdk/src/share/classes/sun/java2d/pisces/Stroker.java
--- a/jdk/src/share/classes/sun/java2d/pisces/Stroker.java Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/share/classes/sun/java2d/pisces/Stroker.java Mon May 09 01:47:05 2011 -0700
@@ -27,6 +27,8 @@
import java.util.Arrays;
import java.util.Iterator;
+import static java.lang.Math.ulp;
+import static java.lang.Math.sqrt;
import sun.awt.geom.PathConsumer2D;
@@ -130,7 +132,7 @@
private static void computeOffset(final float lx, final float ly,
final float w, final float[] m)
{
- final float len = (float)Math.sqrt(lx*lx + ly*ly);
+ final float len = (float) sqrt(lx*lx + ly*ly);
if (len == 0) {
m[0] = m[1] = 0;
} else {
@@ -217,7 +219,7 @@
// this normal's length is at least 0.5 and at most sqrt(2)/2 (because
// we know the angle of the arc is > 90 degrees).
float nx = my - omy, ny = omx - mx;
- float nlen = (float)Math.sqrt(nx*nx + ny*ny);
+ float nlen = (float) sqrt(nx*nx + ny*ny);
float scale = lineWidth2/nlen;
float mmx = nx * scale, mmy = ny * scale;
@@ -246,8 +248,8 @@
// define the bezier curve we're computing.
// It is computed using the constraints that P1-P0 and P3-P2 are parallel
// to the arc tangents at the endpoints, and that |P1-P0|=|P3-P2|.
- float cv = (float)((4.0 / 3.0) * Math.sqrt(0.5-cosext2) /
- (1.0 + Math.sqrt(cosext2+0.5)));
+ float cv = (float) ((4.0 / 3.0) * sqrt(0.5-cosext2) /
+ (1.0 + sqrt(cosext2+0.5)));
// if clockwise, we need to negate cv.
if (rev) { // rev is equivalent to isCW(omx, omy, mx, my)
cv = -cv;
@@ -284,28 +286,20 @@
false);
}
- // Return the intersection point of the lines (x0, y0) -> (x1, y1)
- // and (x0p, y0p) -> (x1p, y1p) in m[0] and m[1]
- private void computeMiter(final float x0, final float y0,
- final float x1, final float y1,
- final float x0p, final float y0p,
- final float x1p, final float y1p,
- final float[] m, int off)
+ // Put the intersection point of the lines (x0, y0) -> (x1, y1)
+ // and (x0p, y0p) -> (x1p, y1p) in m[off] and m[off+1].
+ // If the lines are parallel, it will put a non finite number in m.
+ private void computeIntersection(final float x0, final float y0,
+ final float x1, final float y1,
+ final float x0p, final float y0p,
+ final float x1p, final float y1p,
+ final float[] m, int off)
{
float x10 = x1 - x0;
float y10 = y1 - y0;
float x10p = x1p - x0p;
float y10p = y1p - y0p;
- // if this is 0, the lines are parallel. If they go in the
- // same direction, there is no intersection so m[off] and
- // m[off+1] will contain infinity, so no miter will be drawn.
- // If they go in the same direction that means that the start of the
- // current segment and the end of the previous segment have the same
- // tangent, in which case this method won't even be involved in
- // miter drawing because it won't be called by drawMiter (because
- // (mx == omx && my == omy) will be true, and drawMiter will return
- // immediately).
float den = x10*y10p - x10p*y10;
float t = x10p*(y0-y0p) - y10p*(x0-x0p);
t /= den;
@@ -321,7 +315,8 @@
{
if ((mx == omx && my == omy) ||
(pdx == 0 && pdy == 0) ||
- (dx == 0 && dy == 0)) {
+ (dx == 0 && dy == 0))
+ {
return;
}
@@ -332,12 +327,17 @@
my = -my;
}
- computeMiter((x0 - pdx) + omx, (y0 - pdy) + omy, x0 + omx, y0 + omy,
- (dx + x0) + mx, (dy + y0) + my, x0 + mx, y0 + my,
- miter, 0);
+ computeIntersection((x0 - pdx) + omx, (y0 - pdy) + omy, x0 + omx, y0 + omy,
+ (dx + x0) + mx, (dy + y0) + my, x0 + mx, y0 + my,
+ miter, 0);
float lenSq = (miter[0]-x0)*(miter[0]-x0) + (miter[1]-y0)*(miter[1]-y0);
+ // If the lines are parallel, lenSq will be either NaN or +inf
+ // (actually, I'm not sure if the latter is possible. The important
+ // thing is that -inf is not possible, because lenSq is a square).
+ // For both of those values, the comparison below will fail and
+ // no miter will be drawn, which is correct.
if (lenSq < miterLimitSq) {
emitLineTo(miter[0], miter[1], rev);
}
@@ -566,8 +566,8 @@
// if p1 == p2 && p3 == p4: draw line from p1->p4, unless p1 == p4,
// in which case ignore if p1 == p2
- final boolean p1eqp2 = within(x1,y1,x2,y2, 6 * Math.ulp(y2));
- final boolean p3eqp4 = within(x3,y3,x4,y4, 6 * Math.ulp(y4));
+ final boolean p1eqp2 = within(x1,y1,x2,y2, 6 * ulp(y2));
+ final boolean p3eqp4 = within(x3,y3,x4,y4, 6 * ulp(y4));
if (p1eqp2 && p3eqp4) {
getLineOffsets(x1, y1, x4, y4, leftOff, rightOff);
return 4;
@@ -583,7 +583,7 @@
float dotsq = (dx1 * dx4 + dy1 * dy4);
dotsq = dotsq * dotsq;
float l1sq = dx1 * dx1 + dy1 * dy1, l4sq = dx4 * dx4 + dy4 * dy4;
- if (Helpers.within(dotsq, l1sq * l4sq, 4 * Math.ulp(dotsq))) {
+ if (Helpers.within(dotsq, l1sq * l4sq, 4 * ulp(dotsq))) {
getLineOffsets(x1, y1, x4, y4, leftOff, rightOff);
return 4;
}
@@ -693,8 +693,6 @@
return 8;
}
- // compute offset curves using bezier spline through t=0.5 (i.e.
- // ComputedCurve(0.5) == IdealParallelCurve(0.5))
// return the kind of curve in the right and left arrays.
private int computeOffsetQuad(float[] pts, final int off,
float[] leftOff, float[] rightOff)
@@ -703,56 +701,67 @@
final float x2 = pts[off + 2], y2 = pts[off + 3];
final float x3 = pts[off + 4], y3 = pts[off + 5];
- float dx3 = x3 - x2;
- float dy3 = y3 - y2;
- float dx1 = x2 - x1;
- float dy1 = y2 - y1;
+ final float dx3 = x3 - x2;
+ final float dy3 = y3 - y2;
+ final float dx1 = x2 - x1;
+ final float dy1 = y2 - y1;
+
+ // this computes the offsets at t = 0, 1
+ computeOffset(dx1, dy1, lineWidth2, offset[0]);
+ computeOffset(dx3, dy3, lineWidth2, offset[1]);
+
+ leftOff[0] = x1 + offset[0][0]; leftOff[1] = y1 + offset[0][1];
+ leftOff[4] = x3 + offset[1][0]; leftOff[5] = y3 + offset[1][1];
+ rightOff[0] = x1 - offset[0][0]; rightOff[1] = y1 - offset[0][1];
+ rightOff[4] = x3 - offset[1][0]; rightOff[5] = y3 - offset[1][1];
+
+ float x1p = leftOff[0]; // start
+ float y1p = leftOff[1]; // point
+ float x3p = leftOff[4]; // end
+ float y3p = leftOff[5]; // point
- // if p1=p2 or p3=p4 it means that the derivative at the endpoint
- // vanishes, which creates problems with computeOffset. Usually
- // this happens when this stroker object is trying to winden
- // a curve with a cusp. What happens is that curveTo splits
- // the input curve at the cusp, and passes it to this function.
- // because of inaccuracies in the splitting, we consider points
- // equal if they're very close to each other.
+ // Corner cases:
+ // 1. If the two control vectors are parallel, we'll end up with NaN's
+ // in leftOff (and rightOff in the body of the if below), so we'll
+ // do getLineOffsets, which is right.
+ // 2. If the first or second two points are equal, then (dx1,dy1)==(0,0)
+ // or (dx3,dy3)==(0,0), so (x1p, y1p)==(x1p+dx1, y1p+dy1)
+ // or (x3p, y3p)==(x3p-dx3, y3p-dy3), which means that
+ // computeIntersection will put NaN's in leftOff and right off, and
+ // we will do getLineOffsets, which is right.
+ computeIntersection(x1p, y1p, x1p+dx1, y1p+dy1, x3p, y3p, x3p-dx3, y3p-dy3, leftOff, 2);
+ float cx = leftOff[2];
+ float cy = leftOff[3];
- // if p1 == p2 && p3 == p4: draw line from p1->p4, unless p1 == p4,
- // in which case ignore.
- final boolean p1eqp2 = within(x1,y1,x2,y2, 6 * Math.ulp(y2));
- final boolean p2eqp3 = within(x2,y2,x3,y3, 6 * Math.ulp(y3));
- if (p1eqp2 || p2eqp3) {
- getLineOffsets(x1, y1, x3, y3, leftOff, rightOff);
- return 4;
+ if (!(isFinite(cx) && isFinite(cy))) {
+ // maybe the right path is not degenerate.
+ x1p = rightOff[0];
+ y1p = rightOff[1];
+ x3p = rightOff[4];
+ y3p = rightOff[5];
+ computeIntersection(x1p, y1p, x1p+dx1, y1p+dy1, x3p, y3p, x3p-dx3, y3p-dy3, rightOff, 2);
+ cx = rightOff[2];
+ cy = rightOff[3];
+ if (!(isFinite(cx) && isFinite(cy))) {
+ // both are degenerate. This curve is a line.
+ getLineOffsets(x1, y1, x3, y3, leftOff, rightOff);
+ return 4;
+ }
+ // {left,right}Off[0,1,4,5] are already set to the correct values.
+ leftOff[2] = 2*x2 - cx;
+ leftOff[3] = 2*y2 - cy;
+ return 6;
}
- // if p2-p1 and p4-p3 are parallel, that must mean this curve is a line
- float dotsq = (dx1 * dx3 + dy1 * dy3);
- dotsq = dotsq * dotsq;
- float l1sq = dx1 * dx1 + dy1 * dy1, l3sq = dx3 * dx3 + dy3 * dy3;
- if (Helpers.within(dotsq, l1sq * l3sq, 4 * Math.ulp(dotsq))) {
- getLineOffsets(x1, y1, x3, y3, leftOff, rightOff);
- return 4;
- }
+ // rightOff[2,3] = (x2,y2) - ((left_x2, left_y2) - (x2, y2))
+ // == 2*(x2, y2) - (left_x2, left_y2)
+ rightOff[2] = 2*x2 - cx;
+ rightOff[3] = 2*y2 - cy;
+ return 6;
+ }
- // this computes the offsets at t=0, 0.5, 1, using the property that
- // for any bezier curve the vectors p2-p1 and p4-p3 are parallel to
- // the (dx/dt, dy/dt) vectors at the endpoints.
- computeOffset(dx1, dy1, lineWidth2, offset[0]);
- computeOffset(dx3, dy3, lineWidth2, offset[1]);
- float x1p = x1 + offset[0][0]; // start
- float y1p = y1 + offset[0][1]; // point
- float x3p = x3 + offset[1][0]; // end
- float y3p = y3 + offset[1][1]; // point
-
- computeMiter(x1p, y1p, x1p+dx1, y1p+dy1, x3p, y3p, x3p-dx3, y3p-dy3, leftOff, 2);
- leftOff[0] = x1p; leftOff[1] = y1p;
- leftOff[4] = x3p; leftOff[5] = y3p;
- x1p = x1 - offset[0][0]; y1p = y1 - offset[0][1];
- x3p = x3 - offset[1][0]; y3p = y3 - offset[1][1];
- computeMiter(x1p, y1p, x1p+dx1, y1p+dy1, x3p, y3p, x3p-dx3, y3p-dy3, rightOff, 2);
- rightOff[0] = x1p; rightOff[1] = y1p;
- rightOff[4] = x3p; rightOff[5] = y3p;
- return 6;
+ private static boolean isFinite(float x) {
+ return (Float.NEGATIVE_INFINITY < x && x < Float.POSITIVE_INFINITY);
}
// This is where the curve to be processed is put. We give it
@@ -812,12 +821,12 @@
// if these vectors are too small, normalize them, to avoid future
// precision problems.
if (Math.abs(dxs) < 0.1f && Math.abs(dys) < 0.1f) {
- float len = (float)Math.sqrt(dxs*dxs + dys*dys);
+ float len = (float) sqrt(dxs*dxs + dys*dys);
dxs /= len;
dys /= len;
}
if (Math.abs(dxf) < 0.1f && Math.abs(dyf) < 0.1f) {
- float len = (float)Math.sqrt(dxf*dxf + dyf*dyf);
+ float len = (float) sqrt(dxf*dxf + dyf*dyf);
dxf /= len;
dyf /= len;
}
@@ -834,7 +843,6 @@
while(it.hasNext()) {
int curCurveOff = it.next();
- kind = 0;
switch (type) {
case 8:
kind = computeOffsetCubic(middle, curCurveOff, lp, rp);
@@ -843,24 +851,22 @@
kind = computeOffsetQuad(middle, curCurveOff, lp, rp);
break;
}
- if (kind != 0) {
- emitLineTo(lp[0], lp[1]);
- switch(kind) {
- case 8:
- emitCurveTo(lp[0], lp[1], lp[2], lp[3], lp[4], lp[5], lp[6], lp[7], false);
- emitCurveTo(rp[0], rp[1], rp[2], rp[3], rp[4], rp[5], rp[6], rp[7], true);
- break;
- case 6:
- emitQuadTo(lp[0], lp[1], lp[2], lp[3], lp[4], lp[5], false);
- emitQuadTo(rp[0], rp[1], rp[2], rp[3], rp[4], rp[5], true);
- break;
- case 4:
- emitLineTo(lp[2], lp[3]);
- emitLineTo(rp[0], rp[1], true);
- break;
- }
- emitLineTo(rp[kind - 2], rp[kind - 1], true);
+ emitLineTo(lp[0], lp[1]);
+ switch(kind) {
+ case 8:
+ emitCurveTo(lp[0], lp[1], lp[2], lp[3], lp[4], lp[5], lp[6], lp[7], false);
+ emitCurveTo(rp[0], rp[1], rp[2], rp[3], rp[4], rp[5], rp[6], rp[7], true);
+ break;
+ case 6:
+ emitQuadTo(lp[0], lp[1], lp[2], lp[3], lp[4], lp[5], false);
+ emitQuadTo(rp[0], rp[1], rp[2], rp[3], rp[4], rp[5], true);
+ break;
+ case 4:
+ emitLineTo(lp[2], lp[3]);
+ emitLineTo(rp[0], rp[1], true);
+ break;
}
+ emitLineTo(rp[kind - 2], rp[kind - 1], true);
}
this.cmx = (lp[kind - 2] - rp[kind - 2]) / 2;
@@ -887,7 +893,7 @@
// we rotate it so that the first vector in the control polygon is
// parallel to the x-axis. This will ensure that rotated quarter
// circles won't be subdivided.
- final float hypot = (float)Math.sqrt(x12 * x12 + y12 * y12);
+ final float hypot = (float) sqrt(x12 * x12 + y12 * y12);
final float cos = x12 / hypot;
final float sin = y12 / hypot;
final float x1 = cos * pts[0] + sin * pts[1];
@@ -976,12 +982,12 @@
// if these vectors are too small, normalize them, to avoid future
// precision problems.
if (Math.abs(dxs) < 0.1f && Math.abs(dys) < 0.1f) {
- float len = (float)Math.sqrt(dxs*dxs + dys*dys);
+ float len = (float) sqrt(dxs*dxs + dys*dys);
dxs /= len;
dys /= len;
}
if (Math.abs(dxf) < 0.1f && Math.abs(dyf) < 0.1f) {
- float len = (float)Math.sqrt(dxf*dxf + dyf*dyf);
+ float len = (float) sqrt(dxf*dxf + dyf*dyf);
dxf /= len;
dyf /= len;
}
@@ -999,20 +1005,18 @@
int curCurveOff = it.next();
kind = computeOffsetCubic(middle, curCurveOff, lp, rp);
- if (kind != 0) {
- emitLineTo(lp[0], lp[1]);
- switch(kind) {
- case 8:
- emitCurveTo(lp[0], lp[1], lp[2], lp[3], lp[4], lp[5], lp[6], lp[7], false);
- emitCurveTo(rp[0], rp[1], rp[2], rp[3], rp[4], rp[5], rp[6], rp[7], true);
- break;
- case 4:
- emitLineTo(lp[2], lp[3]);
- emitLineTo(rp[0], rp[1], true);
- break;
- }
- emitLineTo(rp[kind - 2], rp[kind - 1], true);
+ emitLineTo(lp[0], lp[1]);
+ switch(kind) {
+ case 8:
+ emitCurveTo(lp[0], lp[1], lp[2], lp[3], lp[4], lp[5], lp[6], lp[7], false);
+ emitCurveTo(rp[0], rp[1], rp[2], rp[3], rp[4], rp[5], rp[6], rp[7], true);
+ break;
+ case 4:
+ emitLineTo(lp[2], lp[3]);
+ emitLineTo(rp[0], rp[1], true);
+ break;
}
+ emitLineTo(rp[kind - 2], rp[kind - 1], true);
}
this.cmx = (lp[kind - 2] - rp[kind - 2]) / 2;
@@ -1050,12 +1054,12 @@
// if these vectors are too small, normalize them, to avoid future
// precision problems.
if (Math.abs(dxs) < 0.1f && Math.abs(dys) < 0.1f) {
- float len = (float)Math.sqrt(dxs*dxs + dys*dys);
+ float len = (float) sqrt(dxs*dxs + dys*dys);
dxs /= len;
dys /= len;
}
if (Math.abs(dxf) < 0.1f && Math.abs(dyf) < 0.1f) {
- float len = (float)Math.sqrt(dxf*dxf + dyf*dyf);
+ float len = (float) sqrt(dxf*dxf + dyf*dyf);
dxf /= len;
dyf /= len;
}
@@ -1073,20 +1077,18 @@
int curCurveOff = it.next();
kind = computeOffsetQuad(middle, curCurveOff, lp, rp);
- if (kind != 0) {
- emitLineTo(lp[0], lp[1]);
- switch(kind) {
- case 6:
- emitQuadTo(lp[0], lp[1], lp[2], lp[3], lp[4], lp[5], false);
- emitQuadTo(rp[0], rp[1], rp[2], rp[3], rp[4], rp[5], true);
- break;
- case 4:
- emitLineTo(lp[2], lp[3]);
- emitLineTo(rp[0], rp[1], true);
- break;
- }
- emitLineTo(rp[kind - 2], rp[kind - 1], true);
+ emitLineTo(lp[0], lp[1]);
+ switch(kind) {
+ case 6:
+ emitQuadTo(lp[0], lp[1], lp[2], lp[3], lp[4], lp[5], false);
+ emitQuadTo(rp[0], rp[1], rp[2], rp[3], rp[4], rp[5], true);
+ break;
+ case 4:
+ emitLineTo(lp[2], lp[3]);
+ emitLineTo(rp[0], rp[1], true);
+ break;
}
+ emitLineTo(rp[kind - 2], rp[kind - 1], true);
}
this.cmx = (lp[kind - 2] - rp[kind - 2]) / 2;
diff -r 61242d00821f -r efa758101257 jdk/src/share/classes/sun/swing/FilePane.java
--- a/jdk/src/share/classes/sun/swing/FilePane.java Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/share/classes/sun/swing/FilePane.java Mon May 09 01:47:05 2011 -0700
@@ -763,7 +763,7 @@
public void setValueAt(Object value, int row, int col) {
if (col == COLUMN_FILENAME) {
- JFileChooser chooser = getFileChooser();
+ final JFileChooser chooser = getFileChooser();
File f = (File)getValueAt(row, col);
if (f != null) {
String oldDisplayName = chooser.getName(f);
@@ -782,18 +782,25 @@
// rename
FileSystemView fsv = chooser.getFileSystemView();
- File f2 = fsv.createFileObject(f.getParentFile(), newFileName);
+ final File f2 = fsv.createFileObject(f.getParentFile(), newFileName);
if (f2.exists()) {
JOptionPane.showMessageDialog(chooser, MessageFormat.format(renameErrorFileExistsText,
oldFileName), renameErrorTitleText, JOptionPane.ERROR_MESSAGE);
} else {
if (FilePane.this.getModel().renameFile(f, f2)) {
if (fsv.isParent(chooser.getCurrentDirectory(), f2)) {
- if (chooser.isMultiSelectionEnabled()) {
- chooser.setSelectedFiles(new File[]{f2});
- } else {
- chooser.setSelectedFile(f2);
- }
+ // The setSelectedFile method produces a new setValueAt invocation while the JTable
+ // is editing. Postpone file selection to be sure that edit mode of the JTable
+ // is completed
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ if (chooser.isMultiSelectionEnabled()) {
+ chooser.setSelectedFiles(new File[]{f2});
+ } else {
+ chooser.setSelectedFile(f2);
+ }
+ }
+ });
} else {
// Could be because of delay in updating Desktop folder
// chooser.setSelectedFile(null);
diff -r 61242d00821f -r efa758101257 jdk/src/share/classes/sun/swing/WindowsPlacesBar.java
--- a/jdk/src/share/classes/sun/swing/WindowsPlacesBar.java Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/share/classes/sun/swing/WindowsPlacesBar.java Mon May 09 01:47:05 2011 -0700
@@ -29,6 +29,8 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.*;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import javax.swing.*;
import javax.swing.border.*;
@@ -79,7 +81,12 @@
setBackground(bgColor);
FileSystemView fsv = fc.getFileSystemView();
- files = (File[])ShellFolder.get("fileChooserShortcutPanelFolders");
+ files = AccessController.doPrivileged(new PrivilegedAction() {
+ public File[] run() {
+ return (File[]) ShellFolder.get("fileChooserShortcutPanelFolders");
+ }
+ });
+
buttons = new JToggleButton[files.length];
buttonGroup = new ButtonGroup();
for (int i = 0; i < files.length; i++) {
diff -r 61242d00821f -r efa758101257 jdk/src/share/native/sun/awt/giflib/dgif_lib.c
--- a/jdk/src/share/native/sun/awt/giflib/dgif_lib.c Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/share/native/sun/awt/giflib/dgif_lib.c Mon May 09 01:47:05 2011 -0700
@@ -70,7 +70,7 @@
/* avoid extra function call in case we use fread (TVT) */
#define READ(_gif,_buf,_len) \
(((GifFilePrivateType*)_gif->Private)->Read ? \
- ((GifFilePrivateType*)_gif->Private)->Read(_gif,_buf,_len) : \
+ (size_t)((GifFilePrivateType*)_gif->Private)->Read(_gif,_buf,_len) : \
fread(_buf,1,_len,((GifFilePrivateType*)_gif->Private)->File))
static int DGifGetWord(GifFileType *GifFile, int *Word);
diff -r 61242d00821f -r efa758101257 jdk/src/share/native/sun/font/fontscalerdefs.h
--- a/jdk/src/share/native/sun/font/fontscalerdefs.h Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/share/native/sun/font/fontscalerdefs.h Mon May 09 01:47:05 2011 -0700
@@ -55,13 +55,15 @@
typedef Int32 hsFract;
typedef UInt32 Bool32;
+#ifndef __cplusplus
#ifndef false
- #define false 0
+ #define false 0
#endif
#ifndef true
#define true 1
#endif
+#endif
#define kPosInfinity32 (0x7fffffff)
#define kNegInfinity32 (0x80000000)
diff -r 61242d00821f -r efa758101257 jdk/src/share/native/sun/font/layout/HangulLayoutEngine.cpp
--- a/jdk/src/share/native/sun/font/layout/HangulLayoutEngine.cpp Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/share/native/sun/font/layout/HangulLayoutEngine.cpp Mon May 09 01:47:05 2011 -0700
@@ -162,7 +162,7 @@
return 0;
}
- lead = LJMO_FIRST + (sIndex / HSYL_LVCNT);
+ lead = (LEUnicode)(LJMO_FIRST + (sIndex / HSYL_LVCNT));
vowel = VJMO_FIRST + (sIndex % HSYL_LVCNT) / TJMO_COUNT;
trail = TJMO_FIRST + (sIndex % TJMO_COUNT);
diff -r 61242d00821f -r efa758101257 jdk/src/share/native/sun/font/layout/MPreFixups.cpp
--- a/jdk/src/share/native/sun/font/layout/MPreFixups.cpp Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/share/native/sun/font/layout/MPreFixups.cpp Mon May 09 01:47:05 2011 -0700
@@ -65,9 +65,9 @@
}
}
-void MPreFixups::apply(LEGlyphStorage &glyphStorage, LEErrorCode& success)
+void MPreFixups::apply(LEGlyphStorage &glyphStorage, LEErrorCode& leSuccess)
{
- if (LE_FAILURE(success)) {
+ if (LE_FAILURE(leSuccess)) {
return;
}
diff -r 61242d00821f -r efa758101257 jdk/src/solaris/classes/sun/awt/X11/XListPeer.java
--- a/jdk/src/solaris/classes/sun/awt/X11/XListPeer.java Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XListPeer.java Mon May 09 01:47:05 2011 -0700
@@ -1479,16 +1479,19 @@
int h = height - (SCROLLBAR_AREA + (2 * MARGIN));
hsb.setValue(hsb.getValue() + x);
+ int options = PAINT_ITEMS | PAINT_HSCROLL;
+
Rectangle source = null;
Point distance = null;
if (x < 0) {
source = new Rectangle(MARGIN + SPACE, MARGIN, w + x, h);
distance = new Point(-x, 0);
+ options |= COPY_AREA;
} else if (x > 0) {
source = new Rectangle(MARGIN + SPACE + x, MARGIN, w - x, h);
distance = new Point(-x, 0);
+ options |= COPY_AREA;
}
- int options = COPY_AREA | PAINT_ITEMS | PAINT_HSCROLL;
repaint(vsb.getValue(), lastItemDisplayed(), options, source, distance);
}
diff -r 61242d00821f -r efa758101257 jdk/src/solaris/classes/sun/font/FcFontConfiguration.java
--- a/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java Mon May 09 01:47:05 2011 -0700
@@ -256,9 +256,9 @@
}
if (installedFallbackFontFiles != null) {
- System.arraycopy(fileNames, index,
- installedFallbackFontFiles,
- 0, installedFallbackFontFiles.length);
+ System.arraycopy(installedFallbackFontFiles, 0,
+ fileNames, fcFonts.length,
+ installedFallbackFontFiles.length);
}
result[fontIndex * NUM_STYLES + styleIndex]
diff -r 61242d00821f -r efa758101257 jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_PCM.c
--- a/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_PCM.c Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_PCM.c Mon May 09 01:47:05 2011 -0700
@@ -239,6 +239,13 @@
snd_pcm_close(handle);
}
+/** Workaround for cr 7033899, 7030629:
+ * dmix plugin doesn't like flush (snd_pcm_drop) when the buffer is empty
+ * (just opened, underruned or already flushed).
+ * Sometimes it causes PCM falls to -EBADFD error,
+ * sometimes causes bufferSize change.
+ * To prevent unnecessary flushes AlsaPcmInfo::isRunning & isFlushed are used.
+ */
/* ******* ALSA PCM INFO ******************** */
typedef struct tag_AlsaPcmInfo {
snd_pcm_t* handle;
@@ -248,6 +255,8 @@
int frameSize; // storage size in Bytes
unsigned int periods;
snd_pcm_uframes_t periodSize;
+ short int isRunning; // see comment above
+ short int isFlushed; // see comment above
#ifdef GET_POSITION_METHOD2
// to be used exclusively by getBytePosition!
snd_pcm_status_t* positionStatus;
@@ -432,6 +441,9 @@
return NULL;
}
memset(info, 0, sizeof(AlsaPcmInfo));
+ // initial values are: stopped, flushed
+ info->isRunning = 0;
+ info->isFlushed = 1;
ret = openPCMfromDeviceID(deviceID, &(info->handle), isSource, FALSE /* do open device*/);
if (ret == 0) {
@@ -587,6 +599,14 @@
|| (state == SND_PCM_STATE_RUNNING)
|| (state == SND_PCM_STATE_XRUN)
|| (state == SND_PCM_STATE_SUSPENDED);
+ if (ret) {
+ info->isRunning = 1;
+ // source line should keep isFlushed value until Write() is called;
+ // for target data line reset it right now.
+ if (!isSource) {
+ info->isFlushed = 0;
+ }
+ }
TRACE1("< DAUDIO_Start %s\n", ret?"success":"error");
return ret?TRUE:FALSE;
}
@@ -606,6 +626,7 @@
ERROR1("ERROR in snd_pcm_pause: %s\n", snd_strerror(ret));
return FALSE;
}
+ info->isRunning = 0;
TRACE0("< DAUDIO_Stop success\n");
return TRUE;
}
@@ -651,8 +672,7 @@
return -1;
}
return 1;
- }
- else if (err == -ESTRPIPE) {
+ } else if (err == -ESTRPIPE) {
TRACE0("xrun_recovery: suspended.\n");
ret = snd_pcm_resume(info->handle);
if (ret < 0) {
@@ -667,11 +687,11 @@
return -1;
}
return 1;
- }
- else if (err == -EAGAIN) {
+ } else if (err == -EAGAIN) {
TRACE0("xrun_recovery: EAGAIN try again flag.\n");
return 0;
}
+
TRACE2("xrun_recovery: unexpected error %d: %s\n", err, snd_strerror(err));
return -1;
}
@@ -691,6 +711,7 @@
TRACE0("< DAUDIO_Write returning -1\n");
return -1;
}
+
count = 2; // maximum number of trials to recover from underrun
//frameSize = snd_pcm_bytes_to_frames(info->handle, byteSize);
frameSize = (snd_pcm_sframes_t) (byteSize / info->frameSize);
@@ -712,6 +733,12 @@
}
} while (TRUE);
//ret = snd_pcm_frames_to_bytes(info->handle, writtenFrames);
+
+ if (writtenFrames > 0) {
+ // reset "flushed" flag
+ info->isFlushed = 0;
+ }
+
ret = (int) (writtenFrames * info->frameSize);
TRACE1("< DAUDIO_Write: returning %d bytes.\n", ret);
return ret;
@@ -736,6 +763,11 @@
TRACE0("< DAUDIO_Read returning -1\n");
return -1;
}
+ if (!info->isRunning && info->isFlushed) {
+ // PCM has nothing to read
+ return 0;
+ }
+
count = 2; // maximum number of trials to recover from error
//frameSize = snd_pcm_bytes_to_frames(info->handle, byteSize);
frameSize = (snd_pcm_sframes_t) (byteSize / info->frameSize);
@@ -784,12 +816,22 @@
int ret;
TRACE0("DAUDIO_Flush\n");
+
+ if (info->isFlushed) {
+ // nothing to drop
+ return 1;
+ }
+
ret = snd_pcm_drop(info->handle);
if (ret != 0) {
ERROR1("ERROR in snd_pcm_drop: %s\n", snd_strerror(ret));
return FALSE;
}
- ret = DAUDIO_Start(id, isSource);
+
+ info->isFlushed = 1;
+ if (info->isRunning) {
+ ret = DAUDIO_Start(id, isSource);
+ }
return ret;
}
@@ -800,7 +842,7 @@
int ret;
state = snd_pcm_state(info->handle);
- if (state == SND_PCM_STATE_XRUN) {
+ if (info->isFlushed || state == SND_PCM_STATE_XRUN) {
// if in xrun state then we have the entire buffer available,
// not 0 as alsa reports
ret = info->bufferSizeInBytes;
@@ -841,7 +883,7 @@
snd_pcm_state_t state;
state = snd_pcm_state(info->handle);
- if (state != SND_PCM_STATE_XRUN) {
+ if (!info->isFlushed && state != SND_PCM_STATE_XRUN) {
#ifdef GET_POSITION_METHOD2
snd_timestamp_t* ts;
snd_pcm_uframes_t framesAvail;
diff -r 61242d00821f -r efa758101257 jdk/src/solaris/native/sun/awt/fontpath.c
--- a/jdk/src/solaris/native/sun/awt/fontpath.c Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/solaris/native/sun/awt/fontpath.c Mon May 09 01:47:05 2011 -0700
@@ -1107,7 +1107,8 @@
arrlen = (*env)->GetArrayLength(env, fcCompFontArray);
for (i=0; iNewString(env, lpelfe->elfFullName,
- wcslen((LPWSTR)lpelfe->elfFullName));
+ (jsize)wcslen((LPWSTR)lpelfe->elfFullName));
fullnameLC = (*env)->CallObjectMethod(env, fullname,
fmi->toLowerCaseMID, fmi->locale);
(*env)->CallBooleanMethod(env, fmi->list, fmi->addMID, fullname);
@@ -314,7 +314,7 @@
GdiFontMapInfo *fmi = (GdiFontMapInfo*)lParam;
JNIEnv *env = fmi->env;
jstring familyLC;
- int slen;
+ size_t slen;
LOGFONTW lfw;
/* Both Vista and XP return DEVICE_FONTTYPE for OTF fonts */
@@ -336,7 +336,7 @@
return 1;
}
slen = wcslen(lpelfe->elfLogFont.lfFaceName);
- fmi->family = (*env)->NewString(env,lpelfe->elfLogFont.lfFaceName, slen);
+ fmi->family = (*env)->NewString(env,lpelfe->elfLogFont.lfFaceName, (jsize)slen);
familyLC = (*env)->CallObjectMethod(env, fmi->family,
fmi->toLowerCaseMID, fmi->locale);
/* check if already seen this family with a different charset */
@@ -386,10 +386,10 @@
static BOOL RegistryToBaseTTNameA(LPSTR name) {
static const char TTSUFFIX[] = " (TrueType)";
static const char OTSUFFIX[] = " (OpenType)";
- int TTSLEN = strlen(TTSUFFIX);
+ size_t TTSLEN = strlen(TTSUFFIX);
char *suffix;
- int len = strlen(name);
+ size_t len = strlen(name);
if (len == 0) {
return FALSE;
}
@@ -412,10 +412,10 @@
static BOOL RegistryToBaseTTNameW(LPWSTR name) {
static const wchar_t TTSUFFIX[] = L" (TrueType)";
static const wchar_t OTSUFFIX[] = L" (OpenType)";
- int TTSLEN = wcslen(TTSUFFIX);
+ size_t TTSLEN = wcslen(TTSUFFIX);
wchar_t *suffix;
- int len = wcslen(name);
+ size_t len = wcslen(name);
if (len == 0) {
return FALSE;
}
@@ -439,7 +439,7 @@
LPSTR ptr1, ptr2;
jstring fontStr;
JNIEnv *env = fmi->env;
- int dslen = strlen(data);
+ size_t dslen = strlen(data);
jstring fileStr = JNU_NewStringPlatform(env, data);
/* TTC or ttc means it may be a collection. Need to parse out
@@ -488,8 +488,8 @@
wchar_t *ptr1, *ptr2;
jstring fontStr;
JNIEnv *env = fmi->env;
- int dslen = wcslen(data);
- jstring fileStr = (*env)->NewString(env, data, dslen);
+ size_t dslen = wcslen(data);
+ jstring fileStr = (*env)->NewString(env, data, (jsize)dslen);
/* TTC or ttc means it may be a collection. Need to parse out
* multiple font face names separated by " & "
@@ -510,7 +510,7 @@
while ((ptr2 = wcsstr(ptr1, L" & ")) != NULL) {
ptr1 = ptr2+3;
}
- fontStr = (*env)->NewString(env, ptr1, wcslen(ptr1));
+ fontStr = (*env)->NewString(env, ptr1, (jsize)wcslen(ptr1));
fontStr = (*env)->CallObjectMethod(env, fontStr,
fmi->toLowerCaseMID,
fmi->locale);
@@ -524,7 +524,7 @@
}
}
} else {
- fontStr = (*env)->NewString(env, name, wcslen(name));
+ fontStr = (*env)->NewString(env, name, (jsize)wcslen(name));
fontStr = (*env)->CallObjectMethod(env, fontStr,
fmi->toLowerCaseMID, fmi->locale);
(*env)->CallObjectMethod(env, fontToFileMap, fmi->putMID,
diff -r 61242d00821f -r efa758101257 jdk/src/windows/native/sun/java2d/d3d/D3DPipelineManager.cpp
--- a/jdk/src/windows/native/sun/java2d/d3d/D3DPipelineManager.cpp Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/windows/native/sun/java2d/d3d/D3DPipelineManager.cpp Mon May 09 01:47:05 2011 -0700
@@ -187,6 +187,7 @@
}
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
+ RETURN_IF_NULL(env);
pMgr = D3DPipelineManager::GetInstance();
RETURN_IF_NULL(pMgr);
diff -r 61242d00821f -r efa758101257 jdk/src/windows/native/sun/windows/ObjectList.cpp
--- a/jdk/src/windows/native/sun/windows/ObjectList.cpp Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/ObjectList.cpp Mon May 09 01:47:05 2011 -0700
@@ -48,7 +48,7 @@
m_head = item;
}
-void AwtObjectList::Remove(AwtObject* obj)
+BOOL AwtObjectList::Remove(AwtObject* obj)
{
CriticalSection::Lock l(m_lock);
@@ -64,11 +64,14 @@
}
DASSERT(item != NULL);
delete item;
- return;
+ return TRUE;
}
lastItem = item;
item = item->next;
}
+
+ return FALSE;
+
// DASSERT(FALSE); // should never get here...
// even if it does it shouldn't be fatal.
}
diff -r 61242d00821f -r efa758101257 jdk/src/windows/native/sun/windows/ObjectList.h
--- a/jdk/src/windows/native/sun/windows/ObjectList.h Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/ObjectList.h Mon May 09 01:47:05 2011 -0700
@@ -46,7 +46,7 @@
AwtObjectList();
void Add(AwtObject* obj);
- void Remove(AwtObject* obj);
+ BOOL Remove(AwtObject* obj);
#ifdef DEBUG
/* Used for sanity checks only. */
AwtObject* LookUp(AwtObject* obj);
diff -r 61242d00821f -r efa758101257 jdk/src/windows/native/sun/windows/awt_Clipboard.cpp
--- a/jdk/src/windows/native/sun/windows/awt_Clipboard.cpp Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Clipboard.cpp Mon May 09 01:47:05 2011 -0700
@@ -294,7 +294,7 @@
if (format == CF_HDROP) {
DROPFILES *dropfiles = (DROPFILES *)dataout;
dropfiles->pFiles = sizeof(DROPFILES);
- dropfiles->fWide = FALSE; // good guess!
+ dropfiles->fWide = TRUE; // we publish only Unicode
dataout += sizeof(DROPFILES);
}
diff -r 61242d00821f -r efa758101257 jdk/src/windows/native/sun/windows/awt_Component.cpp
--- a/jdk/src/windows/native/sun/windows/awt_Component.cpp Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Component.cpp Mon May 09 01:47:05 2011 -0700
@@ -549,8 +549,6 @@
m_hwnd = hwnd;
- ImmAssociateContext(NULL);
-
SetDrawState((jint)JAWT_LOCK_SURFACE_CHANGED |
(jint)JAWT_LOCK_BOUNDS_CHANGED |
(jint)JAWT_LOCK_CLIP_CHANGED);
@@ -1203,7 +1201,7 @@
WIN_MSG(WM_IME_COMPOSITIONFULL)
WIN_MSG(WM_IME_SELECT)
WIN_MSG(WM_IME_CHAR)
- FMT_MSG(0x0288, "WM_IME_REQUEST")
+ FMT_MSG(WM_IME_REQUEST)
WIN_MSG(WM_IME_KEYDOWN)
WIN_MSG(WM_IME_KEYUP)
FMT_MSG(0x02A1, "WM_MOUSEHOVER")
@@ -1733,7 +1731,7 @@
case WM_IME_SELECT:
case WM_IME_KEYUP:
case WM_IME_KEYDOWN:
- case 0x0288: // WM_IME_REQUEST
+ case WM_IME_REQUEST:
CallProxyDefWindowProc(message, wParam, lParam, retValue, mr);
break;
case WM_CHAR:
@@ -1969,7 +1967,9 @@
{
// fix for 6259348: we should enter the SyncCall critical section before
// disposing the native object, that is value 1 of lParam is intended for
- AwtToolkit::GetInstance().SendMessage(WM_AWT_DISPOSE, (WPARAM)this, (LPARAM)1);
+ if(m_peerObject != NULL) { // is not being terminating
+ AwtToolkit::GetInstance().SendMessage(WM_AWT_DISPOSE, (WPARAM)m_peerObject, (LPARAM)1);
+ }
return mrConsume;
}
@@ -2020,25 +2020,6 @@
MsgRouting AwtComponent::WmShowWindow(BOOL show, UINT status)
{
- // NULL-InputContext is associated to all window just after they created.
- // ( see CreateHWnd() )
- // But to TextField and TextArea on Win95, valid InputContext is associated
- // by system after that. This is not happen on NT4.0
- // For workaround, force context to NULL here.
-
- // Fix for 4730228
- // Check if we already have Java-associated input method
- HIMC context = 0;
- if (m_InputMethod != NULL) {
- // If so get the appropriate context from it and use it instead of empty context
- JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- context = (HIMC)(UINT_PTR)(JNU_GetFieldByName(env, NULL, m_InputMethod, "context", "I").i);
- }
-
- if (ImmGetContext() != 0 && ImmGetContext() != context) {
- ImmAssociateContext(context);
- }
-
return mrDoDefault;
}
@@ -4655,10 +4636,6 @@
ret:
if (c && ::IsWindow(c->GetHWnd())) {
sm_focusOwner = c->GetHWnd();
- AwtFrame *owner = (AwtFrame*)GetComponent(c->GetProxyToplevelContainer());
- if (owner) {
- owner->SetLastProxiedFocusOwner(sm_focusOwner);
- }
} else {
sm_focusOwner = NULL;
}
@@ -6534,8 +6511,7 @@
{
TRY_NO_HANG;
- PDATA pData = JNI_GET_PDATA(self);
- AwtObject::_Dispose(pData);
+ AwtObject::_Dispose(self);
CATCH_BAD_ALLOC;
}
diff -r 61242d00821f -r efa758101257 jdk/src/windows/native/sun/windows/awt_DnDDS.cpp
--- a/jdk/src/windows/native/sun/windows/awt_DnDDS.cpp Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_DnDDS.cpp Mon May 09 01:47:05 2011 -0700
@@ -843,7 +843,7 @@
dropfiles->pt.x = m_dropPoint.x;
dropfiles->pt.y = m_dropPoint.y;
dropfiles->fNC = m_fNC;
- dropfiles->fWide = TRUE; // good guess!
+ dropfiles->fWide = TRUE; // we publish only Unicode
dataout += sizeof(DROPFILES);
}
diff -r 61242d00821f -r efa758101257 jdk/src/windows/native/sun/windows/awt_Frame.cpp
--- a/jdk/src/windows/native/sun/windows/awt_Frame.cpp Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Frame.cpp Mon May 09 01:47:05 2011 -0700
@@ -109,7 +109,7 @@
m_isMenuDropped = FALSE;
m_isInputMethodWindow = FALSE;
m_isUndecorated = FALSE;
- m_lastProxiedFocusOwner = NULL;
+ m_imeTargetComponent = NULL;
m_actualFocusedWindow = NULL;
m_iconic = FALSE;
m_zoomed = FALSE;
@@ -311,6 +311,8 @@
LRESULT retValue = 0L;
AwtComponent *focusOwner = NULL;
+ AwtComponent *imeTargetComponent = NULL;
+
// IME and input language related messages need to be sent to a window
// which has the Java input focus
switch (message) {
@@ -323,15 +325,29 @@
case WM_IME_COMPOSITIONFULL:
case WM_IME_SELECT:
case WM_IME_CHAR:
- case 0x0288: // WM_IME_REQUEST
+ case WM_IME_REQUEST:
case WM_IME_KEYDOWN:
case WM_IME_KEYUP:
case WM_INPUTLANGCHANGEREQUEST:
case WM_INPUTLANGCHANGE:
+ if (message == WM_IME_STARTCOMPOSITION) {
+ SetImeTargetComponent(sm_focusOwner);
+ }
+ imeTargetComponent = AwtComponent::GetComponent(GetImeTargetComponent());
+ if (imeTargetComponent != NULL &&
+ imeTargetComponent != this) // avoid recursive calls
+ {
+ retValue = imeTargetComponent->WindowProc(message, wParam, lParam);
+ mr = mrConsume;
+ }
+ if (message == WM_IME_ENDCOMPOSITION) {
+ SetImeTargetComponent(NULL);
+ }
+ break;
// TODO: when a Choice's list is dropped down and we're scrolling in
// the list WM_MOUSEWHEEL messages come to the poxy, not to the list. Why?
case WM_MOUSEWHEEL:
- focusOwner = AwtComponent::GetComponent(GetLastProxiedFocusOwner());
+ focusOwner = AwtComponent::GetComponent(sm_focusOwner);
if (focusOwner != NULL &&
focusOwner != this) // avoid recursive calls
{
@@ -340,12 +356,16 @@
}
break;
case WM_SETFOCUS:
+ if (sm_inSynthesizeFocus) break; // pass it up the WindowProc chain
+
if (!sm_suppressFocusAndActivation && IsEmbeddedFrame()) {
AwtSetActiveWindow();
}
mr = mrConsume;
break;
case WM_KILLFOCUS:
+ if (sm_inSynthesizeFocus) break; // pass it up the WindowProc chain
+
if (!sm_suppressFocusAndActivation && IsEmbeddedFrame()) {
AwtWindow::SynthesizeWmActivate(FALSE, GetHWnd(), NULL);
diff -r 61242d00821f -r efa758101257 jdk/src/windows/native/sun/windows/awt_Frame.h
--- a/jdk/src/windows/native/sun/windows/awt_Frame.h Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Frame.h Mon May 09 01:47:05 2011 -0700
@@ -150,8 +150,8 @@
void CheckRetainActualFocusedWindow(HWND activatedOpositeHWnd);
BOOL CheckActivateActualFocusedWindow(HWND deactivatedOpositeHWnd);
- INLINE HWND GetLastProxiedFocusOwner() { return m_lastProxiedFocusOwner; }
- INLINE void SetLastProxiedFocusOwner(HWND hwnd) { m_lastProxiedFocusOwner = hwnd; }
+ INLINE HWND GetImeTargetComponent() { return m_imeTargetComponent; }
+ INLINE void SetImeTargetComponent(HWND hwnd) { m_imeTargetComponent = hwnd; }
protected:
/* The frame is undecorated. */
@@ -179,9 +179,8 @@
/* The frame is an InputMethodWindow */
BOOL m_isInputMethodWindow;
- /* Retains the last/current sm_focusOwner proxied. Actually, it should be
- * a component of an owned window last/currently active. */
- HWND m_lastProxiedFocusOwner;
+ // retains the target component for the IME messages
+ HWND m_imeTargetComponent;
/*
* Fix for 4823903.
diff -r 61242d00821f -r efa758101257 jdk/src/windows/native/sun/windows/awt_MenuItem.cpp
--- a/jdk/src/windows/native/sun/windows/awt_MenuItem.cpp Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_MenuItem.cpp Mon May 09 01:47:05 2011 -0700
@@ -974,8 +974,7 @@
{
TRY_NO_HANG;
- PDATA pData = JNI_GET_PDATA(self);
- AwtObject::_Dispose(pData);
+ AwtObject::_Dispose(self);
CATCH_BAD_ALLOC;
}
diff -r 61242d00821f -r efa758101257 jdk/src/windows/native/sun/windows/awt_Object.cpp
--- a/jdk/src/windows/native/sun/windows/awt_Object.cpp Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Object.cpp Mon May 09 01:47:05 2011 -0700
@@ -60,11 +60,20 @@
void AwtObject::Dispose()
{
- theAwtObjectList.Remove(this);
+ AwtToolkit::GetInstance().PostMessage(WM_AWT_DELETEOBJECT, (WPARAM)this, (LPARAM)0);
+}
+
+void AwtObject::_Dispose(jobject self)
+{
+ TRY_NO_VERIFY;
+
+ CriticalSection::Lock l(AwtToolkit::GetInstance().GetSyncCS());
// value 0 of lParam means that we should not attempt to enter the
// SyncCall critical section, as it was entered someshere earlier
- AwtToolkit::GetInstance().PostMessage(WM_AWT_DELETEOBJECT, (WPARAM)this, (LPARAM)0);
+ AwtToolkit::GetInstance().SendMessage(WM_AWT_DISPOSE, (WPARAM)self, (LPARAM)0);
+
+ CATCH_BAD_ALLOC;
}
void AwtObject::_Dispose(PDATA pData)
@@ -73,14 +82,10 @@
CriticalSection::Lock l(AwtToolkit::GetInstance().GetSyncCS());
- if (pData != NULL) {
- AwtObject *o = (AwtObject *)pData;
- AwtToolkit::GetInstance().SendMessage(WM_AWT_DISPOSE, (WPARAM)o, (LPARAM)0);
- }
+ AwtToolkit::GetInstance().SendMessage(WM_AWT_DISPOSEPDATA, (WPARAM)pData, (LPARAM)0);
CATCH_BAD_ALLOC;
}
-
/*
* Return the peer associated with some target. This information is
* maintained in a hashtable at the java level.
diff -r 61242d00821f -r efa758101257 jdk/src/windows/native/sun/windows/awt_Object.h
--- a/jdk/src/windows/native/sun/windows/awt_Object.h Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Object.h Mon May 09 01:47:05 2011 -0700
@@ -67,6 +67,10 @@
virtual void Dispose();
// Static method to be called from JNI methods to dispose AwtObject
+ // specified by jobject
+ static void _Dispose(jobject self);
+
+ // Static method to be called from JNI methods to dispose AwtObject
// specified by pData
static void _Dispose(PDATA pData);
diff -r 61242d00821f -r efa758101257 jdk/src/windows/native/sun/windows/awt_Robot.cpp
--- a/jdk/src/windows/native/sun/windows/awt_Robot.cpp Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Robot.cpp Mon May 09 01:47:05 2011 -0700
@@ -353,8 +353,7 @@
{
TRY_NO_VERIFY;
- PDATA pData = JNI_GET_PDATA(self);
- AwtObject::_Dispose(pData);
+ AwtObject::_Dispose(self);
CATCH_BAD_ALLOC;
}
diff -r 61242d00821f -r efa758101257 jdk/src/windows/native/sun/windows/awt_TextComponent.cpp
--- a/jdk/src/windows/native/sun/windows/awt_TextComponent.cpp Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_TextComponent.cpp Mon May 09 01:47:05 2011 -0700
@@ -191,8 +191,11 @@
{
HIMC hIMC = ImmGetContext();
// rc is not used for text component.
- COMPOSITIONFORM cf = { CFS_POINT, {0,0}, {0,0,0,0} };
+ COMPOSITIONFORM cf = { CFS_FORCE_POSITION, {0,0}, {0,0,0,0} };
GetCaretPos(&(cf.ptCurrentPos));
+ // the proxy is the native focus owner and it contains the composition window
+ // let's convert the position to a coordinate space relative to proxy
+ ::MapWindowPoints(GetHWnd(), GetProxyFocusOwner(), (LPPOINT)&cf.ptCurrentPos, 1);
ImmSetCompositionWindow(hIMC, &cf);
LOGFONT lf;
diff -r 61242d00821f -r efa758101257 jdk/src/windows/native/sun/windows/awt_Toolkit.cpp
--- a/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp Mon May 09 01:47:05 2011 -0700
@@ -740,18 +740,34 @@
canDispose = syncCS.TryEnter();
}
if (canDispose) {
- AwtObject *o = (AwtObject *)wParam;
- o->Dispose();
- if (shouldEnterCriticalSection) {
- syncCS.Leave();
+ if(wParam != NULL) {
+ AwtObject *o = (AwtObject *) JNI_GET_PDATA((jobject)wParam);
+ if(o != NULL && theAwtObjectList.Remove(o)) {
+ o->Dispose();
+ }
+ if (shouldEnterCriticalSection) {
+ syncCS.Leave();
+ }
}
} else {
AwtToolkit::GetInstance().PostMessage(WM_AWT_DISPOSE, wParam, lParam);
}
return 0;
}
+ case WM_AWT_DISPOSEPDATA: {
+ /*
+ * NOTE: synchronization routine (like in WM_AWT_DISPOSE) was omitted because
+ * this handler is called ONLY while disposing Cursor and Font objects where
+ * synchronization takes place.
+ */
+ AwtObject *o = (AwtObject *) wParam;
+ if(o != NULL && theAwtObjectList.Remove(o)) {
+ o->Dispose();
+ }
+ return 0;
+ }
case WM_AWT_DELETEOBJECT: {
- AwtObject *p = (AwtObject *)wParam;
+ AwtObject *p = (AwtObject *) wParam;
if (p->CanBeDeleted()) {
// all the messages for this component are processed, so
// it can be deleted
diff -r 61242d00821f -r efa758101257 jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp
--- a/jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp Mon May 09 01:47:05 2011 -0700
@@ -926,8 +926,7 @@
{
TRY;
- PDATA pData = JNI_GET_PDATA(self);
- AwtObject::_Dispose(pData);
+ AwtObject::_Dispose(self);
CATCH_BAD_ALLOC;
}
diff -r 61242d00821f -r efa758101257 jdk/src/windows/native/sun/windows/awtmsg.h
--- a/jdk/src/windows/native/sun/windows/awtmsg.h Fri May 06 17:06:25 2011 -0700
+++ b/jdk/src/windows/native/sun/windows/awtmsg.h Mon May 09 01:47:05 2011 -0700
@@ -219,6 +219,7 @@
WM_AWT_ENDCOMPOSITION,
WM_AWT_DISPOSE,
+ WM_AWT_DISPOSEPDATA,
WM_AWT_DELETEOBJECT,
WM_AWT_SETCONVERSIONSTATUS,
WM_AWT_GETCONVERSIONSTATUS,
diff -r 61242d00821f -r efa758101257 jdk/test/java/awt/Component/Revalidate/Revalidate.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Component/Revalidate/Revalidate.java Mon May 09 01:47:05 2011 -0700
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ @test
+ @bug 7036669
+ @summary Test Component.revalidate() method
+ @author anthony.petrov@oracle.com: area=awt.component
+ @run main Revalidate
+*/
+
+import java.awt.*;
+
+public class Revalidate {
+ private static Frame frame = new Frame();
+ private static Panel panel = new Panel() {
+ @Override
+ public boolean isValidateRoot() {
+ return true;
+ }
+ };
+ private static Button button = new Button("Test");
+
+ private static void sleep() {
+ try { Thread.sleep(500); } catch (Exception e) {}
+ }
+
+ private static void printState(String str) {
+ System.out.println(str + " isValid state: ");
+ System.out.println(" frame: " + frame.isValid());
+ System.out.println(" panel: " + panel.isValid());
+ System.out.println(" button: " + button.isValid());
+ }
+
+ private static void fail(String msg) {
+ frame.dispose();
+ throw new RuntimeException(msg);
+ }
+
+ private static void check(String n, Component c, boolean v) {
+ if (c.isValid() != v) {
+ fail(n + ".isValid() = " + c.isValid() + "; expected: " + v);
+ }
+ }
+ private static void check(String str, boolean f, boolean p, boolean b) {
+ printState(str);
+
+ check("frame", frame, f);
+ check("panel", panel, p);
+ check("button", button, b);
+ }
+
+ public static void main(String[] args) {
+ // setup
+ frame.add(panel);
+ panel.add(button);
+ frame.setBounds(200, 200, 300, 200);
+ frame.setVisible(true);
+ sleep();
+ check("Upon showing", true, true, true);
+
+ button.setBounds(1, 1, 30, 30);
+ sleep();
+ check("button.setBounds():", true, false, false);
+
+ button.revalidate();
+ sleep();
+ check("button.revalidate():", true, true, true);
+
+ button.setBounds(1, 1, 30, 30);
+ sleep();
+ check("button.setBounds():", true, false, false);
+
+ panel.revalidate();
+ sleep();
+ // because the panel's validate root is actually OK
+ check("panel.revalidate():", true, false, false);
+
+ button.revalidate();
+ sleep();
+ check("button.revalidate():", true, true, true);
+
+ panel.setBounds(2, 2, 125, 130);
+ sleep();
+ check("panel.setBounds():", false, false, true);
+
+ button.revalidate();
+ sleep();
+ check("button.revalidate():", false, true, true);
+
+ panel.setBounds(3, 3, 152, 121);
+ sleep();
+ check("panel.setBounds():", false, false, true);
+
+ panel.revalidate();
+ sleep();
+ check("panel.revalidate():", true, true, true);
+
+ // cleanup
+ frame.dispose();
+ }
+}
diff -r 61242d00821f -r efa758101257 jdk/test/java/awt/Graphics2D/MTGraphicsAccessTest/MTGraphicsAccessTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Graphics2D/MTGraphicsAccessTest/MTGraphicsAccessTest.java Mon May 09 01:47:05 2011 -0700
@@ -0,0 +1,361 @@
+/*
+ * Copyright (c) 2010, 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 5089429 6982632
+ @summary Checks that we don't crash if rendering operations and state
+ changes are performed on a graphics context from different threads.
+
+ @author Dmitri.Trembovetski@sun.com area=Graphics
+ @run main MTGraphicsAccessTest
+ */
+
+import java.awt.*;
+import java.awt.image.*;
+import java.awt.geom.*;
+
+public class MTGraphicsAccessTest {
+
+ // in seconds
+ static final long STANDALONE_RUN_TIME = 20;
+ static final long JTREG_RUN_TIME = 7;
+
+ static boolean standaloneMode;
+ static boolean allowExceptions = true;
+ static long testRunTime;
+
+ volatile boolean done;
+ volatile int stillRunning;
+ volatile int numexceptions;
+
+ Graphics2D sharedGraphics;
+ BufferedImage sharedBI =
+ new BufferedImage(50, 50, BufferedImage.TYPE_INT_RGB);
+
+ static final Paint colors[] = {
+ Color.red,
+ new Color(0x7f, 0xff, 0x00, 0x7f),
+ new GradientPaint(0, 0, Color.red,
+ 50, 50, new Color(0x7f, 0xff, 0x00, 0x7f)),
+ };
+ static final Font fonts[] = {
+ new Font("Dialog", Font.PLAIN, 12),
+ new Font("Dialog", Font.BOLD, 16),
+ new Font("Dialog", Font.ITALIC, 18),
+ };
+ static final AlphaComposite comps[] = {
+ AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f),
+ AlphaComposite.Src,
+ AlphaComposite.Xor,
+ AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f),
+ null,
+ };
+ static final Stroke strokes[] = {
+ new BasicStroke(),
+ new BasicStroke(0.0f),
+ new BasicStroke(2.0f),
+ new BasicStroke(2.0f, BasicStroke.CAP_ROUND,
+ BasicStroke.JOIN_BEVEL),
+ new BasicStroke(5.0f, BasicStroke.CAP_SQUARE,
+ BasicStroke.JOIN_ROUND),
+ new BasicStroke(0.0f, BasicStroke.CAP_ROUND,
+ BasicStroke.JOIN_ROUND, 0,
+ new float[]{0,6,0,6}, 0),
+ };
+ static final AffineTransform transforms[] = {
+ new AffineTransform(),
+ AffineTransform.getRotateInstance(10.0),
+ AffineTransform.getShearInstance(10.0, 4.0),
+ AffineTransform.getScaleInstance(1.1, 1.2),
+ AffineTransform.getScaleInstance(3.0, 2.0),
+ };
+
+ public MTGraphicsAccessTest() {
+ BufferedImage bi =
+ new BufferedImage(50, 50, BufferedImage.TYPE_INT_RGB);
+ sharedGraphics = (Graphics2D)bi.getGraphics();
+
+ done = false;
+ numexceptions = 0;
+
+ for (int i = 0; i < (standaloneMode ? stateChangers.length : 3); i++) {
+ (new TesterThread(stateChangers[i])).start();
+ }
+ for (int i = 0; i < (standaloneMode ? renderTests.length : 5); i++) {
+ (new TesterThread(renderTests[i])).start();
+ }
+
+ mysleep(testRunTime);
+ done = true;
+ while (stillRunning > 0) { mysleep(500); }
+
+ if (numexceptions == 0) {
+ System.err.println("Test passed");
+ } else if (!allowExceptions) {
+ throw new RuntimeException("Test failed with "+
+ numexceptions+" exceptions");
+ } else {
+ System.err.println("Test finished with "+
+ numexceptions+" exceptions");
+ }
+ }
+
+ private void mysleep(long time) {
+ try {
+ // add +/-5ms variance to increase randomness
+ Thread.sleep(time + (long)(5 - Math.random()*10));
+ } catch (InterruptedException e) {};
+ }
+
+ public static void usage(String message) {
+ if (message != null) {
+ System.err.println(message);
+ }
+ System.err.println("Usage: MTGraphicsAccessTest [-full] "+
+ "[-time N/forever] [-help]");
+ System.err.println(" -full: run full suite of tests "+
+ "(default: limited number of tests is run)");
+ System.err.println(" -time N: test duration in seconds/forever"+
+ " (default: "+JTREG_RUN_TIME+"s for the short suite, "+
+ STANDALONE_RUN_TIME+"s for the full suite)");
+ System.err.println(" -help: print this help page");
+ System.exit(1);
+ }
+
+ public static void main(String[] args) {
+ boolean testRunSet = false;
+ for (int i = 0; i < args.length; i++) {
+ if ("-full".equals(args[i])) {
+ standaloneMode = true;
+ System.err.println("Running complete list of tests");
+ } else if ("-noexc".equals(args[i])) {
+ allowExceptions = false;
+ } else if ("-time".equals(args[i])) {
+ try {
+ String time = args[++i];
+ if ("forever".equals(time)) {
+ testRunTime = (Long.MAX_VALUE - 20)/1000;
+ } else {
+ testRunTime = 1000*Integer.parseInt(time);
+ }
+ testRunSet = true;
+ } catch (NumberFormatException e) {
+ usage("Can't parse number of seconds: " + args[i]);
+ } catch (ArrayIndexOutOfBoundsException e1) {
+ usage("Missing the 'seconds' argument for -time parameter");
+ }
+ } else if ("-help".equals(args[i])) {
+ usage(null);
+ } else {
+ usage("Unknown argument:" + args[i]);
+ }
+ }
+
+ if (!testRunSet) {
+ testRunTime = 1000 *
+ (standaloneMode ? STANDALONE_RUN_TIME : JTREG_RUN_TIME);
+ }
+
+ System.err.println("Approximate test run time: "+
+ testRunTime/1000+" seconds");
+
+ new MTGraphicsAccessTest();
+ }
+
+ class TesterThread extends Thread {
+ Runnable testRunnable;
+
+ public TesterThread(Runnable testRunnable) {
+ stillRunning++;
+ this.testRunnable = testRunnable;
+ }
+
+ public void run() {
+ try {
+ while (!done) {
+ try {
+ testRunnable.run();
+ yield();
+ } catch (Throwable t) {
+ numexceptions++;
+ t.printStackTrace();
+ }
+ }
+ } finally {
+ stillRunning--;
+ }
+ }
+ }
+
+ final Runnable stateChangers[] = {
+ new Runnable() {
+ public void run() {
+ sharedGraphics.setClip(10, 10, 30, 30);
+ mysleep(10);
+ }
+ },
+ new Runnable() {
+ public void run() {
+ sharedGraphics.setClip(10, 10, 30, 30);
+ mysleep(10);
+ }
+ },
+ new Runnable() {
+ int c = 0;
+ public void run() {
+ sharedGraphics.setPaint(colors[c++ % colors.length]);
+ mysleep(10);
+ }
+ },
+ new Runnable() {
+ boolean AA = false;
+ public void run() {
+ if (AA) {
+ sharedGraphics.setRenderingHint(
+ RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_ON);
+ } else {
+ sharedGraphics.setRenderingHint(
+ RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_OFF);
+ }
+ AA = !AA;
+ mysleep(10);
+ }
+ },
+ new Runnable() {
+ int t = 0;
+ public void run() {
+ sharedGraphics.setTransform(
+ transforms[t++ % transforms.length]);
+ mysleep(10);
+ }
+ },
+ new Runnable() {
+ int c = 0;
+ public void run() {
+ AlphaComposite comp = comps[c++ % comps.length];
+ if (comp == null) {
+ sharedGraphics.setXORMode(Color.green);
+ } else {
+ sharedGraphics.setComposite(comp);
+ }
+ mysleep(10);
+ }
+ },
+ new Runnable() {
+ int s = 0;
+ public void run() {
+ sharedGraphics.setStroke(strokes[s++ % strokes.length]);
+ mysleep(10);
+ }
+ },
+ new Runnable() {
+ int f = 0;
+ public void run() {
+ sharedGraphics.setFont(fonts[f++ % fonts.length]);
+ mysleep(10);
+ }
+ },
+ };
+
+ final Runnable renderTests[] = {
+ new Runnable() {
+ public void run() {
+ sharedGraphics.drawLine(10, 10, 30, 30);
+ }
+ },
+ new Runnable() {
+ public void run() {
+ sharedGraphics.drawLine(10, 10, 30, 30);
+ }
+ },
+ new Runnable() {
+ public void run() {
+ sharedGraphics.drawRect(10, 10, 30, 30);
+ }
+ },
+ new Runnable() {
+ public void run() {
+ sharedGraphics.fillRect(10, 10, 30, 30);
+ }
+ },
+ new Runnable() {
+ public void run() {
+ sharedGraphics.drawString("Stuff", 10, 10);
+ }
+ },
+ new Runnable() {
+ public void run() {
+ sharedGraphics.draw3DRect(10, 10, 30, 30, true);
+ }
+ },
+ new Runnable() {
+ public void run() {
+ sharedGraphics.drawImage(sharedBI, 10, 10, null);
+ }
+ },
+ new Runnable() {
+ public void run() {
+ sharedGraphics.fill3DRect(10, 10, 30, 30, false);
+ }
+ },
+ // REMIND: copyArea doesn't work when transform is set..
+ // new Runnable() {
+ // public void run() {
+ // sharedGraphics.copyArea(10, 10, 30, 30, 20, 20);
+ // }
+ // },
+ new Runnable() {
+ public void run() {
+ sharedGraphics.drawRoundRect(10, 10, 30, 30, 20, 20);
+ }
+ },
+ new Runnable() {
+ public void run() {
+ sharedGraphics.fillRoundRect(10, 10, 30, 30, 20, 20);
+ }
+ },
+ new Runnable() {
+ public void run() {
+ sharedGraphics.drawArc(10, 10, 30, 30, 0, 90);
+ }
+ },
+ new Runnable() {
+ public void run() {
+ sharedGraphics.fillArc(10, 10, 30, 30, 0, 90);
+ }
+ },
+ new Runnable() {
+ public void run() {
+ sharedGraphics.drawOval(10, 10, 30, 30);
+ }
+ },
+ new Runnable() {
+ public void run() {
+ sharedGraphics.fillOval(10, 10, 30, 30);
+ }
+ }
+ };
+}
diff -r 61242d00821f -r efa758101257 jdk/test/java/awt/List/ScrollOutside/ScrollOut.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/List/ScrollOutside/ScrollOut.java Mon May 09 01:47:05 2011 -0700
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ @test
+ @bug 7036733
+ @summary Regression : NullPointerException when scrolling horizontally on AWT List
+ @author Andrei Dmitriev area=awt-list
+ @library ../../regtesthelpers
+ @build Util
+ @run main ScrollOut
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import sun.awt.SunToolkit;
+import test.java.awt.regtesthelpers.Util;
+
+public class ScrollOut
+{
+ public static final void main(String args[])
+ {
+ final Frame frame = new Frame();
+ final List list = new List();
+ Robot robot = null;
+
+ for (int i = 0; i < 5; i++){
+ list.add("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
+ }
+
+ frame.add(list);
+
+ frame.pack();
+ frame.setLocationRelativeTo(null);
+ frame.setVisible(true);
+
+ ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+
+ try{
+ robot = new Robot();
+ }catch(AWTException e){
+ throw new RuntimeException(e);
+ }
+
+ //Drag from center to the outside on left
+ Point from = new Point(list.getLocationOnScreen().x + list.getWidth()/2,
+ list.getLocationOnScreen().y + list.getHeight()/2);
+ Point to = new Point(list.getLocationOnScreen().x - 30,
+ from.y);
+
+ ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+ Util.drag(robot, from, to, InputEvent.BUTTON1_MASK);
+
+ ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+
+ //Drag from center to the outside on up
+ to = new Point(from.x,
+ list.getLocationOnScreen().y - 50);
+
+ ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+ Util.drag(robot, from, to, InputEvent.BUTTON1_MASK);
+
+ }//End init()
+}
diff -r 61242d00821f -r efa758101257 jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion.java
--- a/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion.java Fri May 06 17:06:25 2011 -0700
+++ b/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion.java Mon May 09 01:47:05 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -50,6 +50,11 @@
public class InfiniteRecursion {
final static Robot robot = Util.createRobot();
final static int MOVE_COUNT = 5;
+
+ //*2 for both rotation directions,
+ //*2 as Java sends the wheel event to every for nested component in hierarchy under cursor
+ final static int EXPECTED_COUNT = MOVE_COUNT * 2 * 2;
+
static int actualEvents = 0;
public static void main(String []s)
@@ -96,8 +101,10 @@
Util.waitForIdle(robot);
- if (actualEvents != MOVE_COUNT * 2) {
- AbstractTest.fail("Expected events count: "+ MOVE_COUNT+" Actual events count: "+ actualEvents);
+ //Not fair to check for multiplier 4 as it's not specified actual number of WheelEvents
+ //result in a single wheel rotation.
+ if (actualEvents != EXPECTED_COUNT) {
+ AbstractTest.fail("Expected events count: "+ EXPECTED_COUNT+" Actual events count: "+ actualEvents);
}
}
}
diff -r 61242d00821f -r efa758101257 jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_1.java
--- a/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_1.java Fri May 06 17:06:25 2011 -0700
+++ b/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_1.java Mon May 09 01:47:05 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -50,6 +50,9 @@
public class InfiniteRecursion_1 {
final static Robot robot = Util.createRobot();
final static int MOVE_COUNT = 5;
+ //*2 for both rotation directions,
+ //*2 as Java sends the wheel event to every for nested component in hierarchy under cursor
+ final static int EXPECTED_COUNT = MOVE_COUNT * 2 * 2;
static int actualEvents = 0;
public static void main(String []s)
@@ -95,8 +98,10 @@
}
Util.waitForIdle(robot);
- if (actualEvents != MOVE_COUNT * 2) {
- AbstractTest.fail("Expected events count: "+ MOVE_COUNT+" Actual events count: "+ actualEvents);
+ //Not fair to check for multiplier 4 as it's not specified actual number of WheelEvents
+ //result in a single wheel rotation.
+ if (actualEvents != EXPECTED_COUNT) {
+ AbstractTest.fail("Expected events count: "+ EXPECTED_COUNT+" Actual events count: "+ actualEvents);
}
}
}
diff -r 61242d00821f -r efa758101257 jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_2.java
--- a/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_2.java Fri May 06 17:06:25 2011 -0700
+++ b/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_2.java Mon May 09 01:47:05 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -56,6 +56,9 @@
public class InfiniteRecursion_2 extends Applet {
final static Robot robot = Util.createRobot();
final static int MOVE_COUNT = 5;
+ //*2 for both rotation directions,
+ //*2 as Java sends the wheel event to every for nested component in hierarchy under cursor
+ final static int EXPECTED_COUNT = MOVE_COUNT * 2 * 2;
static int actualEvents = 0;
public void init()
@@ -107,8 +110,10 @@
}
Util.waitForIdle(robot);
- if (actualEvents != MOVE_COUNT * 2) {
- AbstractTest.fail("Expected events count: "+ MOVE_COUNT+" Actual events count: "+ actualEvents);
+ //Not fair to check for multiplier 4 as it's not specified actual number of WheelEvents
+ //result in a single wheel rotation.
+ if (actualEvents != EXPECTED_COUNT) {
+ AbstractTest.fail("Expected events count: "+ EXPECTED_COUNT+" Actual events count: "+ actualEvents);
}
}// start()
}
diff -r 61242d00821f -r efa758101257 jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_3.java
--- a/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_3.java Fri May 06 17:06:25 2011 -0700
+++ b/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_3.java Mon May 09 01:47:05 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -50,6 +50,9 @@
public class InfiniteRecursion_3 extends Applet {
final static Robot robot = Util.createRobot();
final static int MOVE_COUNT = 5;
+ //*2 for both rotation directions,
+ //*2 as Java sends the wheel event to every for nested component in hierarchy under cursor
+ final static int EXPECTED_COUNT = MOVE_COUNT * 2 * 2;
static int actualEvents = 0;
public void init()
@@ -91,8 +94,10 @@
}
Util.waitForIdle(robot);
- if (actualEvents != MOVE_COUNT * 2) {
- AbstractTest.fail("Expected events count: "+ MOVE_COUNT+" Actual events count: "+ actualEvents);
+ //Not fair to check for multiplier 4 as it's not specified actual number of WheelEvents
+ //result in a single wheel rotation.
+ if (actualEvents != EXPECTED_COUNT) {
+ AbstractTest.fail("Expected events count: "+ EXPECTED_COUNT+" Actual events count: "+ actualEvents);
}
}// start()
}
diff -r 61242d00821f -r efa758101257 jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_4.java
--- a/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_4.java Fri May 06 17:06:25 2011 -0700
+++ b/jdk/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_4.java Mon May 09 01:47:05 2011 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -47,6 +47,8 @@
public class InfiniteRecursion_4 {
final static Robot robot = Util.createRobot();
final static int MOVE_COUNT = 5;
+ //*2 for both rotation directions over a single frame without any siblings
+ final static int EXPECTED_COUNT = MOVE_COUNT * 2;
static int actualEvents = 0;
public static void main(String []s)
@@ -80,8 +82,10 @@
}
Util.waitForIdle(robot);
- if (actualEvents != MOVE_COUNT * 2) {
- AbstractTest.fail("Expected events count: "+ MOVE_COUNT+" Actual events count: "+ actualEvents);
+ //Not fair to check for multiplier 4 as it's not specified actual number of WheelEvents
+ //result in a single wheel rotation.
+ if (actualEvents != EXPECTED_COUNT) {
+ AbstractTest.fail("Expected events count: "+ EXPECTED_COUNT+" Actual events count: "+ actualEvents);
}
}
}
diff -r 61242d00821f -r efa758101257 jdk/test/java/awt/keyboard/EqualKeyCode/EqualKeyCode.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/keyboard/EqualKeyCode/EqualKeyCode.java Mon May 09 01:47:05 2011 -0700
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ @test
+ @bug 6799551
+ @library ../../regtesthelpers
+ @build Util Sysout
+ @summary Extended key codes for small letters undefined
+ @author Andrei Dmitriev: area=awt.keyboard
+ @run main EqualKeyCode
+*/
+
+
+import sun.awt.*;
+import java.awt.*;
+import test.java.awt.regtesthelpers.Util;
+import test.java.awt.regtesthelpers.Sysout;
+
+public class EqualKeyCode {
+
+ final static String LETTERS = "abcdefghijklmnopqrstuvwxyz";
+
+ public static void main(String []s) {
+ for (int i = 0; i < LETTERS.length(); i++){
+ char cSmall = LETTERS.charAt(i);
+ char cLarge = Character.toUpperCase(cSmall);
+
+ int iSmall = ExtendedKeyCodes.getExtendedKeyCodeForChar(cSmall);
+ int iLarge = ExtendedKeyCodes.getExtendedKeyCodeForChar(cLarge);
+
+ System.out.print(" " + cSmall + ":" + iSmall + " ---- ");
+ System.out.println(" " + cLarge + " : " + iLarge);
+ if (ExtendedKeyCodes.getExtendedKeyCodeForChar(cSmall) !=
+ ExtendedKeyCodes.getExtendedKeyCodeForChar(cLarge))
+ {
+ throw new RuntimeException("ExtendedKeyCode doesn't exist or doesn't match between capital and small letters.");
+ }
+ }
+ }
+}
diff -r 61242d00821f -r efa758101257 jdk/test/javax/swing/JFileChooser/7036025/bug7036025.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JFileChooser/7036025/bug7036025.java Mon May 09 01:47:05 2011 -0700
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ @bug 7036025
+ @summary java.security.AccessControlException when creating JFileChooser in signed applet
+ @author Pavel Porvatov
+ @run main/othervm/policy=security.policy bug7036025
+*/
+
+import javax.swing.*;
+import java.io.File;
+
+public class bug7036025 {
+ public static final String DIR = "c:/temp";
+
+ public static void main(String[] args) throws Exception {
+ String systemLookAndFeelClassName = UIManager.getSystemLookAndFeelClassName();
+
+ if (!systemLookAndFeelClassName.toLowerCase().contains("windows")) {
+ System.out.println("The test is only for Windows OS.");
+
+ return;
+ }
+
+ File file = new File(DIR);
+
+ if (!file.exists()) {
+ if (!file.mkdir()) {
+ throw new RuntimeException("Cannot create " + DIR);
+ }
+
+ file.deleteOnExit();
+ }
+
+ UIManager.setLookAndFeel(systemLookAndFeelClassName);
+
+ new JFileChooser(file);
+
+ System.out.println("Test passed for LookAndFeel " + UIManager.getLookAndFeel().getName());
+ }
+}
diff -r 61242d00821f -r efa758101257 jdk/test/javax/swing/JFileChooser/7036025/security.policy
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JFileChooser/7036025/security.policy Mon May 09 01:47:05 2011 -0700
@@ -0,0 +1,5 @@
+grant {
+ permission java.io.FilePermission "C:\\temp\\*", "read";
+ permission java.io.FilePermission "C:\\temp", "read,write,delete";
+ permission java.util.PropertyPermission "*", "read";
+};
diff -r 61242d00821f -r efa758101257 jdk/test/javax/swing/JLabel/6596966/bug6596966.java
--- a/jdk/test/javax/swing/JLabel/6596966/bug6596966.java Fri May 06 17:06:25 2011 -0700
+++ b/jdk/test/javax/swing/JLabel/6596966/bug6596966.java Mon May 09 01:47:05 2011 -0700
@@ -24,13 +24,13 @@
/* @test
@bug 6596966
@summary Some JFileChooser mnemonics do not work with sticky keys
- * @library ../../regtesthelpers
- * @build Util
@run main bug6596966
@author Pavel Porvatov
*/
+import sun.awt.SunToolkit;
+
import javax.swing.*;
import java.awt.*;
import java.awt.event.KeyEvent;
@@ -44,6 +44,7 @@
public static void main(String[] args) throws Exception {
Robot robot = new Robot();
+ SunToolkit toolkit = (SunToolkit) SunToolkit.getDefaultToolkit();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
@@ -68,17 +69,17 @@
}
});
- Util.blockTillDisplayed(frame);
+ toolkit.realSync();
robot.keyPress(KeyEvent.VK_ALT);
robot.keyPress(KeyEvent.VK_L);
- robot.waitForIdle();
+ toolkit.realSync();
- Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new KeyEvent(label, KeyEvent.KEY_RELEASED,
+ toolkit.getSystemEventQueue().postEvent(new KeyEvent(label, KeyEvent.KEY_RELEASED,
EventQueue.getMostRecentEventTime(), 0, KeyEvent.VK_L, 'L'));
- robot.waitForIdle();
+ toolkit.realSync();
try {
SwingUtilities.invokeAndWait(new Runnable() {
diff -r 61242d00821f -r efa758101257 jdk/test/sun/java2d/pipe/Test7027667.java
--- a/jdk/test/sun/java2d/pipe/Test7027667.java Fri May 06 17:06:25 2011 -0700
+++ b/jdk/test/sun/java2d/pipe/Test7027667.java Mon May 09 01:47:05 2011 -0700
@@ -23,7 +23,7 @@
/**
* @test
- * @bug 7027667, 7023591
+ * @bug 7027667 7023591 7037091
*
* @summary Verifies that aa clipped rectangles are drawn, not filled.
*
diff -r 61242d00821f -r efa758101257 jdk/test/sun/java2d/pisces/Test7036754.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/java2d/pisces/Test7036754.java Mon May 09 01:47:05 2011 -0700
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 7036754
+ *
+ * @summary Verifies that there are no non-finite numbers when stroking
+ * certain quadratic curves.
+ *
+ * @author Jim Graham
+ * @run main Test7036754
+ */
+
+import java.awt.*;
+import java.awt.geom.*;
+
+public class Test7036754 {
+ public static void main(String argv[]) {
+ Shape s = new QuadCurve2D.Float(839.24677f, 508.97888f,
+ 839.2953f, 508.97122f,
+ 839.3438f, 508.96353f);
+ s = new BasicStroke(10f).createStrokedShape(s);
+ float nsegs[] = {2, 2, 4, 6, 0};
+ float coords[] = new float[6];
+ PathIterator pi = s.getPathIterator(null);
+ while (!pi.isDone()) {
+ int type = pi.currentSegment(coords);
+ for (int i = 0; i < nsegs[type]; i++) {
+ float c = coords[i];
+ if (Float.isNaN(c) || Float.isInfinite(c)) {
+ throw new RuntimeException("bad value in stroke");
+ }
+ }
+ pi.next();
+ }
+ }
+}