This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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: 188

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: 19651
    
  18

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: 188
thanks
 
Don't get me started about those stupid light bulbs.
 
subject: error while trying to insert data into jtable
 
Similar Threads
Problem with JTable
JTable
JTable
JTable ClassCastException
JTable