Community
Participate
Working Groups
1. Create a project then select JPA Tools >Open Diagram. 2. It creates the file diagrams\diagram.xml and the diagram.xml opens in the editor. 3. Delete the diagrams folder (which contains the diagram.xml) the diagram editor still remains open. 4. Add a Java Entity to the diagram editor and then try and save 5. Receive problem occurred dialog that shows Save All Failed – java.lang.NullPointerException. 6. The same thing happens if I just deleted the diagram.xml. The diagram editor should close if the diagram.xml is deleted. The same thing happens if I just removed the diagram.xml – the diagram editor still remains open. java.lang.NullPointerException at org.eclipse.jpt.jpadiagrameditor.ui.internal.util.EntitiesCoordinatesXML.store(EntitiesCoordinatesXML.java:92) at org.eclipse.jpt.jpadiagrameditor.ui.internal.JPADiagramEditor.doSave(JPADiagramEditor.java:186) at org.eclipse.ui.internal.DefaultSaveable.doSave(DefaultSaveable.java:54) at org.eclipse.ui.Saveable.doSave(Saveable.java:214) at org.eclipse.ui.internal.SaveableHelper.doSaveModel(SaveableHelper.java:349) at org.eclipse.ui.internal.EditorManager$8.run(EditorManager.java:1269) at org.eclipse.ui.internal.SaveableHelper$5.run(SaveableHelper.java:277) 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:2642) at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:285) at org.eclipse.ui.internal.EditorManager.saveAll(EditorManager.java:1279) at org.eclipse.ui.internal.EditorManager.saveAll(EditorManager.java:1050) at org.eclipse.ui.internal.EditorManager.saveAll(EditorManager.java:1027) at org.eclipse.ui.internal.WorkbenchPage.saveAllEditors(WorkbenchPage.java:3406) at org.eclipse.ui.internal.handlers.SaveAllHandler.execute(SaveAllHandler.java:48) at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293) 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.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241) at org.eclipse.ui.internal.actions.CommandAction.runWithEvent(CommandAction.java:157) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501) at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:452) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4163) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3752) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494) at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123) 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:344) 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:597) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577) at org.eclipse.equinox.launcher.Main.run(Main.java:1410) at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Created attachment 198833 [details] Fix
Ina, please rework the patch as we agreed.
Created attachment 199090 [details] Fix reworked as agreed.
Created attachment 199091 [details] Fix reworked as agreed. (redundant imports deleted and a null check added)
The fix seems ok, but exposes a problem described in the bug #351409, so submitting the patch will have to wait until the other bug is fixed.
Created attachment 199741 [details] patch v4 It appears that this one needed a little more rework. With this last patch I still notice some problems. When you open and close the editor quick a few times and then try to delete the diagram xml file you get an error, that the file could not be deleted. I've researched the problem and I'm sure that the reason is not this fix or anything other in the editor. Somewhere (but I can't exactly put a finger on it) happens late closing of the file handles. In the editor the streams for reading/writing xml file are being closed explicitly, immediately after their usage, so the problem is somewhere else. I've monitored the handles with the process explorer (see the attached screenshot) and when you open/close editor quickly the number of the handled to the xml file increases, but after a minute they are being wiped and the user may delete the xml file. I believe that it's got something to do with the following post: http://www.eclipse.org/forums/index.php/t/172929/ Having in mind all of the above I consider that this version of the patch is ok and will submit it in the HEAD and in the maintenance release branch. For the file handles problem I will continue the research and eventually will open a bug (as long as I discover in which component).
One more comment. This patch actually fixes the problem described in the bug #351409. Both are too tightly related to separate them.
Common patch for bug #351409 and bug #348667 submitted
Created attachment 199746 [details] Screenshot of the process explorer
Verified in Build I-3.4.0-20110805150738 Verified user can delete diagram editor and/or diagram.xml file and the editor closes and no errors appear in error log. See the link to view test steps for verification. http://wiki.eclipse.org/Dali_3.0.1