Bug 6824 SWT "out of bounds" exception when clicking in packages view
Build: 2001-12-06, Win2000. Sorry, I have very little information to go on. I was working away, and I got a very generic "Internal Error" dialog... it gave no interesting information (check log). When I clicked OK on that dialog, the VM immediately exited. I believe making a selection in the packages view was my last action before death happened. I also had several java editors open. I'm logging the bug here because at first glance "LinkedPositionUI.getMinimumLocation" seems to be the offending code. The log contained only the following stack trace: Log: Tue Dec 11 16:49:49 EST 2001 4 org.eclipse.ui 0 Index out of bounds java.lang.IllegalArgumentException: Index out of bounds at org.eclipse.swt.SWT.error(SWT.java:1873) at org.eclipse.swt.custom.StyledText.getLocationAtOffset(StyledText.java(Compiled Code)) at org.eclipse.swt.custom.StyledText.getLocationAtOffset(StyledText.java(Compiled Code)) at org.eclipse.jdt.internal.ui.text.link.LinkedPositionUI.getMinimumLocation(Linked PositionUI.java:323) at org.eclipse.jdt.internal.ui.text.link.LinkedPositionUI.paintControl(LinkedPositi onUI.java:307) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java(Compiled Code)) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java(Compiled Code)) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java(Compiled Code)) at org.eclipse.swt.widgets.Composite.WM_PAINT(Composite.java(Compiled Code)) at org.eclipse.swt.widgets.Control.windowProc(Control.java(Compiled Code)) at org.eclipse.swt.widgets.Display.windowProc(Display.java(Compiled Code)) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java(Compiled Code)) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java(Compiled Code)) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java(Compiled Code)) at org.eclipse.ui.internal.Workbench.run(Workbench.java:758) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:82 0) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:151) at org.eclipse.core.launcher.Main.run(Main.java:502) at org.eclipse.core.launcher.Main.main(Main.java:362)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/link/LinkedPositionUI.java
return;
		
		IRegion region= fViewer.getVisibleRegion();		
		int offset= fFramePosition.getOffset() -  region.getOffset();
		int length= fFramePosition.getLength();
			
		StyledText text= fViewer.getTextWidget();
		
		
		Point minLocation= getMinimumLocation(text, offset, length);
		Point maxLocation= getMaximumLocation(text, offset, length);
		int x1= minLocation.x;
		int x2= minLocation.x + maxLocation.x - minLocation.x - 1;
		int y= minLocation.y + text.getLineHeight() - 1;
		
		GC gc= event.gc;
		gc.setForeground(fFrameColor);
		gc.drawLine(x1, y, x2, y);
	}
	private static Point getMinimumLocation(StyledText text, int offset, int length) {
		Point minLocation= new Point(Integer.MAX_VALUE, Integer.MAX_VALUE);
		for (int i= 0; i <= length; i++) {
			Point location= text.getLocationAtOffset(offset + i);
			
			if (location.x < minLocation.x)
				minLocation.x= location.x;			
			if (location.y < minLocation.y)
				minLocation.y= location.y;			
		}