aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org
diff options
context:
space:
mode:
authorNasser Grainawi <quic_nasserg@quicinc.com>2021-12-03 10:05:53 -0700
committerMatthias Sohn <matthias.sohn@sap.com>2021-12-03 22:09:50 +0100
commit38db89142dc2f75fc63fd316a3bf8b0f6d8655a2 (patch)
tree8ef09083ea65be7bae4dbd5bb9cd972d1951bef3 /org.eclipse.jgit/src/org
parentf829f5f838e0f9c17373ea6cb3407976a8f395ff (diff)
downloadjgit-38db89142dc2f75fc63fd316a3bf8b0f6d8655a2.tar.gz
jgit-38db89142dc2f75fc63fd316a3bf8b0f6d8655a2.zip
storage: file: De-duplicate File.exists()+File.isFile()
File.isFile() [1] checks if the file exists and is a normal file. [1] https://docs.oracle.com/javase/8/docs/api/java/io/File.html#isFile-- Change-Id: I0a883f2482ecc5ac58b270351b416742b568eb68 Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
Diffstat (limited to 'org.eclipse.jgit/src/org')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryPackParser.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java2
2 files changed, 2 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryPackParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryPackParser.java
index 6e8a15e86d..889a5108d4 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryPackParser.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryPackParser.java
@@ -184,7 +184,7 @@ public class ObjectDirectoryPackParser extends PackParser {
String p = pack.getAbsolutePath();
String i = p.substring(0, p.length() - ".pack".length()) + ".idx"; //$NON-NLS-1$ //$NON-NLS-2$
File idx = new File(i);
- if (idx.exists() && idx.isFile())
+ if (idx.isFile())
size += idx.length();
return size;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
index c15e26cd43..c34be9cc0a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
@@ -1110,7 +1110,7 @@ public class RefDirectory extends RefDatabase {
try {
buf = IO.readSome(path, limit);
} catch (FileNotFoundException noFile) {
- if (path.exists() && path.isFile()) {
+ if (path.isFile()) {
throw noFile;
}
return null; // doesn't exist or no file; not a reference.