Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 313351 - [Formatter] Handle exceptions from ValueConverter appropriately
Summary: [Formatter] Handle exceptions from ValueConverter appropriately
Status: CLOSED WONTFIX
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 1.0.0   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-18 09:39 EDT by Moritz Eysholdt CLA
Modified: 2016-07-21 04:21 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Moritz Eysholdt CLA 2010-05-18 09:39:24 EDT
The formatter delegates to the ValueConverterService to format tokens of data type rules and terminal rules. The contract defines that a ValueConverter may throw ValueConverterExceptions.

What's the best way for the formatter to handle them?
Currently the exception is written to the error log and formatting is canceled.

I'd say it would be more appropriate to skip formatting for this very token, display/print no error at all and continue formatting as if nothing happend.

Another option would be to create error markers.


Example exception:
org.eclipse.xtext.conversion.ValueConverterException: Illegal escape character \/
at org.eclipse.emf.mwe2.language.Mwe2ValueConverters$1.internalToValue(Mwe2ValueConverters.java:73)
at org.eclipse.emf.mwe2.language.Mwe2ValueConverters$1.internalToValue(Mwe2ValueConverters.java:1)
at org.eclipse.xtext.conversion.impl.AbstractNullSafeConverter.toValue(AbstractNullSafeConverter.java:32)
at org.eclipse.xtext.conversion.impl.AbstractDeclarativeValueConverterService.toValue(AbstractDeclarativeValueConverterService.java:57)
at org.eclipse.xtext.formatting.impl.NodeModelStreamer.writeSemantic(NodeModelStreamer.java:132)
at org.eclipse.xtext.formatting.impl.NodeModelStreamer.feedTokenStream(NodeModelStreamer.java:61)
at org.eclipse.xtext.formatting.impl.DefaultNodeModelFormatter.format(DefaultNodeModelFormatter.java:45)
at org.eclipse.xtext.ui.editor.formatting.ContentFormatterFactory$FormattingUnitOfWork.exec(ContentFormatterFactory.java:56)
at org.eclipse.xtext.ui.editor.formatting.ContentFormatterFactory$FormattingUnitOfWork.exec(ContentFormatterFactory.java:1)
at org.eclipse.xtext.util.concurrent.IStateAccess$AbstractImpl.readOnly(IStateAccess.java:40)
at org.eclipse.xtext.ui.editor.model.XtextDocument.readOnly(XtextDocument.java:58)
at org.eclipse.xtext.ui.editor.formatting.ContentFormatterFactory$ContentFormatter.format(ContentFormatterFactory.java:31)
at org.eclipse.jface.text.source.SourceViewer.doOperation(SourceViewer.java:969)
at org.eclipse.jface.text.source.projection.ProjectionViewer.doOperation(ProjectionViewer.java:1534)
at org.eclipse.ui.texteditor.TextOperationAction$1.run(TextOperationAction.java:131)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
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:476)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:468)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:786)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:885)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:567)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:508)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:123)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1031)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:3733)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1335)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1358)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1343)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1372)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1368)
at org.eclipse.swt.widgets.Canvas.sendKeyEvent(Canvas.java:416)
at org.eclipse.swt.widgets.Control.doCommandBySelector(Control.java:926)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:5020)
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:559)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4930)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:221)
at org.eclipse.swt.widgets.Widget.windowSendEvent(Widget.java:1911)
at org.eclipse.swt.widgets.Shell.windowSendEvent(Shell.java:1998)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4992)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
at org.eclipse.swt.widgets.Display.applicationSendEvent(Display.java:4536)
at org.eclipse.swt.widgets.Display.applicationProc(Display.java:4613)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
at org.eclipse.swt.internal.cocoa.NSApplication.sendEvent(NSApplication.java:115)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3247)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2601)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2565)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2399)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:669)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:662)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
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:369)
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:619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Caused by: java.lang.IllegalArgumentException: Illegal escape character \/
at org.eclipse.xtext.util.Strings.convertFromJavaString(Strings.java:184)
at org.eclipse.emf.mwe2.language.Mwe2ValueConverters$1.internalToValue(Mwe2ValueConverters.java:71)
... 75 more
Comment 1 Moritz Eysholdt CLA 2016-07-21 04:21:48 EDT
won't fix because it affects the old formatter infrastructure