jabref icon indicating copy to clipboard operation
jabref copied to clipboard

Main file directory is used if not empty, even if deactivated

Open h4ppyM opened this issue 2 years ago • 19 comments

JabRef version

5.9 (latest release)

Operating system

Windows

Details on version and operating system

Windows 10 Pro 21H2

Checked with the latest development build

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

Steps to reproduce the behaviour

Since stable version 5.8 (and also with the new 5.10 build from 2023-01-11) I get the following error message displayed when using the function "Automatically set file links": error

With stable version 5.7 this function works properly.

Appendix

Detail information:
Problem finding files
java.io.IOException: Problem in finding files
	at [email protected]/org.jabref.logic.util.io.CitationKeyBasedFileFinder.findFilesByExtension(Unknown Source)
	at [email protected]/org.jabref.logic.util.io.CitationKeyBasedFileFinder.findAssociatedFiles(Unknown Source)
	at [email protected]/org.jabref.gui.externalfiles.AutoSetFileLinksUtil.findAssociatedNotLinkedFiles(Unknown Source)
	at [email protected]/org.jabref.gui.externalfiles.AutoSetFileLinksUtil.linkAssociatedFiles(Unknown Source)
	at [email protected]/org.jabref.gui.externalfiles.AutoLinkFilesAction$1.call(Unknown Source)
	at [email protected]/org.jabref.gui.externalfiles.AutoLinkFilesAction$1.call(Unknown Source)
	at [email protected]/javafx.concurrent.Task$TaskCallable.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.io.UncheckedIOException: java.nio.file.AccessDeniedException: C:\Users\Michael\Documents\Eigene Bilder
	at java.base/java.nio.file.FileTreeIterator.fetchNextIfNeeded(Unknown Source)
	at java.base/java.nio.file.FileTreeIterator.hasNext(Unknown Source)
	at java.base/java.util.Iterator.forEachRemaining(Unknown Source)
	at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
	at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)
	... 13 more
Caused by: java.nio.file.AccessDeniedException: C:\Users\Michael\Documents\Eigene Bilder
	at java.base/sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
	at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
	at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
	at java.base/sun.nio.fs.WindowsDirectoryStream.<init>(Unknown Source)
	at java.base/sun.nio.fs.WindowsFileSystemProvider.newDirectoryStream(Unknown Source)
	at java.base/java.nio.file.Files.newDirectoryStream(Unknown Source)
	at java.base/java.nio.file.FileTreeWalker.visit(Unknown Source)
	at java.base/java.nio.file.FileTreeWalker.next(Unknown Source)
	... 22 more

h4ppyM avatar Jan 12 '23 07:01 h4ppyM

Hi, the error message says it searches for files in your documents folder. C:\Users\Michael\Documents and cannot access the pictures folder. You should check and adjust the settings for the main file directory in the Preferences -> Linked Files to point to the location of where your pdfs are stored

Siedlerchr avatar Jan 12 '23 17:01 Siedlerchr

In the library settings the directories are correctly set to my library folder of the project and my LaTeX project folder. Also in the Preferences -> Linked files the "File directory" was set to "Search and store files relative to library file location". But in the text field next to the option "Main file directory" the path C:\Users\Michael\Documents was printed but grayed out as the option was unchecked.

So it seems like JabRef is searching the main file directory although the option is not activated, which seems to be an unexpected behavior.

PS: When I check the "Main file directory", delete the path and check back the "Search and store files relative to library file location" option the "Automatically set file links" function works again with v. 5.9.

h4ppyM avatar Jan 12 '23 18:01 h4ppyM

Yes, this seems odd. Can you try to set the main file directory to empty? Does it work then?

Siedlerchr avatar Jan 12 '23 20:01 Siedlerchr

Yes, that's what I've meant in my previous post. When I empty the main file directory (although option is not activated) it is working.

h4ppyM avatar Jan 12 '23 20:01 h4ppyM

Okay, thanks for the clarification. Tagged this as bug.

Siedlerchr avatar Jan 12 '23 20:01 Siedlerchr

Recent commits, of which one of them could be the likely cause for this regression:

  • https://github.com/JabRef/jabref/pull/9433
  • https://github.com/JabRef/jabref/pull/9316
  • https://github.com/JabRef/jabref/pull/9290
  • https://github.com/JabRef/jabref/pull/9222
  • https://github.com/JabRef/jabref/pull/9129
  • https://github.com/JabRef/jabref/pull/9113

ThiloteE avatar Jan 13 '23 11:01 ThiloteE

Hi I would like to contribute to this issue can you let me know how I can go about this issue?

sreenath-tm avatar Jan 20 '23 11:01 sreenath-tm

Hello sreenath-tm, welcome back :-)

One approach would be to find the regression window by finding the commit that broke it. By finding that exact commit, you will find the part of the code, which is of most relevance here.

To open an older commit, you can use following command:

	./gradlew clean
	git checkout <commithash>

ThiloteE avatar Jan 20 '23 13:01 ThiloteE

Sure @ThiloteE will take a look into these commits.

sreenath-tm avatar Jan 21 '23 13:01 sreenath-tm

@Siedlerchr @h4ppyM I am unable to reproduce this error can you just let me know that before clicking the "Automatically set file links" is there any thing specific entry that I should make. I have ensured that options in the preference is as specified by @h4ppyM .

sreenath-tm avatar Jan 27 '23 14:01 sreenath-tm

In my case, the path was set to my PC's picture folder (C:\Users\Michael\Documents\Eigene Bilder), but greyed out as the option was not selected.

h4ppyM avatar Jan 27 '23 14:01 h4ppyM

I am actually getting this screenshot while trying to automatically set the link. Is there any particular link or entry that I can try out to mimic the issue. image

sreenath-tm avatar Jan 27 '23 19:01 sreenath-tm

@h4ppyM extremely sorry for disturbing but I am unable to mimic the exact behaviour ,so can you let me know how you are importing the file into jabref. @Siedlerchr are you able to reproduce the issue?

sreenath-tm avatar Jan 30 '23 17:01 sreenath-tm

Hello sir , I am new to open source contribution. I already know java , my tech stacks & tools includes C, C++ , Python , Java, JavaScript , HTML , CSS , SQL , Bootstrap, ReactJS, ExpressJS, NodeJS & Git . I need a little help from your side to contribute to these amazing projects.

ghost avatar Feb 01 '23 03:02 ghost

Please feel free to take up this issue @itsarraj .You can go through the documentation https://devdocs.jabref.org/contributing and do the setup for jabref and then try reproducing the issue.

sreenath-tm avatar Feb 01 '23 12:02 sreenath-tm

Might be related: https://github.com/JabRef/jabref/issues/8010 Maybe fixed by https://github.com/JabRef/jabref/pull/9837

ThiloteE avatar May 11 '23 11:05 ThiloteE

The main challenge of this is issue to create JUnit tests to express the desired behavior.

koppor avatar May 21 '23 09:05 koppor

Didn't we just fix this?

Siedlerchr avatar May 21 '23 10:05 Siedlerchr

@h4ppyM can you please test the latest development version? As far as I know we fixed some issues related to that https://builds.jabref.org/main/

Siedlerchr avatar Aug 09 '23 17:08 Siedlerchr