Browse Source

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 <david.pursehouse@gmail.com>
stable-4.5
David Pursehouse 8 years ago
parent
commit
b8d861bfd5
  1. 5
      org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java

5
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());

Loading…
Cancel
Save