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

"ctrl+shft+o" causes textcomponent crash after Inserting numbers and spaces

    XMLWordPrintable

Details

    Description



      Name: jbT81659 Date: 08/01/2001

      OS: All Os's
      JDK: jdk1.4.0-b73-betaRefresh2
      testcase: textFieldTest.java
      Affected class: All JtextComponent classes (JtextArea, JTextField, JTextPane)

      Inserting numbers separated by spaces into any TextComponent causes that TextComponent to throw the
      following exception:
      --------------------
      sam@tiger 519: ./run_Xint.sh
      java.lang.IllegalArgumentException: bad start (0) or length (-1)
              at sun.awt.font.StandardTextSource.getSubSource(StandardTextSource.java:172)
              at sun.awt.font.ExtendedTextSourceLabel.getSubset(ExtendedTextSourceLabel.java:751)
              at java.awt.font.TextMeasurer.makeComponentsOnRange(TextMeasurer.java:445)
              at java.awt.font.TextMeasurer.makeTextLineOnRange(TextMeasurer.java:476)
              at java.awt.font.TextMeasurer.getLayout(TextMeasurer.java:609)
              at java.awt.font.LineBreakMeasurer.nextLayout(LineBreakMeasurer.java:430)
              at javax.swing.text.TextLayoutStrategy.createView(TextLayoutStrategy.java:200)
              at javax.swing.text.FlowView$FlowStrategy.layoutRow(FlowView.java:443)
              at javax.swing.text.TextLayoutStrategy.layoutRow(TextLayoutStrategy.java:112)
              at javax.swing.text.FlowView$FlowStrategy.layout(FlowView.java:399)
              at javax.swing.text.TextLayoutStrategy.layout(TextLayoutStrategy.java:95)
              at javax.swing.text.FlowView.layout(FlowView.java:185)
              at javax.swing.text.BoxView.setSize(BoxView.java:382)
              at javax.swing.plaf.basic.BasicTextUI$RootView.setSize(BasicTextUI.java:1536)
              at javax.swing.plaf.basic.BasicTextUI$RootView.paint(BasicTextUI.java:1250)
              at javax.swing.plaf.basic.BasicTextUI.paintSafely(BasicTextUI.java:568)
              at javax.swing.plaf.basic.BasicTextUI.paint(BasicTextUI.java:702)
              at javax.swing.plaf.basic.BasicTextUI.update(BasicTextUI.java:681)
              at javax.swing.JComponent.paintComponent(JComponent.java:492)
              at javax.swing.JComponent.paint(JComponent.java:759)
              at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4674)
              at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4627)
              at javax.swing.JComponent._paintImmediately(JComponent.java:4571)
              at javax.swing.JComponent.paintImmediately(JComponent.java:4403)
              at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:407)
              at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:120)
              at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:167)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:437)
              at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:150)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:131)
              at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)

      --------------------

      To reproduce bug:

      1- Choose an OS that has support for arabic/hebrew locale
      2- Compile and run the following code "textFieldTest.java"
      3- Insert some arabic/hebrew text into the JTextField
      4- Do "ctrl+shift+O"
      5- Note that no Exceptions are thrown
      6- Type some numbers with no spaces like 12345
      7- Note that no Exceptions are thrown
      8- press the spacebar (to make a space) and type one more number
      9- Do "ctrl+shift+o"
      10- Note that Exceptions are thrown

      ---------Code--------------

      /* Copyright (c) Sun Microsystems 1998

      $Header:$

      */

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

      public class textFieldTest extends JApplet
      {
              public void init()
              {
                      testClass text = new testClass();
                      getContentPane().add(text);
              }
              public static void main(String[] argv)
              {
                      JFrame frame = new JFrame("\u0645\u062b\u0627\u0644");
                      frame.setContentPane(new testClass());
                      frame.pack();
                      frame.setVisible(true);
              frame.addWindowListener( new WindowAdapter()
              {
                   public void windowClosing( WindowEvent e)
                   {
                       System.exit(0);
                   }
              });

              }
      }
      class testClass extends JPanel
      {
              JTextField tf0;
              public testClass()
              {

                      JTextField tf0 = new JTextField(30);
                      tf0.setFont(new Font("Lucida Sans Regular",Font.PLAIN,14));
                      add(tf0);
              }
      }
      ---------------------------
      ======================================================================

      Attachments

        Activity

          People

            naasunw Naa Naa (Inactive)
            jbenavrasunw Jonathan Benavraham (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: