Browse Source

Fix IOException when LockToken#close fails

This happened if the LockTokens hard link was already deleted earlier.

Bug: 531759
Change-Id: Idc84bd695fac1a763b3cbb797c9c4c636a16e329
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-4.7
Matthias Sohn 6 years ago
parent
commit
e6e9073fc7
  1. 19
      org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java

19
org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java

@ -841,13 +841,18 @@ public abstract class FS {
@Override @Override
public void close() { public void close() {
if (link.isPresent()) { if (!link.isPresent()) {
try { return;
Files.delete(link.get()); }
} catch (IOException e) { Path p = link.get();
LOG.error(MessageFormat.format(JGitText.get().closeLockTokenFailed, if (!Files.exists(p)) {
this), e); return;
} }
try {
Files.delete(p);
} catch (IOException e) {
LOG.error(MessageFormat
.format(JGitText.get().closeLockTokenFailed, this), e);
} }
} }

Loading…
Cancel
Save