Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 344294

Summary: Used wrong counter in for loop
Product: z_Archived Reporter: Johan Schulz <schulz.johan>
Component: NebulaAssignee: Emil Crumhorn <emil.crumhorn>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

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