Project: JDT
Bug 44993 Exception in CodeFormatter with unclosed string litteral
Reported: 2003-10-16 02:35:23 | Status: resolved fixed

3.0 M4 Save this example class and then choose Source > Format: public class A { String s= "Hello Problem"; } I have not enabled the new code formatter in the prefs. !ENTRY org.eclipse.jdt.ui 4 10001 Oct 16, 2003 08:29:36.509 !MESSAGE Internal Error !STACK 0 org.eclipse.jdt.core.compiler.InvalidInputException: Invalid_Char_In_String at org.eclipse.jdt.internal.core.util.PublicScanner.getNextToken(PublicScanner.java:1134) at org.eclipse.jdt.internal.corext.util.CodeFormatterUtil.emulateNewWithOld(CodeFormatterUtil.java:289) at org.eclipse.jdt.internal.corext.util.CodeFormatterUtil.format2(CodeFormatterUtil.java:185) at org.eclipse.jdt.internal.corext.util.CodeFormatterUtil.format(CodeFormatterUtil.java:99) at org.eclipse.jdt.internal.ui.text.java.JavaFormattingStrategy.format(JavaFormattingStrategy.java:86) at org.eclipse.jface.text.formatter.ContentFormatter.format(ContentFormatter.java:816) at org.eclipse.jface.text.formatter.ContentFormatter.formatMaster(ContentFormatter.java:665) at org.eclipse.jface.text.formatter.ContentFormatter.format(ContentFormatter.java:489) at org.eclipse.jface.text.source.SourceViewer.doOperation(SourceViewer.java:664) at org.eclipse.jdt.internal.ui.javaeditor.JavaSourceViewer.doOperation(JavaSourceViewer.java:98) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewer.doOperation(CompilationUnitEditor.java:169) 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:842) at org.eclipse.ui.actions.RetargetAction.runWithEvent(RetargetAction.java:203) at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:212) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:541) at org.eclipse.jface.action.ActionContributionItem.access$4(ActionContributionItem.java:494) at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:466) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:847) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2173) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1863) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2347) at org.eclipse.ui.internal.Workbench.run(Workbench.java:2330) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:858) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) 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:299) at org.eclipse.core.launcher.Main.run(Main.java:765) at org.eclipse.core.launcher.Main.main(Main.java:599) !ENTRY org.eclipse.ui 4 4 Oct 16, 2003 08:29:36.530 !MESSAGE Unhandled exception caught in event loop. !ENTRY org.eclipse.ui 4 0 Oct 16, 2003 08:29:36.540 !MESSAGE assertion failed; Invalid_Char_In_String !STACK 0 org.eclipse.jdt.internal.corext.Assert$AssertionFailedException: assertion failed; Invalid_Char_In_String at org.eclipse.jdt.internal.corext.Assert.isTrue(Assert.java:136) at org.eclipse.jdt.internal.corext.util.CodeFormatterUtil.emulateNewWithOld(CodeFormatterUtil.java:329) at org.eclipse.jdt.internal.corext.util.CodeFormatterUtil.format2(CodeFormatterUtil.java:185) at org.eclipse.jdt.internal.corext.util.CodeFormatterUtil.format(CodeFormatterUtil.java:99) at org.eclipse.jdt.internal.ui.text.java.JavaFormattingStrategy.format(JavaFormattingStrategy.java:86) at org.eclipse.jface.text.formatter.ContentFormatter.format(ContentFormatter.java:816) at org.eclipse.jface.text.formatter.ContentFormatter.formatMaster(ContentFormatter.java:665) at org.eclipse.jface.text.formatter.ContentFormatter.format(ContentFormatter.java:489) at org.eclipse.jface.text.source.SourceViewer.doOperation(SourceViewer.java:664) at org.eclipse.jdt.internal.ui.javaeditor.JavaSourceViewer.doOperation(JavaSourceViewer.java:98) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewer.doOperation(CompilationUnitEditor.java:169) 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:842) at org.eclipse.ui.actions.RetargetAction.runWithEvent(RetargetAction.java:203) at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:212) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:541) at org.eclipse.jface.action.ActionContributionItem.access$4(ActionContributionItem.java:494) at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:466) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:847) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2173) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1863) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2347) at org.eclipse.ui.internal.Workbench.run(Workbench.java:2330) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:858) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) 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:299) at org.eclipse.core.launcher.Main.run(Main.java:765) at org.eclipse.core.launcher.Main.main(Main.java:599)

Files changed in fix:
org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/util/CodeFormatterUtil.java