]> source.dussan.org Git - jgit.git/commitdiff
Warn if configured cookie file is missing 94/143594/2
authorMatthias Sohn <matthias.sohn@sap.com>
Sun, 9 Jun 2019 07:49:07 +0000 (09:49 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Sun, 9 Jun 2019 10:27:18 +0000 (12:27 +0200)
We logged a stack trace if the configured http.cookieFile was missing.
Instead only log a warning.

Bug: 548081
Change-Id: I42e39f5ad8ffce7b43162e5068f60af073b8a126
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/transport/http/NetscapeCookieFile.java

index 88fdc3d818eea22ca6cd37198d40540fbfb5da35..afa87617406b928be3568e53ad6a8e91f9b8e76f 100644 (file)
@@ -459,6 +459,7 @@ mismatchOffset=mismatch offset for object {0}
 mismatchCRC=mismatch CRC for object {0}
 missingAccesskey=Missing accesskey.
 missingConfigurationForKey=No value for key {0} found in configuration
+missingCookieFile=Configured http.cookieFile ''{0}'' is missing
 missingCRC=missing CRC for object {0}
 missingDeltaBase=delta base
 missingForwardImageInGITBinaryPatch=Missing forward-image in GIT binary patch
index 88b3fc8505d805f167e1632c8d1b7f3f9b69c8d8..4d0d051562f1c2b05eb9a3318c870ee67c52a169 100644 (file)
@@ -520,6 +520,7 @@ public class JGitText extends TranslationBundle {
        /***/ public String mismatchCRC;
        /***/ public String missingAccesskey;
        /***/ public String missingConfigurationForKey;
+       /***/ public String missingCookieFile;
        /***/ public String missingCRC;
        /***/ public String missingDeltaBase;
        /***/ public String missingForwardImageInGITBinaryPatch;
index 93be5c69e34b44fb5d6a487a163eb4708da946e0..075f55c733bbe409ffacbf3d5816295c353fd3fe 100644 (file)
@@ -344,6 +344,11 @@ public final class NetscapeCookieFile {
                final int maxStaleRetries = 5;
                int retries = 0;
                File file = getPath().toFile();
+               if (!file.exists()) {
+                       LOG.warn(MessageFormat.format(JGitText.get().missingCookieFile,
+                                       file.getAbsolutePath()));
+                       return new byte[0];
+               }
                while (true) {
                        final FileSnapshot oldSnapshot = snapshot;
                        final FileSnapshot newSnapshot = FileSnapshot.save(file);