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

A nonfatal internal JIT (3.10.107(x)) error 'GetRegisterA'

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Won't Fix
    • Affects Version/s: 1.2.2, 1.3.0
    • Fix Version/s: None
    • Component/s: vm-legacy
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_98, windows_nt, windows_2000

      Description

        * <B>JTable</B> uses this method to determine how many columns it
         * should create and display on initialization.
         *
         * @return the number or columns in the model
         * @see #getRowCount
         */
         public int getColumnCount()
         {
            return COLUMN_CLASSES.length;
         }


         /**
         * Returns an attribute value for the cell at <I>columnIndex</I>
         * and <I>rowIndex</I>.
         *
         * @param rowIndex the row whose value is to be looked up
         * @param columnIndex the column whose value is to be looked up
         * @return the value Object at the specified cell
         */
         public Object getValueAt(int rowIndex, int columnIndex)
         {
            Account account = (Account) mAccountVector.elementAt(rowIndex);
            try
            {
               switch (columnIndex)
               {
                  case 0:
                     return account.getPrimaryKey();
                  case 1:
                     return new Double(account.getBalance());
               }
            }
            catch (Exception anException)
            {
               anException.printStackTrace();
            }
            return null;
         }


         public static void main(String[] args)
         {
            //-----------------------
            // Set up model for table
            //-----------------------
            AccountTableModel model = null;
            try
            {
               Context initial = new InitialContext();
               Object objref = initial.lookup("MyAccount");
               AccountHome home = (AccountHome)
                  PortableRemoteObject.narrow(objref, AccountHome.class);
               model = new AccountTableModel(home);
            }
            catch (Exception anException)
            {
               anException.printStackTrace();
            }


            //-------------
            // Set up table
            //-------------
            JFrame parent = new JFrame("Account Table");
            JTable table = new JTable(model);
            JScrollPane pane = new JScrollPane(table);
            parent.getContentPane().add(pane);
            parent.pack();
            parent.setVisible(true);
            table.addMouseListener(new ClickListener(table));
         }
      }

      class ClickListener extends MouseAdapter
      {
         private JTable mTable;

         public ClickListener(JTable aTable)
         {
            mTable = aTable;
         }

         public void mouseClicked(MouseEvent anEvent)
         {
            if (anEvent.getClickCount() == 2)
            {
               int row = mTable.rowAtPoint(anEvent.getPoint());
               int col = mTable.columnAtPoint(anEvent.getPoint());

               System.out.println("Double-click");
               System.out.println("\tRow: " + row);
               System.out.println("\tColumn: " + col);
            }
         }
      }
      (Review ID: 98260)
      ======================================================================

      Name: skT88420 Date: 12/14/99


      java version "1.2.2"
      Classic VM (build JDK-1.2.2-001, native threads, symcjit)

      A nonfatal internal JIT (3.10.107(x)) error 'GetRegisterA' has occurred in :
        'com/sun/corba/ee/internal/iiop/CDRInputStream.start_block ()V': Interpreting
      method.
      (Review ID: 98991)
      ======================================================================

      Name: skT88420 Date: 12/23/99


      Classic VM (build JDK-1.2.2-W, native threads, symcjit)

      I'm running an Application (test) that monitors the KDManager.KDServer stateless
      bean for a change in a variable. therefore it always executes the EJB's methods
      boolean shallIRun() and Vector getProcessList().

      This works very well except for about the twentieth call when this message
      occures only once:

      ----
      A nonfatal internal JIT (3.10.107(x)) error 'GetRegisterA' has occurred in :
        'com/sun/corba/ee/internal/iiop/CDRInputStream.start_block ()V': Interpreting
      method.
        Please report this error in detail to http://java.sun.com/cgi-bin/bugreport.cg
      i
      ----

      The method works well before and after the error. So i did only, what the
      program asked me to do ;-)

      ----
      -----

      Here is the code for test.java:



      import KDManager.*;
      import java.util.*;
      import java.rmi.*;

      import javax.rmi.PortableRemoteObject;
      import javax.naming.InitialContext;
      import java.*;


      public class test
      {
          static KDServer server;

          public static void main(String[] args)
          {
           Vector v= null;
              debug("looking up: KDManager.KServer");
              try
              {
                  InitialContext ic = new InitialContext();
                  Object objref = ic.lookup("KDManager.KDServer");
                      debug("lookup ok");
                      KDServerHome serverHome = (KDServerHome)
      PortableRemoteObject.narrow(objref,
                                                   KDManager.KDServerHome.class);
                      debug("narrow ok");
                      server = serverHome.create();
                      debug("create ok");
              } catch(Exception e)
              {
                  e.printStackTrace();
                  debug("Missing contact to KDManager.MiningJob");
              }
              try
              {
                  debug("run server");
                  server.energy();
                  while (server.shallIRun()){
                   v=server.getProcessList("urs");
                   debug (Integer.toString(v.size()));
                  }
              }
              catch(Exception ex)
              {
                  debug("Hoppala:" + ex.getMessage());
              }
          }
          private static void debug(String deb)
          {
              System.out.println(deb);
          }
      }
      // end of test.java
      (Review ID: 99301)
      ======================================================================

      Name: skT88420 Date: 01/03/2000


      java version "1.2.2"
      Classic VM (build JDK-1.2.2-W, native threads, symcjit)


      I'm running a client connecting to an Entity EJB on the same machine, different
      VM. I run cloudscape in one window, j2ee -verbose in another, and my client in
      a third. The client does a findBy... which returns an ArrayList of about 7
      Entity beans. It then loops through the beans requesting (via a business
      method) an object from each, containing a copy of the bean's fields (as a
      utility class created for this purpose). Just before it prints the info for
      the last bean, I get:

      A nonfatal internal JIT (3.10.107(x)) error 'GetRegisterA' has occurred in :
        'com/sun/corba/ee/internal/iiop/CDRInputStream.start_block ()V': Interpreting
      method.
        Please report this error in detail to http://java.sun.com/cgi-bin/bugreport.cg
      i


      I then get the printout for the last bean.
      (Review ID: 99517)
      ======================================================================

      Name: skT88420 Date: 01/07/2000


      java version "1.2.2"
      Classic VM (build JDK-1.2.2-W, native threads, symcjit)


      1.-Connecting with JNDI to a J2EE Server.


      A nonfatal internal JIT (3.10.107(x)) error 'GetRegisterA' has occurred in :
        'com/sun/corba/ee/internal/iiop/CDRInputStream.start_block ()V': Interpreting
      method.
        Please report this error in detail to http://java.sun.com/cgi-bin/bugreport.cg
      i

      BIND_TEST
      jdbc
      MailSession
        UserTransaction
      jdbc:rmi:
      estore
      RemoteLogReader
      ServerLocator
      calcs
      ServerConfiguration
      DatabaseInformation
      JarInstaller
      AppRepository
      Authenticator
      SerialContextProvider
      WebInstaller
      ServerActivator
      estore
      (Review ID: 99706)
      ======================================================================

      Name: skT88420 Date: 02/11/2000


      java version "1.2.2"
      Classic VM (build JDK-1.2.2-W, native threads, symcjit)


      Inner and anonymous classes:

      I build some like
         new tbclass( new tbinterface() { public void do() { ... } } ).work();
      where tbclass is a class with a method work() and tbinterface an interface
      with an method do(), called in the main method of a public class.

      Running this program with jdk, I get:
                       default -nojit/-Djava.compiler=NONE
         jdk 1.1.6 error works fine
         jdk 1.2.2 error works fine
      The error was:
         A nonfatal internal JIT (3.10.107(x)) error 'GetRegisterA' has occurred in...

      I look in your bug report:
         Bug ID: 4253789 A nonfatal internal JIT (3.10.107(x)) error 'GetRegisterA'
      and found a broken link to:
         http://developer.java.sun.com/developer/bugParade/bugs/4253789.html

      Is this a know problem?

      In some context, I get no error while using my construction above.
      So it is hard to extract an example code to send to you.
      (Review ID: 101126)
      ======================================================================

      Name: skT88420 Date: 02/22/2000


      java version "1.2.2"
      Classic VM (build JDK-1.2.2-W, native threads, symcjit)

      Using the classfile tools (version 3.2.6, downloaded from
      ftp://ftp.inf.fu-berlin.de/pub/JavaClass/JavaClass.zip)
      and the appended program, running with the appended class
      file as its argument, gets the error
      A nonfatal internal JIT (3.10.107(x)) error 'GetRegisterA' has occurred in :
        'COM/xerox/dae/test/gotmessage.frob (Ljava/lang/String;)V': Interpreting
      method.
        Please report this error in detail to
      http://java.sun.com/cgi-bin/bugreport.cgi

      The program and data needed to tickle the bug are attached (encoded
      in MIME, since this lame bug reporting site doesn't provide a useful
      way to specify attachments.)

      Content-Type: multipart/mixed;
       boundary="------------2F0CF1B715FCD011D1803819"

      --------------2F0CF1B715FCD011D1803819
      Content-Type: text/plain; charset=us-ascii;
       name="gotmessage.java"
      Content-Transfer-Encoding: 7bit
      Content-Disposition: inline;
       filename="gotmessage.java"

      package COM.xerox.dae.test;

      //import java.io.*;

      import de.fub.bytecode.classfile.*;
      import de.fub.bytecode.generic.*;
      import de.fub.bytecode.Constants;

      public class gotmessage implements Constants
      {
        private gotmessage () {}

        public static void main (String args[])
          throws Exception
        {
          for (int i=0; i < args.length; i++)
            frob (args[i]);
        }

        
        static private final String getMessage_name
        = "getMessage";
        static private final String getMessage_signature
        = "(Ljava/lang/String;)Ljava/lang/String;";
        

        private static void frob (String arg)
          throws Exception
        {
          JavaClass java_class = new ClassParser(arg).parse();
          ConstantPool cp = java_class.getConstantPool();
          ConstantPoolGen cpg = new ConstantPoolGen (cp);

          Method[] methods = java_class.getMethods();
          Method getMessage = null;
          for (int mmm = 0, ml = methods.length; ;)
          {
            // Yes, I'm sure there is a direct way of looking the damned thing up
            if (mmm == ml)
              throw new IllegalArgumentException ("No getMessage in " + java_class);
            Method m = methods[mmm++];
            if (! getMessage_name.equals (m.getName ()))
              continue;
            if (! m.isStatic ())
              throw new IllegalArgumentException ("Not static " + m);
            if (! getMessage_signature.equals (m.getSignature ()))
              throw new IllegalArgumentException ("Rotten signature " + m + ": " +
      m.getSignature ());
            getMessage = m;
            break;
          }

        method:
          for (int mmm = 0, ml = methods.length; mmm < ml; mmm++)
          {
            Method m = methods[mmm];
            if (m == getMessage) continue;
            if (m.isAbstract ()) continue;
            if (m.isNative ()) continue;
              
            Attribute a[] = m.getAttributes();
            for (int i = 0, l = a.length; i < l; i++)
            {
              if (a[i] instanceof Synthetic) // Punt on hair
                continue method;
            }
            
            Code c = m.getCode ();
            if (c == null)
              throw new IllegalArgumentException ("No code for " + m);
              
            MethodGen mg = new MethodGen (m, java_class.getClassName(), cpg);
            InstructionList il = mg.getInstructionList();
            InstructionHandle[] ih = il.getInstructionHandles();

            for (int i = 1; i < ih.length; i++)
            {
              Instruction iii = ih[i].getInstruction();
              if (iii instanceof INVOKESTATIC)
              {
                INVOKESTATIC is = (INVOKESTATIC) iii;
                if (! getMessage_name.equals (is.getName (cpg)))
                  continue;
                if (! getMessage_signature.equals (is.getSignature (cpg)))
                  continue;


                System.err.println ("FOUND INVOKESTATIC in " + m);
                System.err.println (" => " + (is.toString (cp)));
                //ConstantMethodref k = (ConstantMethodref) cp.getConstant
      (is.getIndex ());
                //System.err.println (" CONSTANT " + k);
                System.err.println (" prev " + (ih[i - 1].getInstruction().toString
      (cp)));
              }
            }
          }
        }
      }

      --------------2F0CF1B715FCD011D1803819
      Content-Type: application/octet-stream;
       name="ErrorHandler.class"
      Content-Transfer-Encoding: base64
      Content-Disposition: attachment;
       filename="ErrorHandler.class"
      (Review ID: 101515)
      ======================================================================


      Name: skT88420 Date: 07/13/99


      This source code causes the following error,
      it happens with InsertSort >15 but not <15".

      Thanks,
      Steven

      bash-2.01$ java -version
      java version "1.2.2"
      Classic VM (build JDK-1.2.2-U, native threads, symcjit)
      bash-2.01$ java -fullversion
      java full version "JDK-1.2.2-U"
      bash-2.01$ java InsertSort 300000
      308760
      A nonfatal internal JIT (3.10.107(x)) error 'GetRegisterA' has occurred in :
        'InsertSort.getSlot (J)I': Interpreting method.
        Please report this error in detail to http://java.sun.com/cgi-bin/bugreport.cgi

      is.size = 300000 is1.size = 300000
      20838144

      --begin source--
      import java.util.*;

      public class InsertSort
      {
          
          public InsertSort() {}
          
          public final void put(long key, Object value)
          {
              int index = getSlot(key);
              if(index==-1) throw new RuntimeException("Key exists.");
              
              int length = keys.length;
              int size = last-index;
              
              if(last<length) {
                  if(size>0) {
                      System.arraycopy(keys, index, keys, index+1, size);
                      System.arraycopy(values, index, values, index+1, size);
                  }
                  keys[index] = key;
                  values[index] = value;
              }
              else {
                  long[] tk = new long[length*2];
                  Object[] tv = new Object[length*2];
                  if(size>0) {
                      System.arraycopy(keys, index, tk, index+1, size);
                      System.arraycopy(values, index, tv, index+1, size);
                  }
                  tk[index] = key;
                  tv[index] = value;
                  if(index>0) {
                      System.arraycopy(keys, 0, tk, 0, index);
                      System.arraycopy(values, 0, tv, 0, index);
                  }
                  keys = tk;
                  values = tv;
              }
              last++;
          }

          public final Object get(long key)
          {
              int index = getIndex(0, last, key, true);
              if(index<0) throw new RuntimeException("Key not found: " + key);
              
              return values[index];
          }
          
          public final InsertSortEnumerator keys()
          {return new InsertSortEnumerator(this, true);}
          
          public final InsertSortEnumerator elements()
          {return new InsertSortEnumerator(this, false);}

      public final int size()
      {return this.last;}

          public String toString()
          {
              String nl = System.getProperty("line.separator");
              
              String ret = "size = " + last + nl;
              
              for(int i=0;i<last;i++) {
                  ret+="key=" + keys[i] + ", value=" + values[i] + nl;
              }
              return ret;
          }

          private int getSlot(long key)
          {
              if(last>0 && key>keys[last-1]) return last;
              return getIndex(0, last, key, false);
          }
          private int getIndex(int first, int last, long key, boolean exists)
          {
              if(first >= last) return exists?-1:first;

              int index = first+(last-first)/2;
              long tmp = keys[index];
              if(key < tmp) {
                  return getIndex(first, index, key, exists);
              }
              else if(key > tmp) {
                  return getIndex(index+1, last , key, exists);
              }
              else {
                  return exists?index:-1;
              }
          }
          
          public static void main(String[] args)
          {
              
              System.out.println(Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory());
              InsertSort is = new InsertSort();
              Random rand = new Random(12345);
              
              int size = args.length>0?Integer.parseInt(args[0]):20000;
              
              long[] keys = new long[size];
              Long[] values = new Long[size];
              
              for(int i=0;i<size;i++) {
                  //long v = rand.nextLong();
                  long v = i;
                  Long v1 = new Long(v);
                  keys[i] = v;
                  values[i] = v1;
              }
              for(int i=0;i<size;i++) {
                  is.put(keys[i], values[i]);
              }
              //System.out.println(is);
              
              for(int i=0;i<size;i++) {
                  if(!values[i].equals(is.get(keys[i]))) {
                      throw new RuntimeException("Invalid value for " + values[i]);
                  }
              }
              InsertSort is1 = new InsertSort();
              for(InsertSortEnumerator enum = is.keys(); enum.hasMoreElements();) {
                  long key = enum.nextKey();
                  is1.put(key, is.get(key));
              }
              for(int i=0;i<size;i++) {
                  if(!values[i].equals(is1.get(keys[i]))) {
                      throw new RuntimeException("Invalid value for " + values[i]);
                  }
              }
              keys = null;
              values = null;

              System.gc();
              System.out.println("is.size = " + is.size() + " is1.size = " + is1.size());
              System.out.println(Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory());
          }
          
          private int inc = 100;
          private int last = 0;
          private long[] keys = new long[inc];
          private Object[] values = new Object[inc];
          
          
          final class InsertSortEnumerator implements Enumeration
          {
              InsertSort is;
              int count;
              boolean keys = false;
              
              InsertSortEnumerator(InsertSort obj, boolean keys) {
      this.is = obj;
      this.count = 0;
      this.keys = keys;
              }

              public boolean hasMoreElements() {
      return count < is.last;
              }

              public Object nextElement() {
      synchronized (is) {
           if (count < is.last) {
      return is.values[count++];
      }
      }
      throw new NoSuchElementException("InsertSortEnumerator");
              }
              
              public long nextKey() {
      synchronized (is) {
           if (count < is.last) {
      return is.keys[count++];
      }
      }
      throw new NoSuchElementException("InsertSortEnumerator");
              }
              
          }
      }
      -- end source --
      (Review ID: 85555)
      ======================================================================

      Name: krT82822 Date: 09/09/99


      each time the JIT intepret the following method:

      public static void init()
      {
      baos = new ByteArrayOutputStream();
      os = (OutputStream)baos;

      int nbFormats = Registry.getValue("FormatsSupported", -1);

      String format, entry, temp;
      formats = new Vector();

      int form = 1;

      int ind = 0;

      if (nbFormats > 0)
      {
      AudioFormat formatt = null;

      for(; form <= nbFormats ; form++)
      {
      AudioFormat.Encoding encoding = null;
      format = new String("Format" + form);
      temp = Registry.getString(format, "");

      StringTokenizer tk = new StringTokenizer(temp, " ");

      String sfreq = tk.nextToken();
      String sbits = tk.nextToken();
      String sencoding = tk.nextToken();

      if (sencoding.equals("pcm_unsigned"))
      encoding = AudioFormat.Encoding.PCM_UNSIGNED;
      else if (sencoding.equals("pcm_signed_little_endian"))
      encoding = AudioFormat.Encoding.PCM_SIGNED_LITTLE_ENDIAN;

      int freq = Integer.parseInt(sfreq);
      int bits = Integer.parseInt(sbits);
      //String encoding = temp.substring(

      formatt = new AudioFormat(encoding, freq, (int)bits, 1, (int)bits, freq);

      formats.add(formatt);

      }
      }
      else if (nbFormats == -1)// we have to probe for recognized sound format
      {
      nbFormats = 0;

      AudioFormat f = null;
      InputChannel ic = null;


      // we test audio formats with pcm signed little endian data placement
      // shall we test others ?

      AudioFormat.Encoding encoding = null;
      double sampleSize, sampleRate;


      for (sampleRate = 16000 ; sampleRate <= 22050 ; sampleRate += 6050)
      {
      for (sampleSize = 8 ; sampleSize <= 16 ; sampleSize += 8)
      {
      for(int enc = 0 ; enc < 2 ; enc++)
      {
      encoding = getEncoding(enc);

      f = new AudioFormat( encoding, sampleRate, (int)sampleSize, 1, (int)sampleSize, sampleRate);

      try
      {
      ic = AudioSystem.getInputChannel(f);

      nbFormats++;

      Registry.setString("Format" + nbFormats, "" + (int)sampleRate + " " + (int)sampleSize + " " + encoding.toString());
      formats.add(f);
      //System.out.println("ok : " + f);
      }
      catch (Exception e)
      {
      //System.err.println(e);
      }
      }
      }
      }

      Registry.setValue("FormatsSupported", nbFormats);
      }
      else if (nbFormats == 0) // no format recognized
      new MessageBox("Your sound card can't record any sound format recognized by Nala.");
      }

      the following message appears:
      A nonfatal internal JIT (3.10.107(x)) error 'GetRegisterA' has occurred in :
        'RecordDialog.init ()V': Interpreting method.
        Please report this error in detail to http://java.sun.com/cgi-bin/bugreport.cgi

      The output of java -version is :
      java version "1.2.2"
      Classic VM (build JDK-1.2.2-W, native threads, symcjit)

      The output of java -fullversion is :
      java full version "JDK-1.2.2-W"

      I'm using the Java Sound API v0.86

      As you can see this class makes calls to many others class so if you're interrested in received the entire set of class, feel free to ask it in your mail.
      (Review ID: 95043)
      ======================================================================

      Name: rlT66838 Date: 11/08/99


      java version "1.2.2"
      Classic VM (build JDK-1.2.2-W, native threads, symcjit)
      I get the following error reported when I execute Java code that has previously
      worked fine

      A nonfatal internal JIT (3.10.107(x)) error 'GetRegisterA' has occurred in :
        'com/avs/openviz/viz/algorithms/ColumnDataToFieldAlgorithm._collectDataIntoBin
      s (Lcom/avs/openviz/fw/field/FieldAdapter;)V': Interpreting method.
        Please report this error in detail to http://java.sun.com/cgi-
      bin/bugreport.cgi

      The code continues to run and the results seem to be fine.

      I have isolated it to the following code

                      /* This causes a JIT error */
                      if( _binCounts.getValue(j) > 0 )
                          _numCreatedBins += 1;

                      /* This works fine
                      int value = _binCounts.getValue(j);
      if (value > 0)
      _numCreatedBins += 1;
                      */

      The first two lines cause the error. If I replace them with the next lines the
      code does exactly the same thing without the error.
      (Review ID: 97612)
      ======================================================================

      Name: krT82822 Date: 11/15/99


      java version "1.2.2"
      Classic VM (build JDK-1.2.2-W, native threads, symcjit)

      My progra produces this on output:
      A nonfatal internal JIT (3.10.107(x)) error 'GetRegisterA' has occurred in :
        'com/sun/corba/ee/internal/iiop/CDRInputStream.start_block ()V': Interpreting
      method.
        Please report this error in detail to http://java.sun.com/cgi-bin/bugreport.cg
      i

      I am experimenting with the J2EE beta for Windows NT. This error occurs when
      I try to call one session stateless bean many times in a loop:

                 Context initial = new InitialContext();
                 Object objref = initial.lookup("MujFazol");
                 MojeHome home =
      (MojeHome)PortableRemoteObject.narrow(objref,MojeHome.class);
                 Moje pricitac = home.create();
      for(int i=0;i<1000;i++)
                 System.out.print(pricitac.pricti(1));

      The Moje.pricti(int) method just adds 1 to the argument.
      The error occurs after different number of iterations on different runs.
      (Review ID: 97844)
      ======================================================================

      Name: krT82822 Date: 11/17/99


      java version "1.2.2"
      Classic VM (build JDK-1.2.2-W, native threads, symcjit)

      A nonfatal internal JIT (3.10.107(x)) error 'GetRegisterA' has occurred in :
        'com/sun/corba/ee/internal/iiop/CDRInputStream.start_block ()V': Interpreting
      method.
        Please report this error in detail to http://java.sun.com/cgi-bin/bugreport.cg
      i
      (Review ID: 97952)
      ======================================================================

      Name: krT82822 Date: 11/24/99


      java version "1.2.2"
      Classc VM (build JDK-1.2.2-W, native threads, symcjit)


      I am getting an intermittent JIT error: It's happened 2 or 3 times but I can't
      figure out any pattern to it. Error message is:

      --
      A nonfatal internal JIT (3.10.107(x)) error 'GetRegisterA' has occurred in :
        'com/sun/corba/ee/internal/iiop/CDRInputStream.start_block ()V': Interpreting
      method.
        Please report this error in detail to
      http://java.sun.com/cgi-bin/bugreport.cgi
      --

      I am running a simple Swing JTable application that views the contents of a
      server DB using EJB's. I am using the Sun J2SDKEE Beta for my EJB container
      on the server side. The EJB I am using is the "account" example from the J2SDKEE
      EJB Developer's Guide (modified only by placing it in an "account" package.

      At the time this has occurred, I was clicking/double-clicking around randomly on
      the JTable I had created. Source code for the test App follows:

      --------

      import account.Account;
      import account.AccountHome;
      import javax.naming.*;
      import javax.rmi.PortableRemoteObject;
      import javax.swing.*;
      import javax.swing.table.AbstractTableModel;
      import java.util.*;
      import java.awt.event.*;

      public class AccountTableModel extends AbstractTableModel
      {
         private AccountHome mAccountHome;
         private Vector mAccountVector;

         private static final String[] COLUMN_NAMES =
         {
            "ID", "Balance"
         };
         private static final Class[] COLUMN_CLASSES =
         {
            String.class, Double.class
         };


         public AccountTableModel(AccountHome anAccountHome)
         {
            mAccountHome = anAccountHome;
            mAccountVector = new Vector();
            try
            {
               Collection collection = mAccountHome.findInRange(0.0, 200.0);
               Iterator iterator = collection.iterator();
               while (iterator.hasNext())
               {
                  mAccountVector.add(iterator.next());
               }
            }
            catch (Exception anException)
            {
               anException.printStackTrace();
            }
         }

         /**
         * Returns the number of records managed by the data source object. A
         * <B>JTable</B> uses this method to determine how many rows it
         * should create and display. This method should be quick, as it
         * is call by <B>JTable</B> quite frequently.
         *
         * @return the number or rows in the model
         * @see #getColumnCount
         */
         public int getRowCount()
         {
            return mAccountVector.size();
         }


         /**
         * Returns the name of the column at <i>columnIndex</i>. This is used
         * to initialize the table's column header name. Note, this name does
         * not need to be unique. Two columns on a table can have the same name.
         *
         * @param columnIndex the index of column
         * @return the name of the column
         */
         public String getColumnName(int columnIndex)
         {
            return COLUMN_NAMES[columnIndex];
         }


         /**
         * Returns the lowest common denominator Class in the column. This is used
         * by the table to set up a default renderer and editor for the column.
         *
         * @return the common ancestor class of the object values in the model.
         */
         public Class getColumnClass(int columnIndex)
         {
            return COLUMN_CLASSES[columnIndex];
         }


         /**
         * Returns the number of columns managed by the data source object. A
       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              skonchad Sandeep Konchady
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: