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

Improve error handling when renaming a linked file #3229

Closed
tobiasdiez opened this issue Sep 20, 2017 · 1 comment
Closed

Improve error handling when renaming a linked file #3229

tobiasdiez opened this issue Sep 20, 2017 · 1 comment

Comments

@tobiasdiez
Copy link
Member

JabRef 4.0-dev--snapshot--2017-09-20--master--b0489d5b3
Windows 10 10.0 amd64
Java 1.8.0_131

Steps to reproduce:

  1. Link a pdf to an entry and open the pdf.
  2. Right click the file in the entry editor and choose "Rename file"
  3. Rename fails since access is denied (which is ok), but no error message is shown to the user. The following exception is logged however.
Detail information:
Renaming Files failed
java.nio.file.FileSystemException: file.pdf -> new file name.pdf: The process cannot access the file because it is being used by another process.

	at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
	at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
	at sun.nio.fs.WindowsFileCopy.move(Unknown Source)
	at sun.nio.fs.WindowsFileSystemProvider.move(Unknown Source)
	at java.nio.file.Files.move(Unknown Source)
	at org.jabref.logic.util.io.FileUtil.renameFile(FileUtil.java:195)
	at org.jabref.logic.cleanup.RenamePdfCleanup.cleanup(RenamePdfCleanup.java:121)
	at org.jabref.gui.fieldeditors.LinkedFileViewModel.performRenameWithConflictCheck(LinkedFileViewModel.java:198)
	at org.jabref.gui.fieldeditors.LinkedFileViewModel.rename(LinkedFileViewModel.java:186)
	at org.jabref.gui.fieldeditors.LinkedFilesEditor.lambda$createContextMenuForFile$7(LinkedFilesEditor.java:238)
	at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
	at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
	at javafx.event.Event.fireEvent(Event.java:198)
	at javafx.scene.control.MenuItem.fire(MenuItem.java:462)
	at com.sun.javafx.scene.control.skin.ContextMenuContent$MenuItemContainer.doSelect(ContextMenuContent.java:1405)
	at com.sun.javafx.scene.control.skin.ContextMenuContent$MenuItemContainer.lambda$createChildren$343(ContextMenuContent.java:1358)
	at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
	at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
	at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
	at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
	at javafx.event.Event.fireEvent(Event.java:198)
	at javafx.scene.Scene$MouseHandler.process(Scene.java:3757)
	at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
	at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
	at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:381)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$354(GlassViewEventHandler.java:417)
	at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:416)
	at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
	at com.sun.glass.ui.View.notifyMouse(View.java:937)
	at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
	at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
	at java.lang.Thread.run(Unknown Source)

tobiasdiez pushed a commit that referenced this issue Sep 26, 2017
* Implemented issue #3229

* Dialog moved to FileUtil

* Keys synchronized.

* Style fixed in FileUtil.java

* Exception throwing methods added

* Duplicate code removed.
@tobiasdiez
Copy link
Member Author

Implemented by @derebaba!

Siedlerchr added a commit that referenced this issue Oct 7, 2017
* upstream/master: (113 commits)
  Open statistics dialog from correct thread (#3272)
  Fix for issue 2811: bibtexkey generator does not use crossref information (#3248)
  Fix for issue 3143: Import entry from clipboard in different formats (#3243)
  French translation correction (#3262)
  Wait to ask to collect anonymous statistics in JabRefExecutorService to allow jvm to terminate (#3266)
  Directory pattern bracketed expressions (#3238)
  Show development information
  Release v4.0
  add another author to mailmap
  moved changelog entry to the right category
  update new AUTHORS info
  Update log4j from 2.9.0 -> 2.9.1
  fix dblp fetcher
  Add missing Turkish translation
  Add "-console" parameter for Windows launcher (#3242)
  Path check converted to if statement
  Changelog updated
  Fixed renaming files which are not in main directory.
  Only use last name for auto completion in search bar. Fixes koppor#253
  Implemented issue #3229 (#3233)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant