Clean up a few plain e.printStackTrace() calls (#9742)

Co-authored-by: Jesse Glick <jglick@cloudbees.com>
This commit is contained in:
Vincent LatombeandJesse Glick authored and GitHub committed 2024-09-19 09:47:42 +01:00
1 parent 82dfb0948c
commit f9fef613ce
4 files changed
+16 -7

No files matched your search

@@ -226,7 +226,7 @@ public class WindowsInstallerLink extends ManagementLink {
new File(installationDir, "jenkins.exe"), "start", task, installationDir);
task.getLogger().println(r == 0 ? "Successfully started" : "start service failed. Exit code=" + r);
} catch (IOException | InterruptedException e) {
e.printStackTrace();
LOGGER.log(Level.WARNING, null, e);
}
}
@@ -241,7 +241,7 @@ public class WindowsInstallerLink extends ManagementLink {
Jenkins.get().cleanUp();
System.exit(0);
} catch (InterruptedException e) {
e.printStackTrace();
LOGGER.log(Level.SEVERE, null, e);
}
}
}.start();
@@ -434,7 +434,7 @@ public abstract class AbstractItem extends Actionable implements Loadable, Item,
Util.deleteRecursive(oldRoot);
} catch (IOException e) {
// but ignore the error, since we expect that
e.printStackTrace();
LOGGER.log(Level.WARNING, "Ignoring IOException while deleting", e);
}
}
+12 -3
View File
@@ -236,14 +236,23 @@ public abstract class ViewJob<JobT extends ViewJob<JobT, RunT>, RunT extends Run
@Override
public void run() {
while (!terminating()) {
String jobName = null;
try {
getNext()._reload();
var next = getNext();
jobName = next.getFullName();
next._reload();
jobName = null;
} catch (InterruptedException e) {
// treat this as a death signal
return;
} catch (Throwable t) {
} catch (Exception e) {
// otherwise ignore any error
t.printStackTrace();
if (jobName != null) {
var finalJobName = jobName;
LOGGER.log(Level.WARNING, e, () -> "Failed to reload job " + finalJobName);
} else {
LOGGER.log(Level.WARNING, e, () -> "Failed to obtain next job in the reload queue");
}
}
}
}
@@ -5631,7 +5631,7 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
if (is != null)
props.load(is);
} catch (IOException e) {
e.printStackTrace(); // if the version properties is missing, that's OK.
LOGGER.log(Level.WARNING, e, () -> "Failed to load jenkins-version.properties");
}
String ver = props.getProperty("version");
if (ver == null) ver = UNCOMPUTED_VERSION;