Bug 57011 [formatting] AIOOBE when formatting Javadoc
Eclipse: 20040330 Platform: OS X 10.3.3 Using Option+Shift+f to format my code produced the following: java.lang.ArrayIndexOutOfBoundsException: 0 at java.util.ArrayList.get(ArrayList.java:326) at org.eclipse.jdt.internal.ui.text.comment.JavaDocRegion.formatRegion(JavaDocRegion.java:133) at org.eclipse.jdt.internal.ui.text.comment.CommentRegion.format(CommentRegion.java:219) at org.eclipse.jdt.internal.ui.text.comment.CommentFormattingStrategy.format(CommentFormattingStrate gy.java:123) at org.eclipse.jface.text.formatter.MultiPassContentFormatter.formatSlave(MultiPassContentFormatter.java: 217) at org.eclipse.jface.text.formatter.MultiPassContentFormatter.formatSlaves(MultiPassContentFormatter.jav a:264) at org.eclipse.jface.text.formatter.MultiPassContentFormatter.format(MultiPassContentFormatter.java:140) at org.eclipse.jface.text.source.SourceViewer.doOperation(SourceViewer.java:705) at org.eclipse.jdt.internal.ui.javaeditor.JavaSourceViewer.doOperation(JavaSourceViewer.java:124) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewer.doOperation(Compilat ionUnitEditor.java:194) at org.eclipse.ui.texteditor.TextOperationAction$1.run(TextOperationAction.java:122) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:84) at org.eclipse.ui.texteditor.TextOperationAction.run(TextOperationAction.java:120) at org.eclipse.jface.action.Action.runWithEvent(Action.java:881) at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:77) at org.eclipse.ui.internal.commands.Command.execute(Command.java:173) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java: 463) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:855) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:896) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java: 522) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$2(WorkbenchKeyboard.java:488) at org.eclipse.ui.internal.keys.WorkbenchKeyboard$1.handleEvent(WorkbenchKeyboard.java:261) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Display.filterEvent(Display.java:811) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1194) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1219) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1204) at org.eclipse.swt.widgets.Control.sendKeyEvent(Control.java:1941) at org.eclipse.swt.widgets.Control.sendKeyEvent(Control.java:1936) at org.eclipse.swt.widgets.Control.kEventTextInputUnicodeForKeyEvent(Control.java:1474) at org.eclipse.swt.widgets.Composite.kEventTextInputUnicodeForKeyEvent(Composite.java:392) at org.eclipse.swt.widgets.Widget.textInputProc(Widget.java:1604) at org.eclipse.swt.widgets.Display.textInputProc(Display.java:2774) at org.eclipse.swt.internal.carbon.OS.SendEventToEventTarget(Native Method) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2029) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1558) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1532) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:257) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:139) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:90) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:277) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:241) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:117) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:267) at org.eclipse.core.launcher.Main.run(Main.java:692) at org.eclipse.core.launcher.Main.main(Main.java:676)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/comment/JavaDocRegion.java
* 
	 * @param tags		the HTML tag which confines the HTML range
	 * @param attribute	the attribute to set if the comment range is in the HTML range
	 * @param html		<code>true</code> iff the HTML tags in this HTML range
	 *                  	should be marked too, <code>false</code> otherwise
	 */
	protected final void markTagRanges(final String[] tags, final int attribute, final boolean html) {
		
		int level= 0;
		int count= 0;
		String token= null;
		CommentRange current= null;
		
		for (int index= 0; index < tags.length; index++) {
			
			level= 0;
			for (final Iterator iterator= getRanges().iterator(); iterator.hasNext();) {
				
				current= (CommentRange)iterator.next();
				count= current.getLength();
				
				if (count > 0 || level > 0) { 
					
					token= getText(current.getOffset(), current.getLength());
					level= current.markTagRange(token, tags[index], level, attribute, html);
				}
			}
		}
	}
	/**