aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes error while trying to insert data into jtable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "error while trying to insert data into jtable" Watch "error while trying to insert data into jtable" New topic
Author

error while trying to insert data into jtable

chen young
Ranch Hand

Joined: Sep 09, 2005
Posts: 190

Hi,

I am getting the following error while trying to insert data into jtable.

Exception occurred during event dispatching:
java.lang.StackOverflowError
at javax.swing.event.TableModelEvent.<init>(Unknown Source)
at javax.swing.event.TableModelEvent.<init>(Unknown Source)
at javax.swing.table.AbstractTableModel.fireTableStructureChanged(Unknown Source)
at javax.swing.table.DefaultTableModel.setDataVector(Unknown Source)
at com.FTPClient.tableChanged(FTPClient.java:204)
at javax.swing.table.AbstractTableModel.fireTableChanged(Unknown Source)
at javax.swing.table.AbstractTableModel.fireTableStructureChanged(Unknown Source)
at javax.swing.table.DefaultTableModel.setDataVector(Unknown Source)

I am using a vector for holding the data.
any ideas?

Thanks
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19693
    
  20

You have a loop. When setDataVector is called, it fires a table changed event. You listen for that event, and call FTPClient.tableChanged. This calls setDataVector again, and the loop is created.

You need to block your own call to setDataVector if the event is triggered by setDataVector.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
chen young
Ranch Hand

Joined: Sep 09, 2005
Posts: 190
thanks
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: error while trying to insert data into jtable