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

java.lang.ArrayIndexOutOfBoundsException in sun.io.CharToByte8859_1.convert

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b02
    • CPU:
      generic
    • OS:
      solaris_2.5

      Backports

        Description


        When I run the attached program, which create 3 Frame object, each of them running a separate thread to repaint its client zone, I get the following Exception.

        megeve% java test
        java.lang.ArrayIndexOutOfBoundsException: 34
        at sun.io.CharToByte8859_1.convert(CharToByte8859_1.java:154)
        at sun.awt.motif.X11Graphics.drawMFChars(X11Graphics.java:249)
        at sun.awt.motif.X11Graphics.drawChars(X11Graphics.java:217)
        at sun.awt.motif.X11Graphics.drawString(X11Graphics.java:210)
        at test.draw(test.java:52)
        at test.run(test.java:43)
        at java.lang.Thread.run(Thread.java)

        This occur with the 1.1.4 version of java, only on Solaris (I tested it on NT, and it was OK)

        The test program follows :

        import java.util.*;
        import java.awt.*;

        public class test extends Frame implements Runnable{

           Image toto;
           Thread snoopy;
           int sx=250;
           int sy=100;
           Color c;

           test(Color c){
              setSize(sx,sy);
              setVisible(true);
              snoopy=new Thread(this);
              snoopy.start();
              this.c=c;
           }

           public synchronized void paint(Graphics g){
              if (toto!=null){
        spaint(g);
              }
           }

           public synchronized void spaint(Graphics g){
              g.drawImage(toto,0,0,null);
           }

           public void run(){
              toto=createImage(sx,sy);
              Graphics g=toto.getGraphics();

              while(true){
        try{
        snoopy.sleep(10);
                 }catch(InterruptedException e){
        e.printStackTrace();
                 }
                 draw(g);
        repaint();
              }
           }

           public synchronized void draw(Graphics g){
              g.setColor(c);
              g.fillRect(0,0,sx,sy);
              g.setColor(Color.black);
              g.drawString((new Date()).toString(),5,sy/2);
           }

           public static void main(String arg[]){
              test Testa=new test(Color.red);
              test Testb=new test(Color.green);
              test Testc=new test(Color.blue);
           }
        }

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                rramsunw Ranganathan Ram (Inactive)
                Reporter:
                duke J. Duke (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: