Bug 165637 - [Viewers] ArrayIndexOutOfBoundsException exception in ConcurrentTableUpdator (used in DeferredContentProvider)
Summary: [Viewers] ArrayIndexOutOfBoundsException exception in ConcurrentTableUpdator ...
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: helpwanted
Depends on:
Blocks: 509006
  Show dependency tree
 
Reported: 2006-11-23 04:52 EST by Pavel Larkin CLA
Modified: 2019-11-01 02:46 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pavel Larkin CLA 2006-11-23 04:52:34 EST
In the most cases occured at PC with high display resolution(>=1600x1200). 
It can be reproduced at (1280x1024) resolution.
TableViewer should to display at least MIN_FLUSHLENGTH(64) on the screen. 

I have table viewer with DeferedContentProvider. 
The table viewer contains MIN_FLUSHLENGTH or more visible elements on the screen.

If I try to update MIN_FLUSHLENGTH elements ArrayIndexOutOfBoundsException occured at point (2). 

// class ConcurrentTableUpdator
org.eclipse.jface.viewers.deferred.ConcurrentTableUpdator
        [...]
        // (1) in case if lastClear == this.MIN_FLUSHLENGTH
        // see (2)
        //
        if (lastClear >= pendingClears.length) {
            int newCapacity = Math.min(MIN_FLUSHLENGTH, lastClear * 2);
            int[] newPendingClears = new int[newCapacity];
            System.arraycopy(pendingClears, 0, newPendingClears, 0, lastClear);
            pendingClears = newPendingClears;
        }
        
        // (2) exception occured here 
        //  coz pendingClears.length stay unchanged 
        pendingClears[lastClear++] = toClear;
        [...]

If you need aditional info about bug, let's me know.
Reproduced in Eclipse v3.1x & v3.2x

BTW, Why do you use int[] arrays instead of ArrayList?
Comment 1 Boris Bokowski CLA 2006-11-24 09:01:40 EST
Pavel, could you provide a patch for this?
Comment 2 Pavel Larkin CLA 2006-11-24 10:03:01 EST
> Pavel, could you provide a patch for this?
> 

something like that:

in line
>int newCapacity = Math.min(MIN_FLUSHLENGTH, lastClear * 2);
change to  
int newCapacity = lastClear * 2; // or = lastClear + 1 
in any case later in ConcurrentTableUpdator.updateTable() 
pendingClears array allocated with size MIN_FLUSHLENGTH again

Did you try to reproduce that bug?

Comment 3 Boris Bokowski CLA 2006-11-24 11:15:34 EST
(In reply to comment #2)
> Did you try to reproduce that bug?

No, but if you could write a small test case or snippet that demonstrates the problem that would be great. :)
Comment 4 Pavel Larkin CLA 2006-11-24 11:25:00 EST
(In reply to comment #3)
> > Did you try to reproduce that bug?
> 
> No, but if you could write a small test case or snippet that demonstrates the
> problem that would be great. :)
> 

maybe later. 
I can't promise anything now.

When are you planning to fix that bug? ;)
Comment 5 Jan-Hendrik Diederich CLA 2008-02-28 10:27:39 EST
The new codes works different and this bug is very old, this bug should be reviewed it can be reproduced.
Comment 6 Markus Krüger CLA 2009-06-08 11:57:15 EDT
The bug also occurs using eclipse RAP, that uses exactly this code.

simply applying your suggested patch (int newCapacity = lastClear * 2;) fixed this issue.

See discussion: http://www.eclipse.org/newsportal/article.php?id=6329&group=eclipse.technology.rap
Comment 7 Markus Krüger CLA 2009-07-28 09:30:50 EDT
Will there ever be anything done on this one?
This bug is open for ages...
Comment 8 Boris Bokowski CLA 2009-11-13 14:13:39 EST
(In reply to comment #7)
> Will there ever be anything done on this one?
> This bug is open for ages...

I have asked for a test case but nobody cared to attach one. I am hesitant to just change the code without proof that the fix improves the situation.
Comment 9 Markus Krüger CLA 2009-11-16 05:29:37 EST
Hi Boris,
I can not provide a standalone test-case, it would have been for eclipse RAP anyway, since I noticed the bug there, too. But I can verify that the fix improves the situation. I know this might not satisfy you, but I hope you implement the fix anyway.
Regards,
Markus
Comment 10 Boris Bokowski CLA 2009-11-26 09:49:10 EST
Hitesh is now responsible for watching bugs in the [Viewers] component area.
Comment 11 Stefan Xenos CLA 2016-12-12 11:02:46 EST
Suggest deprecating and deleting the virtual table/tree viewer support instead of trying to fix this stuff.

There are other custom tables and trees out there that do a much better job of handling virtual elements. This one is barely used and doesn't work well.
Comment 12 Eclipse Genie CLA 2019-11-01 02:46:28 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.