Browse Source

Lower log level to warn for handled pack errors

Pack not found and pack corrupted/invalid are handled by the code (pack
is removed from the list) so logging an error and the stacktrace is
misleading because it implies that there is an action to take to fix the
error.

Lower the log level to warn and remove the stacktrace for those 2 types
of errors and keep the error log statement for any other.

Change-Id: I2400fe5fec07ac6d6c244b852cce615663774e6e
Signed-off-by: Hugo Arès <hugo.ares@ericsson.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
tags/v4.0.0.201505050340-m2
Hugo Arès 9 years ago
parent
commit
d3a73c1407

+ 15
- 6
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java View File

} }


private void handlePackError(IOException e, PackFile p) { private void handlePackError(IOException e, PackFile p) {
String tmpl;
String warnTmpl = null;
if ((e instanceof CorruptObjectException) if ((e instanceof CorruptObjectException)
|| (e instanceof PackInvalidException)) { || (e instanceof PackInvalidException)) {
tmpl = JGitText.get().corruptPack;
warnTmpl = JGitText.get().corruptPack;
// Assume the pack is corrupted, and remove it from the list. // Assume the pack is corrupted, and remove it from the list.
removePack(p); removePack(p);
} else if (e instanceof FileNotFoundException) { } else if (e instanceof FileNotFoundException) {
tmpl = JGitText.get().packWasDeleted;
warnTmpl = JGitText.get().packWasDeleted;
removePack(p); removePack(p);
}
if (warnTmpl != null) {
if (LOG.isDebugEnabled()) {
LOG.debug(MessageFormat.format(warnTmpl,
p.getPackFile().getAbsolutePath()), e);
} else {
LOG.warn(MessageFormat.format(warnTmpl,
p.getPackFile().getAbsolutePath()));
}
} else { } else {
tmpl = JGitText.get().exceptionWhileReadingPack;
// Don't remove the pack from the list, as the error may be // Don't remove the pack from the list, as the error may be
// transient. // transient.
LOG.error(MessageFormat.format(
JGitText.get().exceptionWhileReadingPack, p.getPackFile()
.getAbsolutePath()), e);
} }
LOG.error(MessageFormat.format(tmpl,
p.getPackFile().getAbsolutePath()), e);
} }


@Override @Override

Loading…
Cancel
Save