Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception thrown when trying to open a new file if the last opened file/folder has been deleted #101

Open
rolnico opened this issue Mar 13, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@rolnico
Copy link
Member

rolnico commented Mar 13, 2024

Describe the current behavior

When I try to open a new file (by clicking on the "..." button on the top right), I get an exception:

  • If the last opened file has been deleted, but the window still opens so I can choose another file
  • If the folder containing the last opened file has been deleted. In that case, another exception is thrown and the window does not even open so I'm stuck until I recreate the folder

Describe the expected behavior

In both cases, no exception should be thrown and the window should open in any case (by default, in either the user's home directory or the project's directory)

Describe the steps

  1. Open the diagram viewer
  2. Open a file in some specific folder (that you can delete later) --> this works
  3. Delete the file
  4. Try to open another file --> Exception thrown but the window opens
  5. Delete the folder
  6. Try to open another file --> Exception thrown and the window does not open

Environment

No response

Relevant Log Output

2024-03-13_15:08:58.854 [JavaFX Application Thread] ERROR c.p.d.viewer.MainViewController - com.powsybl.commons.PowsyblException: File /home/rolnic/projects/workspace/powsybl-network-store/network-store-iidm-impl/src/test/resources/test.xiidm does not exist or is not a regular file
com.powsybl.commons.PowsyblException: File /home/rolnic/projects/workspace/powsybl-network-store/network-store-iidm-impl/src/test/resources/test.xiidm does not exist or is not a regular file
	at com.powsybl.commons.datasource.DataSource.fromPath(DataSource.java:29)
	at com.powsybl.iidm.network.Network.read(Network.java:124)
	at com.powsybl.iidm.network.Network.read(Network.java:134)
	at com.powsybl.iidm.network.Network.read(Network.java:148)
	at com.powsybl.iidm.network.Network.read(Network.java:162)
	at com.powsybl.diagram.viewer.MainViewController$2$1.call(MainViewController.java:185)
	at com.powsybl.diagram.viewer.MainViewController$2$1.call(MainViewController.java:180)
	at [email protected]/javafx.concurrent.Task$TaskCallable.call(Task.java:1426)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at [email protected]/javafx.concurrent.Service.lambda$executeTask$6(Service.java:726)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at [email protected]/javafx.concurrent.Service.lambda$executeTask$7(Service.java:725)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)

If the folder has been deleted, you get the previous log followed by:

Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
	at [email protected]/javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1857)
	at [email protected]/javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1724)
	at [email protected]/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
	at [email protected]/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:234)
	at [email protected]/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
	at [email protected]/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
	at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
	at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at [email protected]/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
	at [email protected]/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
	at [email protected]/javafx.event.Event.fireEvent(Event.java:198)
	at [email protected]/javafx.scene.Scene$ClickGenerator.postProcess(Scene.java:3599)
	at [email protected]/javafx.scene.Scene$MouseHandler.process(Scene.java:3903)
	at [email protected]/javafx.scene.Scene.processMouseEvent(Scene.java:1887)
	at [email protected]/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2620)
	at [email protected]/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:411)
	at [email protected]/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:301)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at [email protected]/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:450)
	at [email protected]/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:424)
	at [email protected]/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:449)
	at [email protected]/com.sun.glass.ui.View.handleMouseEvent(View.java:551)
	at [email protected]/com.sun.glass.ui.View.notifyMouse(View.java:937)
	at [email protected]/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
	at [email protected]/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:316)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at com.sun.javafx.reflect.Trampoline.invoke(MethodUtil.java:77)
	at jdk.internal.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at [email protected]/com.sun.javafx.reflect.MethodUtil.invoke(MethodUtil.java:275)
	at [email protected]/com.sun.javafx.fxml.MethodHelper.invoke(MethodHelper.java:84)
	at [email protected]/javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1852)
	... 29 more
Caused by: java.lang.IllegalArgumentException: Folder parameter must be a valid folder
	at [email protected]/com.sun.glass.ui.CommonDialogs.convertFolder(CommonDialogs.java:239)
	at [email protected]/com.sun.glass.ui.CommonDialogs.showFileChooser(CommonDialogs.java:191)
	at [email protected]/com.sun.javafx.tk.quantum.QuantumToolkit.showFileChooser(QuantumToolkit.java:1702)
	at [email protected]/javafx.stage.FileChooser.showDialog(FileChooser.java:419)
	at [email protected]/javafx.stage.FileChooser.showOpenDialog(FileChooser.java:354)
	at com.powsybl.diagram.viewer.MainViewController.onClickLoadFile(MainViewController.java:171)
	... 40 more

Extra Information

No response

@rolnico rolnico added the bug Something isn't working label Mar 13, 2024
@tadam50
Copy link
Contributor

tadam50 commented Apr 15, 2024

Fixed by #109

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants