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

No able to open a file once the folder value is invalid #10548

Closed
2 tasks done
Nosdok opened this issue Oct 23, 2023 · 8 comments · Fixed by #12038
Closed
2 tasks done

No able to open a file once the folder value is invalid #10548

Nosdok opened this issue Oct 23, 2023 · 8 comments · Fixed by #12038
Assignees
Labels
📍 Assigned Assigned by assign-issue-action (or manually assigned) bug Confirmed bugs or reports that are very likely to be bugs external files good first issue An issue intended for project-newcomers. Varies in difficulty.
Milestone

Comments

@Nosdok
Copy link

Nosdok commented Oct 23, 2023

JabRef version

5.11 (latest release)

Operating system

macOS

Details on version and operating system

14.0 Sonoma

Checked with the latest development build (copy version output from About dialog)

  • I made a backup of my libraries before testing the latest development version.
  • I have tested the latest development version and the problem persists

Steps to reproduce the behaviour

This problem is old and already solved (#2522) but on a failed mounted directory (with ssh) in the lastest JabRef version the problem exists (at least in MacOs).

  1. The .bib file was in a mounted directory that failed to connect due to a timeout.
  2. The mac system let the folder 'hanging' and not accessible anymore.
  3. At this point, I started JabRef, click in "open a library"
  4. But I don't get the 'open file' window, instead I get the following exception and I'm no longer able to open any file: "Uncaught exception occured in Thread[Fix for bug #1269 (SF) #39,JavaFX Application Thread,5,main]"

Find attached details of the error.

The partial solution is to force the unmounting (of the directory). Only then JabRef works properly and let me open the 'open file' window.

Appendix

...

Log File
java.lang.IllegalArgumentException: Folder parameter must be a valid folder
	at org.jabref.merged.module@5.11.60000/com.sun.glass.ui.CommonDialogs.convertFolder(CommonDialogs.java:239)
	at org.jabref.merged.module@5.11.60000/com.sun.glass.ui.CommonDialogs.showFileChooser(CommonDialogs.java:191)
	at org.jabref.merged.module@5.11.60000/com.sun.javafx.tk.quantum.QuantumToolkit.showFileChooser(QuantumToolkit.java:1719)
	at org.jabref.merged.module@5.11.60000/javafx.stage.FileChooser.showDialog(FileChooser.java:419)
	at org.jabref.merged.module@5.11.60000/javafx.stage.FileChooser.showOpenMultipleDialog(FileChooser.java:376)
	at org.jabref@5.11.60000/org.jabref.gui.JabRefDialogService.showFileOpenDialogAndGetMultipleFiles(JabRefDialogService.java:398)
	at org.jabref@5.11.60000/org.jabref.gui.importer.actions.OpenDatabaseAction.execute(OpenDatabaseAction.java:109)
	at org.jabref@5.11.60000/org.jabref.gui.actions.JabRefAction.lambda$new$3(JabRefAction.java:40)
	at org.jabref.merged.module@5.11.60000/org.controlsfx.control.action.Action.handle(Action.java:423)
	at org.jabref.merged.module@5.11.60000/org.controlsfx.control.action.Action.handle(Action.java:64)
	at org.jabref.merged.module@5.11.60000/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
	at org.jabref.merged.module@5.11.60000/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:232)
	at org.jabref.merged.module@5.11.60000/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:189)
	at org.jabref.merged.module@5.11.60000/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
	at org.jabref.merged.module@5.11.60000/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at org.jabref.merged.module@5.11.60000/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
	at org.jabref.merged.module@5.11.60000/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
	at org.jabref.merged.module@5.11.60000/javafx.event.Event.fireEvent(Event.java:198)
	at org.jabref.merged.module@5.11.60000/javafx.scene.control.MenuItem.fire(MenuItem.java:459)
	at org.jabref.merged.module@5.11.60000/com.sun.javafx.scene.control.GlobalMenuAdapter.lambda$bindMenuItemProperties$2(GlobalMenuAdapter.java:150)
	at org.jabref.merged.module@5.11.60000/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
	at org.jabref.merged.module@5.11.60000/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:232)
	at org.jabref.merged.module@5.11.60000/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:189)
	at org.jabref.merged.module@5.11.60000/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
	at org.jabref.merged.module@5.11.60000/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at org.jabref.merged.module@5.11.60000/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
	at org.jabref.merged.module@5.11.60000/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
	at org.jabref.merged.module@5.11.60000/javafx.event.Event.fireEvent(Event.java:198)
	at org.jabref.merged.module@5.11.60000/javafx.scene.control.MenuItem.fire(MenuItem.java:459)
	at org.jabref.merged.module@5.11.60000/com.sun.javafx.tk.quantum.GlassSystemMenu$1.action(GlassSystemMenu.java:234)
@Siedlerchr
Copy link
Member

Thanks for the report. There needs to be a check the file/folder is still existing.
As a workaround you can start JabRef from command line and reset your preferences.

https://docs.jabref.org/advanced/commandline#reset-preferences-d-key

@Siedlerchr Siedlerchr added the bug Confirmed bugs or reports that are very likely to be bugs label Oct 23, 2023
@Siedlerchr
Copy link
Member

Siedlerchr commented Oct 23, 2023

I think this methods which is called in OpenDatabaseAction must check if the directories exist and as fallback should return the user home directory

/**
* @return Path of current panel database directory or the working directory
*/
private Path getInitialDirectory() {
if (frame.getLibraryTabs().isEmpty()) {
return preferencesService.getFilePreferences().getWorkingDirectory();
} else {
Optional<Path> databasePath = frame.getCurrentLibraryTab().getBibDatabaseContext().getDatabasePath();
return databasePath.map(Path::getParent).orElse(preferencesService.getFilePreferences().getWorkingDirectory());
}
}

@Siedlerchr Siedlerchr added good first issue An issue intended for project-newcomers. Varies in difficulty. external files labels Oct 23, 2023
@devanshim2207
Copy link

Hi @Siedlerchr ..I would like to work on this issue.

@ThiloteE ThiloteE added the FirstTimeCodeContribution Triggers GitHub Greeter Workflow label Jan 13, 2024
Copy link
Contributor

As a general advice for newcomers: check out Contributing for a start. Also, guidelines for setting up a local workspace is worth having a look at.

Feel free to ask here at GitHub, if you have any issue related questions. If you have questions about how to setup your workspace use JabRef's Gitter chat. Try to open a (draft) pull-request early on, so that people can see you are working on the issue and so that they can see the direction the pull request is heading towards. This way, you will likely receive valuable feedback.

@koppor koppor removed the FirstTimeCodeContribution Triggers GitHub Greeter Workflow label Mar 25, 2024
@koppor
Copy link
Member

koppor commented Mar 25, 2024

@devanshim2207 We did not see any activity the last 8 weeks, therefore I unassigned you.

@koppor koppor added this to the 6.0-beta milestone Sep 16, 2024
@Boston54
Copy link
Contributor

@Siedlerchr I would like to have a go at this issue if it's available.

@mag-sun
Copy link

mag-sun commented Oct 10, 2024

Hi, I am a student at the Australian National University. For one of our assignments, we are tasked with working in a group to contribute to an open-source project - and I would like to be assigned to this issue. While working, our group will cross-review our code and help each other out to have the most efficient progress. Thanks so much!

@ThiloteE
Copy link
Member

I assigned @Boston54.
@mag-sun at JabRef we have a first come first serve policy. This is to avoid double work, prevent arguments between students, to prevent disappointment when only one of competing pull-requests gets merged and finally to prevent issues with grading. In principle all issues can be worked on and no restrictions apply, but we try to lookout for students especially. Please choose another good first issue that is "free to take" from https://github.com/orgs/JabRef/projects/5. If you feel confident, you also can choose from https://github.com/orgs/JabRef/projects/3, but those are slightly more difficult and advanced.

@koppor koppor added the 📍 Assigned Assigned by assign-issue-action (or manually assigned) label Oct 16, 2024
Boston54 pushed a commit to Boston54/jabref that referenced this issue Oct 19, 2024
Boston54 pushed a commit to Boston54/jabref that referenced this issue Oct 20, 2024
github-merge-queue bot pushed a commit that referenced this issue Oct 23, 2024
* Caught an error when accessing an invalid path. fixes #10548

* Fixed typo in issue num

* Moved changelog entry to unreleased section

* Moved try-catch and added tests

* Fix checkstyle

* Fix checkstyle again

* Fix checkstyle fr this time

* Discard changes to external-libraries.md

* Result of "rewriteRun"

* Add link to issue

* Use VisibleForTesting annotation

* Remove Jimfs depdencency

---------

Co-authored-by: Tom Martin <u7656592@anu.edu.au>
Co-authored-by: Oliver Kopp <kopp.dev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📍 Assigned Assigned by assign-issue-action (or manually assigned) bug Confirmed bugs or reports that are very likely to be bugs external files good first issue An issue intended for project-newcomers. Varies in difficulty.
Projects
Status: Done
Status: Done
Development

Successfully merging a pull request may close this issue.

7 participants