Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4459892

Merlin-Beta-b64, JTable Throws NullPointerException under all platforms

XMLWordPrintable



      Name: jbT81659 Date: 05/17/2001

      OS: Solaris6-7-8 Intel/Sparc Hebrew or Arabic Locale
      Tested JDK:1.4.0-b64
      Swing Component: ..../demo/jfc/TableExample/src/TableExample4.java
                       or jTable.java submitted with this bug

      Inserting bidi text into JTable cells causes a NULLPointerException to be thrown.

      Here is part of the Exception displayed on the prompt
      ========================
      bash-2.03$ java TableExample4
      Setting value to: òëçéë Mark
      java.lang.NullPointerException
              at javax.swing.text.View.setParent(View.java:352)
              at javax.swing.text.CompositeView.setParent(CompositeView.java:122)
              at javax.swing.text.CompositeView.replace(CompositeView.java:173)
              at javax.swing.text.BoxView.replace(BoxView.java:160)
              at javax.swing.text.View.removeAll(View.java:389)
              at javax.swing.text.FlowView$FlowStrategy.layout(FlowView.java:376)
              at javax.swing.text.TextLayoutStrategy.layout(TextLayoutStrategy.java:94)
              at javax.swing.text.FlowView.layout(FlowView.java:185)
              at javax.swing.text.BoxView.setSize(BoxView.java:375)
              at javax.swing.plaf.basic.BasicTextUI$RootView.paint(BasicTextUI.java:1237)
              at javax.swing.plaf.basic.BasicTextUI.paintSafely(BasicTextUI.java:555)
              at javax.swing.plaf.basic.BasicTextUI.paint(BasicTextUI.java:689)
              at javax.swing.plaf.basic.BasicTextUI.update(BasicTextUI.java:668)
              at javax.swing.JComponent.paintComponent(JComponent.java:485)
              at javax.swing.JComponent.paint(JComponent.java:744)
              at javax.swing.JComponent.paintChildren(JComponent.java:591)
              at javax.swing.JComponent.paint(JComponent.java:753)
              at javax.swing.JComponent.paintChildren(JComponent.java:591)
              at javax.swing.JComponent.paint(JComponent.java:753)
              at javax.swing.JViewport.paint(JViewport.java:697)
              at javax.swing.JComponent.paintChildren(JComponent.java:591)
              at javax.swing.JComponent.paint(JComponent.java:753)
              at javax.swing.JComponent.paintChildren(JComponent.java:591)
              at javax.swing.JComponent.paint(JComponent.java:753)
              at javax.swing.JComponent.paintChildren(JComponent.java:591)
              at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4601)
              at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4547)
              at javax.swing.JComponent._paintImmediately(JComponent.java:4497)
              at javax.swing.JComponent.paintImmediately(JComponent.java:4329)
              at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:407)
      ========================
      To reproduce bug:
      1- Compile and execute the TableExample4.java file that is distributed with the bundle under:
      ..jdk../demo/jfc/src/TableExampl4.java or the file I listed at the end of this text.
      2- Double click on a JTable cell and insert some Hebrew text
      3- Double click on a another cell and insert some Hebrew text
      4- Verify that inserting Hebrew Text causes NullPointerException to be thrown.

      =============Code====================
      /* Copyright (c) Sun Microsystems 1998

      $Header: /home-bazelet/sun/src/JDK1.4/standard/jTable.java,v 1.2 2001/05/08 05:35:48 isam Exp $

      */

      import java.awt.*;
      import javax.swing.*;
      import java.awt.event.*;

      public class jTable extends JApplet
      {
              public void init()
              {
              SimpleTable st = new SimpleTable();
              getContentPane().add(st);
          }


              public static void main(String[] argv)
              {
              JFrame frame = new JFrame("\u0645\u062b\u0627\u0644");
              frame.setContentPane(new SimpleTable());
              frame.pack();
              frame.setVisible(true);
              frame.addWindowListener( new WindowAdapter()
              {
                   public void windowClosing( WindowEvent e)
                   {
                       System.exit(0);
                   }
              });

              }
      }


      class SimpleTable extends JPanel
      {
              public SimpleTable()
              {

                   UIManager.getDefaults().put("Table.font",new Font("Lucida Sans Regular",Font.PLAIN,15));
                  JTable jt = new JTable(new String[][]
                      {
                      {"\u05d6\u05d5\u0020\u05e9\u05e0\u05d4\u0020\u05d9\u05e4\u05d4",
                      "\u0647\u0630\u0627\u0020\u064a\u0648\u0645\u0020\u0644\u0637\u064a\u0641\u0020\u05d6\u05d4\u0020\u05d9\u05d5\u05dd\u0020\u05e0\u05e2\u05d9\u05dd",
                      "\u062a\u0641\u0627\u062d\u0020\u0623\u062d\u0645\u0631\u0020\u0643\u0628\u064a\u0631\u0020\u0042\u0049\u0047\u0020\u0052\u0045\u0044\u0020\u0041\u0050\u0050\u004c\u0045\u0053",
                      "\u006c\u0069\u006d\u0065\u0020\u0069\u0073\u0020\u0067\u0072\u0065\u0065\u006e\u05d7\u05d5\u05de\u05d5\u05e1\u0020\u05d9\u05e7\u05e8"},
                      {"\u006c\u0069\u006d\u0065\u0020\u05d7\u05d5\u05de\u05d5\u05e1\u0020\u05d9\u05e7\u05e8\u0069\u0073\u0020\u0067\u0072\u0065\u0065\u006e",
                      "\u05d7\u05d5\u05de\u05d5\u05e1\u0020\u006c\u0069\u006d\u0065\u0020\u0069\u0073\u0020\u0067\u0072\u0065\u0065\u006e\u0020\u05d9\u05e7\u05e8","\u006c\u0069\u006d\u0065\u0020\u05d7\u05d5\u05de\u05d5\u05e1\u0020\u05d9\u05e7\u05e8\u0069\u0073\u0020\u0067\u0072\u0065\u0065\u006e"},
                      {"\u05d6\u05d5\u0020\u05e9\u05e0\u05d4\u0020\u05d9\u05e4\u05d4\u0020\u0054\u0048\u0045\u0020\u0059\u0045\u0041\u0052\u0020\u0031\u0039\u0035\u0038",
                     "\u05d7\u05d5\u05de\u05d5\u05e1\u0020\u006c\u0069\u006d\u0065\u0020\u0069\u0073\u0020\u0067\u0072\u0065\u0065\u006e\u0020\u05d9\u05e7\u05e8" ,"\u05d6\u05d5\u0020\u05e9\u05e0\u05d4\u0020\u05d9\u05e4\u05d4\u0020\u0054\u0048\u0045\u0020\u0059\u0045\u0041\u0052\u0020\u0031\u0039\u0035\u0038"}},
                     new String[] {"\u062a\u0641\u0627\u062d\u0020\u0623\u062d\u0645\u0631\u0020\u0643\u0628\u064a\u0631\u0020\u0042\u0049\u0047\u0020\u0052\u0045\u0044\u0020\u0041\u0050\u0050\u004c\u0045\u0053",
                     "\u0647\u0630\u0627\u0020\u064a\u0648\u0645\u0020\u0644\u0637\u064a\u0641\u0020\u05d6\u05d4\u0020\u05d9\u05d5\u05dd\u0020\u05e0\u05e2\u05d9\u05dd"});
          JScrollPane jsp = new JScrollPane(jt);
          add(jsp);

              }
      }
      =====================================

      ======================================================================

            shickeysunw Shannon Hickey (Inactive)
            jbenavrasunw Jonathan Benavraham (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: