Details
Description
Since I updated Groovy Eclipse last week I'm seeing code formatter exceptions occur when i press return to add a new blank line sometimes. (See below)
It happens on multiple different files, so it's not just one weird file causing an issue. Restarting eclipse doesn't make the problem go away.
I've not got a small test-case where this happens every time as yet, but prior to the update last week it has never happened before.
I checked the eclipse insallation log and dug out this information:
My previous version that was ok: 2.0.0.xx-20091006-1400-e35
My current version that has the problem: 2.0.0.xx-20091015-1100-e35
Here's the exception that occurs:
java.lang.RuntimeException: Formatting could not be performed. Message:null Cause: null Type: java.lang.NullPointerException at org.codehaus.groovy.eclipse.refactoring.formatter.DefaultGroovyFormatter.format(DefaultGroovyFormatter.java:170) at org.codehaus.groovy.eclipse.editor.GroovyAutoIndentStrategy.smartPaste(GroovyAutoIndentStrategy.java:660) at org.codehaus.groovy.eclipse.editor.GroovyAutoIndentStrategy.customizeDocumentCommand(GroovyAutoIndentStrategy.java:1165) at org.eclipse.jface.text.TextViewer.customizeDocumentCommand(TextViewer.java:3734) at org.eclipse.jface.text.TextViewer.handleVerifyEvent(TextViewer.java:3764) at org.eclipse.jface.text.source.projection.ProjectionViewer.handleVerifyEvent(ProjectionViewer.java:1276) at org.eclipse.jface.text.TextViewer$TextVerifyListener.verifyText(TextViewer.java:433) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:249) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:3543) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1250) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1273) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1079) at org.eclipse.swt.custom.StyledText.modifyContent(StyledText.java:6602) at org.eclipse.swt.custom.StyledText.sendKeyEvent(StyledText.java:7442) at org.eclipse.swt.custom.StyledText.doContent(StyledText.java:2441) at org.eclipse.swt.custom.StyledText.handleKey(StyledText.java:5814) at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5839) at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:5541) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:3543) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1250) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1273) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1287) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1283) at org.eclipse.swt.widgets.Canvas.sendKeyEvent(Canvas.java:433) at org.eclipse.swt.widgets.Control.doCommandBySelector(Control.java:906) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4741) at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method) at org.eclipse.swt.internal.cocoa.NSResponder.interpretKeyEvents(NSResponder.java:56) at org.eclipse.swt.widgets.Composite.keyDown(Composite.java:516) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4655) at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method) at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:202) at org.eclipse.swt.widgets.Widget.windowSendEvent(Widget.java:1753) at org.eclipse.swt.widgets.Shell.windowSendEvent(Shell.java:1825) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4713) at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method) at org.eclipse.swt.widgets.Display.applicationSendEvent(Display.java:4285) at org.eclipse.swt.widgets.Display.applicationProc(Display.java:4352) at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method) at org.eclipse.swt.internal.cocoa.NSApplication.sendEvent(NSApplication.java:101) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3097) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) 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:592) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514) at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
Please update again, the most recent version of the plugin avoids this exception and allows you to paste. Actually, the exception is still logged, but this will not prevent you from pasting or pressing enter. Also, more diagnostics are included when this stack trace is printed out again.
Can you please update again, and if/when you see this exception again, paste it here and I will look at it. Also, I don't need a full file as an example, if you can attach just the method or the surrounding code where this occurred, that would be helpful.