aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2019-06-26 09:10:31 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2019-07-17 09:42:14 +0200
commitbe66222d1a607ef3feb3b076352e9b8251e0eec2 (patch)
tree4705489f2084ae44d547b397c23c6f4fdb4ee941 /org.eclipse.jgit
parent09fec1a1024ab70322ab14ebd2f7aa4313c7c2e3 (diff)
downloadjgit-be66222d1a607ef3feb3b076352e9b8251e0eec2.tar.gz
jgit-be66222d1a607ef3feb3b076352e9b8251e0eec2.zip
FS: ignore AccessDeniedException when measuring timestamp resolution
It seems on cygwin creating a file under a writable directory can fail with AccessDeniedException. Log a warning in this case and fallback to worst case timestamp resolution of 2 seconds. Bug: 548648 Change-Id: Ic50c31ce9dc9ccadd4db5247df929418ac62d45c Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java
index 64dbf58233..67634cbe78 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java
@@ -56,6 +56,7 @@ import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintStream;
import java.nio.charset.Charset;
+import java.nio.file.AccessDeniedException;
import java.nio.file.FileStore;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -312,6 +313,8 @@ public abstract class FS {
Duration resolution = Duration.between(t1.toInstant(), t2.toInstant());
saveFileTimeResolution(s, resolution);
return Optional.of(resolution);
+ } catch (AccessDeniedException e) {
+ LOG.warn(e.getLocalizedMessage(), e); // see bug 548648
} catch (IOException | TimeoutException e) {
LOG.error(e.getLocalizedMessage(), e);
} catch (InterruptedException e) {