]> source.dussan.org Git - jgit.git/commitdiff
Repository: Include repository name when logging corrupt use count 60/89660/1
authorDavid Pursehouse <david.pursehouse@gmail.com>
Fri, 27 Jan 2017 02:23:22 +0000 (11:23 +0900)
committerDavid Pursehouse <david.pursehouse@gmail.com>
Fri, 27 Jan 2017 06:59:09 +0000 (15:59 +0900)
Logging the repository name makes it easier to track down what is
incorrectly closing a repository.

Change-Id: I42a8bdf766c0e67f100adbf76d9616584e367ac2
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java

index eb6f3a0aae3d974a8754368544772de2f4ef4719..8bf2155d93f5427139181f8f5a69b86353f7d2ae 100644 (file)
@@ -188,7 +188,7 @@ corruptObjectTruncatedInMode=truncated in mode
 corruptObjectTruncatedInName=truncated in name
 corruptObjectTruncatedInObjectId=truncated in object id
 corruptObjectZeroId=entry points to null SHA-1
-corruptUseCnt=close() called when useCnt is already zero
+corruptUseCnt=close() called when useCnt is already zero for {0}
 couldNotCheckOutBecauseOfConflicts=Could not check out because of conflicts
 couldNotDeleteLockFileShouldNotHappen=Could not delete lock file. Should not happen
 couldNotDeleteTemporaryIndexFileShouldNotHappen=Could not delete temporary index file. Should not happen
index 641262cd50991b7ba2025d34a3de919623d166a4..6be97ffda6f1dd40ea0e4c3593c4993806ffb6dd 100644 (file)
@@ -889,11 +889,12 @@ public abstract class Repository implements AutoCloseable {
                } else if (newCount == -1) {
                        // should not happen, only log when useCnt became negative to
                        // minimize number of log entries
+                       String message = MessageFormat.format(JGitText.get().corruptUseCnt,
+                                       toString());
                        if (LOG.isDebugEnabled()) {
-                               IllegalStateException e = new IllegalStateException();
-                               LOG.debug(JGitText.get().corruptUseCnt, e);
+                               LOG.debug(message, new IllegalStateException());
                        } else {
-                               LOG.warn(JGitText.get().corruptUseCnt);
+                               LOG.warn(message);
                        }
                        if (RepositoryCache.isCached(this)) {
                                closedAt.set(System.currentTimeMillis());