< prev index next >

test/jdk/javax/swing/JTextArea/TestTabSize.java

Print this page
rev 47956 : 8191678: [TESTBUG] Add keyword headful in java/awt and javax tests.
Summary: Also fix some NPE thrown if run headless.

@@ -18,14 +18,16 @@
  *
  * 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 8187957
  * @summary  Verifies Tab Size works correctly in JTextArea
+ * @key headful
  * @run main TestTabSize
  */
 
 import java.awt.geom.Rectangle2D;
 import javax.swing.GroupLayout;

@@ -94,12 +96,14 @@
                 System.out.println("2nd caret x position " + rect1.getX());
 
             } catch (BadLocationException ex) {
                 excpnthrown = true;
             } finally {
+                if (f != null) {
                 f.dispose();
             }
+            }
         });
         if (excpnthrown) {
             throw new RuntimeException("BadLocationException thrown");
         }
         if ((int)rect.getX() != (int)rect1.getX()) {
< prev index next >