is it a bug

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.

is it a bug

Postby sunny » Thu Sep 13, 2007 1:02 am

Hi
It is concerned with CheckBoxList which my custom component extends .
I am using 2 CheckBoxList , moving selected elements from one list to another.
First list contains some elements , i shift those contents to second list.
Now if try to remove elements from second list , i am getting ArrayIndexOutOfBound Exception.

I order to temporarily remove this problem i have done this.


Code: Select all
public Object[] getCheckBoxListSelectedValues() {
        ListSelectionModel sm = getCheckBoxListSelectionModel();
        ListModel dm = getModel();
        //added by me
         int size = dm.getSize();

        int iMin = sm.getMinSelectionIndex();
        int iMax = sm.getMaxSelectionIndex();

        if ((iMin < 0) || (iMax < 0)) {
            return new Object[0];
        }

        Object[] rvTmp = new Object[1 + (iMax - iMin)];
        int n = 0;
        for (int i = iMin; i <= iMax; i++) {

             //I have added this extra if statement
              if ( i < size ) {
                      if (sm.isSelectedIndex(i)) {
                          rvTmp[n++] = dm.getElementAt(i);
                      }
             }
        }
        Object[] rv = new Object[n];
        System.arraycopy(rvTmp, 0, rv, 0, n);
        return rv;
       
    }


[b]I looked upon the value of other variables..
sm.getMaxSelectionIndex() method return a value higher than the size of model.

If it is bug please confirm , or if i am wrong

All replies are welcome
Thanks-


[/b]
sunny
 
Posts: 3
Joined: Mon Sep 10, 2007 9:39 pm

Postby JIDE Support » Thu Sep 13, 2007 10:39 am

I fixed it and checked into JIDE Common Layer.

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

Postby sunny » Sat Sep 15, 2007 8:06 am

Hi
If you can tell me what the fix is .

Thanks

JIDE Support wrote:I fixed it and checked into JIDE Common Layer.

Thanks,
sunny
 
Posts: 3
Joined: Mon Sep 10, 2007 9:39 pm

Postby JIDE Support » Sat Sep 15, 2007 9:06 am

The fix is in CheckBoxList. Yesterday we also had 2.1.3.03 release which inlcudes the fix. Otherwise you would need to get it from svn directly.

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: No registered users and 10 guests

cron