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

Bug 62526

Summary: New Formatter : IndexOutOfBoundsException with incorrect tag
Product: [Eclipse Project] JDT Reporter: KiRe
Component: TextAssignee: JDT-Text-Inbox <jdt-text-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3    
Version: 3.0   
Target Milestone: 3.0   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description KiRe CLA 2004-05-17 15:02:20 EDT
When Source > Format using the new Formatter 
Code has 2 <pre> tag and 1 </pre>
an error popup is shown, but message is cryptic.

/**
 * <pre>
 * This is some preformatted text
 *    more
 * <pre> This tag shouldn't be here
 *         this is the end of the preformatted text
 * </pre>
 * @author the author
 *
 * To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
public class TestFormatIndexOutOfBoundsException {

}


in the .log file
!SESSION mei 17, 2004 20:36:46.858 ---------------------------------------------
eclipse.buildId=I200405140800
java.version=1.4.1_01
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=nl_BE
!ENTRY org.eclipse.ui 4 4 mei 17, 2004 20:36:46.858
!MESSAGE The command for the key you pressed failed
!ENTRY org.eclipse.ui 4 0 mei 17, 2004 20:36:46.858
!MESSAGE Index: -1, Size: 1
!STACK 0
java.lang.IndexOutOfBoundsException: Index: -1, Size: 1
	at java.util.ArrayList.RangeCheck(ArrayList.java:508)
	at java.util.ArrayList.get(ArrayList.java:320)
	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:218)
	at
org.eclipse.jdt.internal.ui.text.comment.CommentFormattingStrategy.format(CommentFormattingStrategy.java:145)
	at
org.eclipse.jface.text.formatter.MultiPassContentFormatter.formatSlave(MultiPassContentFormatter.java:218)
	at
org.eclipse.jface.text.formatter.MultiPassContentFormatter.formatSlaves(MultiPassContentFormatter.java:265)
	at
org.eclipse.jface.text.formatter.MultiPassContentFormatter.format(MultiPassContentFormatter.java:141)
	at org.eclipse.jface.text.source.SourceViewer.doOperation(SourceViewer.java:717)
	at
org.eclipse.jface.text.source.projection.ProjectionViewer.doOperation(ProjectionViewer.java:1034)
	at
org.eclipse.jdt.internal.ui.javaeditor.JavaSourceViewer.doOperation(JavaSourceViewer.java:151)
	at
org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewer.doOperation(CompilationUnitEditor.java:197)
	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:881)
	at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:141)
	at org.eclipse.ui.internal.commands.Command.execute(Command.java:132)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:468)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:886)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:927)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:545)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$2(WorkbenchKeyboard.java:493)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard$1.handleEvent(WorkbenchKeyboard.java:258)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:712)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:795)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:820)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:805)
	at org.eclipse.swt.widgets.Control.sendKeyEvent(Control.java:1724)
	at org.eclipse.swt.widgets.Control.sendKeyEvent(Control.java:1720)
	at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3048)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:2951)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:3291)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1466)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2388)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1353)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1324)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:243)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:90)
	at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:298)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:249)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:126)
	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:269)
	at org.eclipse.core.launcher.Main.run(Main.java:722)
	at org.eclipse.core.launcher.Main.main(Main.java:706)
Comment 1 Olivier Thomann CLA 2004-05-17 16:58:17 EDT
Move to JDT/Text
Comment 2 Dani Megert CLA 2004-05-18 03:19:38 EDT

*** This bug has been marked as a duplicate of 57011 ***