From b8d861bfd5f7d63be0244e2339378533329ef964 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Fri, 22 Jul 2016 14:05:19 +0900 Subject: [PATCH] Repository: Log negative useCnt message together with stack trace The message "close() called when useCnt is already zero" is logged with level warning, and then if debug logging is enabled, the stack trace is logged separately with level debug. Log the message and the stack trace in the same call, so that they always appear together in the output rather than potentially interleaved with other log statements. Change-Id: I1b5c1557ddc2d19f3f5b29baec96e62bc467d88a Signed-off-by: David Pursehouse --- org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java index 7ec24998b..aba5242b1 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java @@ -880,10 +880,11 @@ 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 - LOG.warn(JGitText.get().corruptUseCnt); if (LOG.isDebugEnabled()) { IllegalStateException e = new IllegalStateException(); - LOG.debug("", e); //$NON-NLS-1$ + LOG.debug(JGitText.get().corruptUseCnt, e); + } else { + LOG.warn(JGitText.get().corruptUseCnt); } if (RepositoryCache.isCached(this)) { closedAt.set(System.currentTimeMillis());