Bug 126707 [implementation] AIOOBE in MultiPassContentFormatter.formatSlaves
I20060131-1200 + HEAD of ZRH plugins and jdt.core Steps: - have jdt.core in source - open org.eclipse.jdt.core.formatter/DefaultCodeFormatterConstants.java - Source > Format -> after a long pause, the java editor loses most of the syntax highlightings and the following is written to the log: java.lang.ArrayIndexOutOfBoundsException: 0 at org.eclipse.jface.text.formatter.MultiPassContentFormatter.formatSlaves(MultiPassContentFormatter.java:247) at org.eclipse.jface.text.formatter.MultiPassContentFormatter.format(MultiPassContentFormatter.java:136) at org.eclipse.jface.text.source.SourceViewer.doOperation(SourceViewer.java:772) at org.eclipse.jface.text.source.projection.ProjectionViewer.doOperation(ProjectionViewer.java:1519) at org.eclipse.jdt.internal.ui.javaeditor.JavaSourceViewer.doOperation(JavaSourceViewer.java:177) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewer.doOperation(CompilationUnitEditor.java:213) at org.eclipse.ui.texteditor.TextOperationAction$1.run(TextOperationAction.java:122) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69) at org.eclipse.ui.texteditor.TextOperationAction.run(TextOperationAction.java:120) at org.eclipse.jface.action.Action.runWithEvent(Action.java:492) at org.eclipse.jface.commands.ActionHandler.execute(ActionHandler.java:117) at org.eclipse.core.commands.Command.executeWithChecks(Command.java:384) at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:420) at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:159) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:466) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:794) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:841) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:563) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:506) at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:122) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Display.filterEvent(Display.java:978) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:919) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:944) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:929) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:957) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:953) at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1267) at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3335) at org.eclipse.swt.widgets.Control.windowProc(Control.java:3235) at org.eclipse.swt.widgets.Display.windowProc(Display.java:3965) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1730) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2905) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1792) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1756) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:401) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:106) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:109) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:93) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:69) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:374) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:169) 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:585) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:338) at org.eclipse.core.launcher.Main.basicRun(Main.java:282) at org.eclipse.core.launcher.Main.run(Main.java:977) at org.eclipse.core.launcher.Main.main(Main.java:952)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaFormattingStrategy.java
edit.apply(document);
					if (partitioners != null)
						TextUtilities.addDocumentPartitioners(document, partitioners);
				}
			} catch (MalformedTreeException exception) {
				JavaPlugin.log(exception);
			} catch (BadLocationException exception) {
				
				JavaPlugin.log(exception);
			}
		}
 	}
	/*
	 * @see org.eclipse.jface.text.formatter.ContextBasedFormattingStrategy#formatterStarts(org.eclipse.jface.text.formatter.IFormattingContext)
	 */
	public void formatterStarts(final IFormattingContext context) {
		super.formatterStarts(context);
		fPartitions.addLast(context.getProperty(FormattingContextProperties.CONTEXT_PARTITION));
		fDocuments.addLast(context.getProperty(FormattingContextProperties.CONTEXT_MEDIUM));
	}
	/*
	 * @see org.eclipse.jface.text.formatter.ContextBasedFormattingStrategy#formatterStops()
	 */
	public void formatterStops() {
		super.formatterStops();
		fPartitions.clear();
		fDocuments.clear();
	}
}