Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

error while trying to insert data into jtable

 
chen young
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Pie
Posts: 20605
60
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
chen young
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic