changeset 2526:5af3b0430bbe

6959260: javax/swing/JLabel/6501991/bug6501991.java failed on build 1.7.0-ea-b96 Reviewed-by: rupashka
author peterz
date Tue, 22 Jun 2010 14:36:46 +0400
parents 69ddf06e616a
children dea63f6dda7a
files src/share/classes/sun/swing/SwingUtilities2.java test/ProblemList.txt test/com/sun/java/swing/plaf/gtk/Test6635110.java
diffstat 3 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/swing/SwingUtilities2.java	Tue Jun 22 12:06:33 2010 +0400
+++ b/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/test/ProblemList.txt	Tue Jun 22 12:06:33 2010 +0400
+++ b/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/test/com/sun/java/swing/plaf/gtk/Test6635110.java	Tue Jun 22 12:06:33 2010 +0400
+++ b/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());
     }
 }