Community
Participate
Working Groups
I20071213-1700 Given: package test1; public class E1 { public int field; } 1. Select line 5 (the space) 2. Format Is: java.lang.NullPointerException at org.eclipse.jdt.internal.formatter.Scribe.adaptRegions(Scribe.java:149) at org.eclipse.jdt.internal.formatter.Scribe.getRootEdit(Scribe.java:623) at org.eclipse.jdt.internal.formatter.CodeFormatterVisitor.format(CodeFormatterVisitor.java:806) at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.formatCompilationUnit(DefaultCodeFormatter.java:297) at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.format(DefaultCodeFormatter.java:176) at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.format(DefaultCodeFormatter.java:160) at org.eclipse.jdt.internal.corext.util.CodeFormatterUtil.reformat(CodeFormatterUtil.java:288) at org.eclipse.jdt.internal.ui.text.java.JavaFormattingStrategy.format(JavaFormattingStrategy.java:64) at org.eclipse.jface.text.formatter.MultiPassContentFormatter.formatMaster(MultiPassContentFormatter.java:193) at org.eclipse.jface.text.formatter.MultiPassContentFormatter.format(MultiPassContentFormatter.java:135) at org.eclipse.jface.text.source.SourceViewer.doOperation(SourceViewer.java:836) at org.eclipse.jface.text.source.projection.ProjectionViewer.doOperation(ProjectionViewer.java:1511) at org.eclipse.jdt.internal.ui.javaeditor.JavaSourceViewer.doOperation(JavaSourceViewer.java:178) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewer.doOperation(CompilationUnitEditor.java:195) at org.eclipse.ui.texteditor.TextOperationAction$1.run(TextOperationAction.java:131) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67) at org.eclipse.ui.texteditor.TextOperationAction.run(TextOperationAction.java:129) at org.eclipse.jface.action.Action.runWithEvent(Action.java:498) at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:185) at org.eclipse.ui.internal.handlers.LegacyHandlerWrapper.execute(LegacyHandlerWrapper.java:109) at org.eclipse.core.commands.Command.executeWithChecks(Command.java:475) at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:470) at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:165) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:470) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:821) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:879) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:568) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:510) at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:126) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1160) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:951) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:976) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:961) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:989) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:985) at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1301) at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3883) at org.eclipse.swt.widgets.Control.windowProc(Control.java:3776) at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:334) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4450) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2329) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3359) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2381) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2345) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2211) at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:473) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:468) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:362) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:175) 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.equinox.launcher.Main.invokeFramework(Main.java:561) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:501) at org.eclipse.equinox.launcher.Main.run(Main.java:1239) at org.eclipse.equinox.launcher.Main.main(Main.java:1215) Major or critical: Also happens on save if format edited lines is enabled
investigating
(In reply to comment #1) > investigating Side effect of bug 208541 correction. This bug should be fixed by fixing bug 213283, though not a real dup.
Fixed by implementing the fix for bug 213283 (released in HEAD for 3.4M5)
Exact steps to reproduce are: 1. Create a cu with the following content: ------------------------------------------ package test1; public class E1 { public int field; }------------------------------------------ Note the last closing brace must be the last character of the file. 2. Put text cursor on line 5 column 1 3. Shift+DownArrow 4. Ctrl+Shift+F Observe: You get an error dialog. The NullPointerException is in the .log file This error doesn't occur with 3.4M5. Verified for 3.4M5 using I20080205-0010