Fix OBL_UNSATISFIED_OBLIGATION SpotBugs violations

This commit is contained in:
Basil Crow committed 2021-12-06 14:00:50 -08:00
1 parent 6c45a12cd7
commit f7bc2b5da6
3 files changed
+11 -13

No files matched your search

@@ -65,12 +65,16 @@ public class AdminWhitelistRule implements StaplerProxy {
// overwrite 30-default.conf with what we think is the best from the core.
// this file shouldn't be touched by anyone. For local customization, use other files in the conf dir.
// 0-byte file is used as a signal from the admin to prevent this overwriting
placeDefaultRule(
new File(jenkins.getRootDir(), "secrets/whitelisted-callables.d/default.conf"),
getClass().getResourceAsStream("callable.conf"));
placeDefaultRule(
new File(jenkins.getRootDir(), "secrets/filepath-filters.d/30-default.conf"),
transformForWindows(getClass().getResourceAsStream("filepath-filter.conf")));
try (InputStream callable = getClass().getResourceAsStream("callable.conf")) {
placeDefaultRule(
new File(jenkins.getRootDir(), "secrets/whitelisted-callables.d/default.conf"),
callable);
}
try (InputStream filepathFilter = getClass().getResourceAsStream("filepath-filter.conf")) {
placeDefaultRule(
new File(jenkins.getRootDir(), "secrets/filepath-filters.d/30-default.conf"),
transformForWindows(filepathFilter));
}
this.whitelisted = new CallableWhitelistConfig(
new File(jenkins.getRootDir(),"secrets/whitelisted-callables.d/gui.conf"));
@@ -66,6 +66,7 @@ public class StandardOutputSwapper extends ComputerListener {
}
}
@SuppressFBWarnings(value = "OBL_UNSATISFIED_OBLIGATION", justification = "the obligation is satisfied with libc(7)")
private void swap(StandardOutputStream stdout) throws IOException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException, UnsatisfiedLinkError {
// duplicate the OS file descriptor and create FileOutputStream around it
int out = GNUCLibrary.LIBC.dup(1);