Skip to content
Permalink
Browse files
[JENKINS-33068] Address nits
  • Loading branch information
stephenc committed Feb 22, 2016
1 parent 20926f4 commit 5f349a61c3f2d1610b75c3469d72e78c5683474c
Showing with 24 additions and 24 deletions.
  1. +12 −12 core/src/main/java/hudson/model/AsyncAperiodicWork.java
  2. +12 −12 core/src/main/java/hudson/model/AsyncPeriodicWork.java
@@ -151,23 +151,23 @@ protected StreamTaskListener createListener() {
if ((lastRotateMillis + logRotateMillis < System.currentTimeMillis())
|| (logRotateSize > 0 && f.length() > logRotateSize)) {
lastRotateMillis = System.currentTimeMillis();
File p = null;
File prev = null;
for (int i = 5; i >= 0; i--) {
File o = i == 0 ? f : new File(f.getParentFile(), f.getName() + "." + i);
if (o.isFile()) {
if (p != null && !p.exists()) {
if (!o.renameTo(p)) {
File curr = i == 0 ? f : new File(f.getParentFile(), f.getName() + "." + i);
if (curr.isFile()) {
if (prev != null && !prev.exists()) {
if (!curr.renameTo(prev)) {
logger.log(getErrorLoggingLevel(), "Could not rotate log files {0} to {1}",
new Object[]{o, p});
new Object[]{curr, prev});
}
} else {
if (!o.delete()) {
if (!curr.delete()) {
logger.log(getErrorLoggingLevel(), "Could not delete log file {0} to enable rotation",
o);
curr);
}
}
}
p = o;
prev = curr;
}
}
} else {
@@ -179,10 +179,10 @@ protected StreamTaskListener createListener() {
if (!newFile.isFile()) {
// if there has never been rotation then this is the first time
if (oldFile.renameTo(newFile)) {
logger.log(getNormalLoggingLevel(), "Moved {0} to {1}.1", new Object[]{oldFile, f});
logger.log(getNormalLoggingLevel(), "Moved {0} to {1}", new Object[]{oldFile, newFile});
} else {
logger.log(getErrorLoggingLevel(), "Could not move {0} to {1}.1",
new Object[]{oldFile, f});
logger.log(getErrorLoggingLevel(), "Could not move {0} to {1}",
new Object[]{oldFile, newFile});
}
}
}
@@ -134,23 +134,23 @@ protected StreamTaskListener createListener() {
if ((lastRotateMillis + logRotateMillis < System.currentTimeMillis())
|| (logRotateSize > 0 && f.length() > logRotateSize)) {
lastRotateMillis = System.currentTimeMillis();
File p = null;
File prev = null;
for (int i = 5; i >= 0; i--) {
File o = i == 0 ? f : new File(f.getParentFile(), f.getName() + "." + i);
if (o.isFile()) {
if (p != null && !p.exists()) {
if (!o.renameTo(p)) {
File curr = i == 0 ? f : new File(f.getParentFile(), f.getName() + "." + i);
if (curr.isFile()) {
if (prev != null && !prev.exists()) {
if (!curr.renameTo(prev)) {
logger.log(getErrorLoggingLevel(), "Could not rotate log files {0} to {1}",
new Object[]{o, p});
new Object[]{curr, prev});
}
} else {
if (!o.delete()) {
if (!curr.delete()) {
logger.log(getErrorLoggingLevel(), "Could not delete log file {0} to enable rotation",
o);
curr);
}
}
}
p = o;
prev = curr;
}
}
} else {
@@ -162,10 +162,10 @@ protected StreamTaskListener createListener() {
if (!newFile.isFile()) {
// if there has never been rotation then this is the first time
if (oldFile.renameTo(newFile)) {
logger.log(getNormalLoggingLevel(), "Moved {0} to {1}.1", new Object[]{oldFile, f});
logger.log(getNormalLoggingLevel(), "Moved {0} to {1}", new Object[]{oldFile, newFile});
} else {
logger.log(getErrorLoggingLevel(), "Could not move {0} to {1}.1",
new Object[]{oldFile, f});
logger.log(getErrorLoggingLevel(), "Could not move {0} to {1}",
new Object[]{oldFile, newFile});
}
}
}

0 comments on commit 5f349a6

Please sign in to comment.