aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/util
diff options
context:
space:
mode:
authorMartin Fick <mfick@codeaurora.org>2015-08-25 07:48:50 -0600
committerMartin Fick <mfick@codeaurora.org>2015-08-25 08:19:54 -0600
commitcb08dd8b14bf4900c7974dd1ce5a3d553016585a (patch)
tree1889b8f0cf4b22bba43ac0406e9809e6aad90a87 /org.eclipse.jgit/src/org/eclipse/jgit/util
parent847b3d12584d298d98eee9b2981e8123c067ab52 (diff)
downloadjgit-cb08dd8b14bf4900c7974dd1ce5a3d553016585a.tar.gz
jgit-cb08dd8b14bf4900c7974dd1ce5a3d553016585a.zip
Add public isStaleFileHandle() API, improve detection.
Add a public API to the FileUtils to determine if an IOException is a stale NFS file handle exception. This will make it easier to detect such errors, and interpret them consistently throughout the codebase. This new API is a bit more lenient in its detection than the previous detection, and should be able to detect some errors which previously were not identified as stale file handle exceptions because they had the word NFS in the error message. Adjust the packfile handling code to use this new API for detection. Change-Id: I21f80014546ba1afec7335890e5ae79e7f521412 Signed-off-by: Martin Fick<mfick@codeaurora.org>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/util')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java
index 56eecc48d3..126384b7ae 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java
@@ -514,4 +514,15 @@ public class FileUtils {
}
return builder.toString();
}
+
+ /**
+ * Determine if an IOException is a Stale NFS File Handle
+ *
+ * @param ioe
+ * @return a boolean true if the IOException is a Stale NFS FIle Handle
+ */
+ public static boolean isStaleFileHandle(IOException ioe) {
+ String msg = ioe.getMessage();
+ return msg != null && msg.toLowerCase().matches("stale .*file .*handle");
+ }
}