Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 344294 - Used wrong counter in for loop
Summary: Used wrong counter in for loop
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Nebula (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Emil Crumhorn CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-29 11:13 EDT by Johan Schulz CLA
Modified: 2021-07-05 11:41 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Johan Schulz CLA 2011-04-29 11:13:17 EDT
Build Identifier: 3.6.2 - M20110210-1200

Type at line 5723, uses counter of enclosing for loop (i) not the current one (x).


if (hasSpecialDateRanges()) {           
	for (int i = 0; i < _specDateRanges.size(); i++) {
		final GanttSpecialDateRange range = (GanttSpecialDateRange) _specDateRanges.get(i);

		ArrayList failedMoves = new ArrayList();
		
		// check if any of the moved/resized events overlap any of our date ranges
		for (int x = 0; x < _dragEvents.size(); x++) {
			// final GanttEvent ge = (GanttEvent) _dragEvents.get( i ); // <- wrong
                        final GanttEvent ge = (GanttEvent) _dragEvents.get( x );    // <- correct one

			// event is not allowed to be on these dates, undo
			if (!range.canEventOccupy(ge.getActualStartDate(), ge.getActualEndDate())) {
				ge.moveCancelled();	                	
				_dragEvents.remove(ge);
				needsRedraw = true;
				failedMoves.add(ge);
			}                
		}

This bug causes the move and resize feature to be broken

Regards

Johan Schulz

Reproducible: Always

Steps to Reproduce:
1. Resize/Move GantEvent ( first time seems to work fine )
2. Resize/Move GantEvent, this time no further action possible
3.
Comment 1 Johan Schulz CLA 2011-04-29 11:16:15 EDT
I missed the filename at all, sorry.

org.eclipse.nebula.widgets.ganttchart.GanttComposite:5723

final GanttEvent ge = (GanttEvent) _dragEvents.get( i ); // <- wrong
final GanttEvent ge = (GanttEvent) _dragEvents.get( x ); // <- correct


regards

Johan
Comment 2 Emil Crumhorn CLA 2011-04-29 11:52:48 EDT
Wops, that's a very bad one, good catch! I've fixed it and checked in to CVS right away and forced a new nightly build. Marking as fixed > 20110429-17:52 CET

Thanks!
Emil