6959260: javax/swing/JLabel/6501991/bug6501991.java failed on build 1.7.0-ea-b96
authorpeterz
Tue, 22 Jun 2010 14:36:46 +0400
changeset 5948 bd26e23a33e0
parent 5947 0e6f2837eeca
child 5949 b290affb1a33
6959260: javax/swing/JLabel/6501991/bug6501991.java failed on build 1.7.0-ea-b96 Reviewed-by: rupashka
jdk/src/share/classes/sun/swing/SwingUtilities2.java
jdk/test/ProblemList.txt
jdk/test/com/sun/java/swing/plaf/gtk/Test6635110.java
--- a/jdk/src/share/classes/sun/swing/SwingUtilities2.java	Tue Jun 22 12:06:33 2010 +0400
+++ b/jdk/src/share/classes/sun/swing/SwingUtilities2.java	Tue Jun 22 14:36:46 2010 +0400
@@ -438,8 +438,12 @@
         // c may be null here.
         String clipString = "...";
         availTextWidth -= SwingUtilities2.stringWidth(c, fm, clipString);
+        if (availTextWidth <= 0) {
+            //can not fit any characters
+            return clipString;
+        }
+
         boolean needsTextLayout;
-
         synchronized (charsBufferLock) {
             int stringLength = syncCharsBuffer(string);
             needsTextLayout =
--- a/jdk/test/ProblemList.txt	Tue Jun 22 12:06:33 2010 +0400
+++ b/jdk/test/ProblemList.txt	Tue Jun 22 14:36:46 2010 +0400
@@ -520,9 +520,6 @@
 
 # jdk_misc
 
-# On Windows com.sun.java.swing.plaf.gtk does not exist, always fails there
-com/sun/java/swing/plaf/gtk/Test6635110.java		 	windows-all
-
 # Need to be marked othervm, or changed to be samevm safe
 com/sun/jndi/ldap/ReadTimeoutTest.java				generic-all
 com/sun/jndi/rmi/registry/RegistryContext/UnbindIdempotent.java	generic-all
@@ -1122,9 +1119,6 @@
 
 # jdk_swing (not using samevm)
 
-# Fails on solaris 10 sparc, throws RuntimeException that just says "failed"
-javax/swing/JLabel/6501991/bug6501991.java			generic-all
-
 # Fails on solaris 11 i586, with othervm
 javax/swing/JFileChooser/6570445/bug6570445.java		generic-all
 javax/swing/JFileChooser/6738668/bug6738668.java		generic-all
--- a/jdk/test/com/sun/java/swing/plaf/gtk/Test6635110.java	Tue Jun 22 12:06:33 2010 +0400
+++ b/jdk/test/com/sun/java/swing/plaf/gtk/Test6635110.java	Tue Jun 22 14:36:46 2010 +0400
@@ -28,7 +28,6 @@
    @run main Test6635110
 */
 
-import com.sun.java.swing.plaf.gtk.GTKLookAndFeel;
 import javax.swing.*;
 import java.awt.*;
 import java.awt.image.BufferedImage;
@@ -59,7 +58,12 @@
     }
 
     public static void main(String[] args) throws Exception {
-        UIManager.setLookAndFeel(new GTKLookAndFeel());
+        try {
+            UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
+        } catch (Exception e) {
+            System.out.println("GTKLookAndFeel cannot be set, skipping this test");
+            return;
+        }
         SwingUtilities.invokeAndWait(new Test6635110());
     }
 }