Divide by Zero Exception in Searchable

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Divide by Zero Exception in Searchable

Postby robert » Wed Sep 02, 2009 11:58 am

I updated the jide oss lib to 2.7 from 2.6 and now I get the exception listed below. Nothing in my code has changed. If I revert back to 2.6, the exception goes away. Is this a Jide bug, or is this something I need to handle in my code somehow. I looked at the Jide code for TableSearchable.setSelectedIndex, and I don't see any difference between 2.6 and 2.7, so I'm a bit confused as to the cause of the exception. Thanks

Code: Select all
Exception in thread "AWT-EventQueue-0" java.lang.ArithmeticException: / by zero
   at com.jidesoft.swing.TableSearchable.setSelectedIndex(Unknown Source)
   at com.jidesoft.swing.SearchableBar.select(Unknown Source)
   at com.jidesoft.swing.SearchableBar.highlightNext(Unknown Source)
   at com.jidesoft.swing.SearchableBar.highlightAllOrNext(Unknown Source)
   at com.jidesoft.swing.SearchableBar.access$000(Unknown Source)
   at com.jidesoft.swing.SearchableBar$1.searchableEventFired(Unknown Source)
   at com.jidesoft.swing.Searchable.fireSearchableEvent(Unknown Source)
   at com.jidesoft.swing.TableSearchable.tableChanged(Unknown Source)
   at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
   at javax.swing.table.AbstractTableModel.fireTableDataChanged(AbstractTableModel.java:182)
robert
 
Posts: 41
Joined: Thu Apr 03, 2008 6:56 am

Re: Divide by Zero Exception in Searchable

Postby robert » Wed Sep 02, 2009 2:00 pm

While doing some debugging I found that the exception only occurs with setMainIndex(-1). If I comment out that line, the exception does not occur. I'm guessing it is related to this change:

(Common) Fixed the issue that TableSearchable cannot search correct result while setMainIndex(-1) and highLightAll in SearchableBar.
robert
 
Posts: 41
Joined: Thu Apr 03, 2008 6:56 am

Re: Divide by Zero Exception in Searchable

Postby JIDE Support » Wed Sep 02, 2009 4:53 pm

Can you please check if yourTable#getColumnCount() returns 0 when the issue happens? I don't think it is related to that fix so far. The reason that setMainIndex(-1) changes the behavior is because the parameter setting changes the flow of the logic.

One more question, which release worked for you in 2.6.x?

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: Divide by Zero Exception in Searchable

Postby robert » Wed Sep 02, 2009 7:08 pm

Yes, the getColumnCount() does return zero, but there is no exception thrown in earlier Jide versions.

I was using the most recent 2.6 release (2.6.7), and no issue occurs. Switching the lib to 2.7.2 causes the exception. I can't see where to download the earlier 2.7.x releases in order to isolate the problem. Java.net seems to only have the most recent release in each 2.x branch.

As already mentioned the problem only occurs when I include setMainIndex(-1) in my code. If I set the index to another value, the problem does not occur. I have also found that if I move the setMainIndex(-1) line further down in my app constructor to where the getColumnCount() is greater than zero, the problem does not occur.

So, I can solve this issue in my code, but there seems to be a change in 2.7.x that caused the exception to suddenly appear.
robert
 
Posts: 41
Joined: Thu Apr 03, 2008 6:56 am

Re: Divide by Zero Exception in Searchable

Postby JIDE Support » Wed Sep 02, 2009 8:30 pm

I will add a protection here anyway in next release.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: Divide by Zero Exception in Searchable

Postby JIDE Support » Wed Sep 09, 2009 11:34 pm

Just so you know, this is fixed in 2.7.3 release.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: Google [Bot] and 75 guests