Issue #113 resolved

Deleting text with fragments can cause instabilities

Martin Robillard
created an issue

Deleted a chunk of text with multiple fragments. The save failed and the fragment structure became corrupted.

!ENTRY org.eclipse.ui 2 0 2011-03-14 16:47:53.296 !MESSAGE Save Failed !STACK 0 ca.mcgill.cs.swevo.qualyzer.QualyzerException: Cannot delete this fragment. at ca.mcgill.cs.swevo.qualyzer.model.Facade.deleteFragment(Facade.java:762) at ca.mcgill.cs.swevo.qualyzer.editors.RTFAnnotationModel.removeAnnotation(RTFAnnotationModel.java:61) at org.eclipse.jface.text.source.AnnotationModel.removeAnnotation(AnnotationModel.java:840) at ca.mcgill.cs.swevo.qualyzer.editors.RTFDocumentProvider.updateFragment(RTFDocumentProvider.java:794) at ca.mcgill.cs.swevo.qualyzer.editors.RTFDocumentProvider.doSaveDocument(RTFDocumentProvider.java:766) at org.eclipse.ui.texteditor.AbstractDocumentProvider$1$SaveOperation.execute(AbstractDocumentProvider.java:608) at org.eclipse.ui.texteditor.AbstractDocumentProvider$DocumentProviderOperation.run(AbstractDocumentProvider.java:74) at org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation.execute(WorkspaceModifyDelegatingOperation.java:69) at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:106) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1800) at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:118) at org.eclipse.ui.internal.editors.text.WorkspaceOperationRunner.run(WorkspaceOperationRunner.java:75) at org.eclipse.ui.internal.editors.text.WorkspaceOperationRunner.run(WorkspaceOperationRunner.java:65) at org.eclipse.ui.texteditor.AbstractDocumentProvider.executeOperation(AbstractDocumentProvider.java:549) at org.eclipse.ui.texteditor.AbstractDocumentProvider.saveDocument(AbstractDocumentProvider.java:627) at org.eclipse.ui.texteditor.AbstractTextEditor.performSave(AbstractTextEditor.java:4946) at org.eclipse.ui.texteditor.AbstractTextEditor.doSave(AbstractTextEditor.java:4735) at ca.mcgill.cs.swevo.qualyzer.editors.RTFEditor.doSave(RTFEditor.java:754) at org.eclipse.ui.texteditor.AbstractTextEditor$TextEditorSavable.doSave(AbstractTextEditor.java:7067) at org.eclipse.ui.Saveable.doSave(Saveable.java:214) at org.eclipse.ui.internal.SaveableHelper.doSaveModel(SaveableHelper.java:346) at org.eclipse.ui.internal.SaveableHelper$3.run(SaveableHelper.java:193) at org.eclipse.ui.internal.SaveableHelper$5.run(SaveableHelper.java:274) at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372) at org.eclipse.jface.window.ApplicationWindow$1.run(ApplicationWindow.java:759) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) at org.eclipse.jface.window.ApplicationWindow.run(ApplicationWindow.java:756) at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2579) at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:282) at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:261) at org.eclipse.ui.internal.SaveableHelper.saveModels(SaveableHelper.java:204) at org.eclipse.ui.internal.SaveableHelper.savePart(SaveableHelper.java:144) at org.eclipse.ui.internal.EditorManager.savePart(EditorManager.java:1357) at org.eclipse.ui.internal.WorkbenchPage.savePart(WorkbenchPage.java:3328) at org.eclipse.ui.internal.WorkbenchPage.saveEditor(WorkbenchPage.java:3341) at org.eclipse.ui.internal.SaveAction.run(SaveAction.java:76) 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:470) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:824) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:880) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:569) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:510) at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:125) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1208) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1002) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1027) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1012) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1040) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1036) at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1368) at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4053) at org.eclipse.swt.widgets.Canvas.WM_CHAR(Canvas.java:346) at org.eclipse.swt.widgets.Control.windowProc(Control.java:3946) at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:342) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4619) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2411) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3501) 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 ca.mcgill.cs.swevo.qualyzer.Application.start(Application.java:37) 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(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) 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) Caused by: org.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade (remove deleted object from associations): [ca.mcgill.cs.swevo.qualyzer.model.Fragment#66] at org.hibernate.impl.SessionImpl.forceFlush(SessionImpl.java:1220) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:188) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:117) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93) at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:677) at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:669) at org.hibernate.engine.CascadingAction$5.cascade(CascadingAction.java:252) at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:392) at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:335) at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:204) at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:425) at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:362) at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:338) at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:204) at org.hibernate.engine.Cascade.cascade(Cascade.java:161) at org.hibernate.engine.Cascade.cascade(Cascade.java:127) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.cascadeOnUpdate(DefaultSaveOrUpdateEventListener.java:376) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performUpdate(DefaultSaveOrUpdateEventListener.java:350) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsDetached(DefaultSaveOrUpdateEventListener.java:246) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:112) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93) at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:677) at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:669) at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:665) at ca.mcgill.cs.swevo.qualyzer.model.Facade.deleteFragment(Facade.java:742) ... 84 more !SESSION 2011-03-15 14:57:44.203 ----------------------------------------------- eclipse.buildId=unknown java.version=1.6.0_24 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US Command-line arguments: -os win32 -ws win32 -arch x86 -data @user.home/QualyzerWorkspace

!ENTRY org.eclipse.core.resources 2 10035 2011-03-15 14:57:46.468 !MESSAGE The workspace exited with unsaved changes in the previous session; refreshing workspace to recover changes. ==== End of Workspace Log ====

=== END OF REPORT ===

Comments (9)

  1. Martin Robillard reporter

    ERROR Cannot delete this fragment. org.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade (remove deleted object from associations): [ca.mcgill.cs.swevo.qualyzer.model.Fragment#70] at org.hibernate.impl.SessionImpl.forceFlush(SessionImpl.java:1220) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:188) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:117) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93) at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:677) at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:669) at org.hibernate.engine.CascadingAction$5.cascade(CascadingAction.java:252) at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:392) at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:335) at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:204) at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:425) at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:362) at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:338) at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:204) at org.hibernate.engine.Cascade.cascade(Cascade.java:161) at org.hibernate.engine.Cascade.cascade(Cascade.java:127) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.cascadeOnUpdate(DefaultSaveOrUpdateEventListener.java:376) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performUpdate(DefaultSaveOrUpdateEventListener.java:350) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsDetached(DefaultSaveOrUpdateEventListener.java:246) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:112) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93) at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:677) at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:669) at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:665) at ca.mcgill.cs.swevo.qualyzer.model.Facade.deleteFragment(Facade.java:742) at ca.mcgill.cs.swevo.qualyzer.editors.RTFAnnotationModel.removeAnnotation(RTFAnnotationModel.java:61) at org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel.removeAnnotations(AbstractMarkerAnnotationModel.java:342) at org.eclipse.jface.text.source.AnnotationModel.cleanup(AnnotationModel.java:672) at org.eclipse.jface.text.source.AnnotationModel.cleanup(AnnotationModel.java:646) at org.eclipse.jface.text.source.AnnotationModel.getAnnotationIterator(AnnotationModel.java:781) at org.eclipse.jface.text.source.AnnotationModel.getAnnotationIterator(AnnotationModel.java:758) at org.eclipse.jface.text.source.AnnotationModel.getAnnotationIterator(AnnotationModel.java:690) at ca.mcgill.cs.swevo.qualyzer.editors.RTFEditor.isBoldEnabled(RTFEditor.java:308) at ca.mcgill.cs.swevo.qualyzer.editors.RTFEditor$1.selectionChanged(RTFEditor.java:191) at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java:162) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.runtime.Platform.run(Platform.java:888) at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:48) at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175) at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:160) at org.eclipse.jface.text.TextViewer.fireSelectionChanged(TextViewer.java:2714) at org.eclipse.jface.text.TextViewer.delete(TextViewer.java:4020) at org.eclipse.jface.text.TextViewer.doOperation(TextViewer.java:3973) at org.eclipse.jface.text.source.SourceViewer.doOperation(SourceViewer.java:921) at org.eclipse.jface.text.source.projection.ProjectionViewer.doOperation(ProjectionViewer.java:1450) 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:470) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:824) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:880) at org.eclipse.ui.internal.keys.OutOfOrderListener.handleEvent(OutOfOrderListener.java:76) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1027) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1012) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1040) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1036) at org.eclipse.swt.widgets.Widget.wmKeyDown(Widget.java:1669) at org.eclipse.swt.widgets.Control.WM_KEYDOWN(Control.java:4281) at org.eclipse.swt.widgets.Control.windowProc(Control.java:3977) at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:342) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4632) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2411) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3501) 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 ca.mcgill.cs.swevo.qualyzer.Application.start(Application.java:37) 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(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) 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) at org.eclipse.equinox.launcher.Main.main(Main.java:1287)

  2. Barthelemy Dagenais

    Hi Martin, can you list the steps to reproduce the bug? I tried to mark multiple fragments in a sentence, then I deleted the sentence and press saved and there was no problem :-(

  3. Martin Robillard reporter

    This is an intermittent bug. I can only reproduce it by chance, by marking multiple sentences, deleting various sections with fragments and, eventually, it triggers. I've replicated steps which triggered the bug once and the second time they didn't trigger it.

    For example, enter these 3 sentences.

    This is sentence 1. This is sentence 2. This is sentence 3.

    3 times on 3 separate lines, each separated by a blank line. Then add a code to sentence 2 in all 3 cases, then delete various sections, putting them back with undo if it doesn't trigger the bug, and, eventually, it might do it.

  4. BeauRay

    I somehow managed to reproduce the bug. Basically, I did as Mr. Martin said, I think the bug appears when the deleted fragments includes some ponctuation symbols, but that is just my personal guess. And I am attaching a short video clip to illustrate how I got this bug, it is in avi format, any standard player should be able to read it. Just jump to 1:30, that is when the bug is happening

  5. Martin Robillard reporter

    Another way to replicate this bug is as follows:

    select one word and the " " character besides it, code the selected part delete the coded word, (not the " " character, so it is still coded) press ctrl-z to bring back the word and save the file, delete the coded " ", then press ctrl-z to bring the " " character back and save, then an error is produced It doesn't seem like a major issue, as the odd of this happening is slim, and I highly doubt it is a dublicate of bug#113,

  6. Martin Robillard reporter

    STEPS TO REPRODUCE:

    In a new transcript:

    1. Type the sentence "A B".
    2. Mark the first 2 characters as a fragment ("A ")
    3. Delete A (not the space after)
    4. Ctrl-Z to put A back
    5. Select the whole sentence ("A B")
    6. Delete it with del
    7. Ctrl-S to save

    This works every time, which means the bug is caused by a subtle combination of undo actions and fragment deletions.

  7. Log in to comment