未验证 提交 1f47ad6e 编写于 作者: O Oleg Nenashev 提交者: GitHub

Merge pull request #4408 from StefanSpieker/spotbugs_switch

Fixed Spotbugs Switch related issues and added Suppresses
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
*/ */
package hudson; package hudson;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.model.TaskListener; import hudson.model.TaskListener;
import jenkins.util.MemoryReductionUtil; import jenkins.util.MemoryReductionUtil;
import hudson.util.QuotedStringTokenizer; import hudson.util.QuotedStringTokenizer;
...@@ -692,6 +693,7 @@ public class Util { ...@@ -692,6 +693,7 @@ public class Util {
* number of milliseconds. * number of milliseconds.
*/ */
@Nonnull @Nonnull
@SuppressFBWarnings(value = "ICAST_IDIV_CAST_TO_DOUBLE", justification = "We want to truncate here.")
public static String getTimeSpanString(long duration) { public static String getTimeSpanString(long duration) {
// Break the duration up in to units. // Break the duration up in to units.
long years = duration / ONE_YEAR_MS; long years = duration / ONE_YEAR_MS;
......
...@@ -220,15 +220,15 @@ public class DisablePluginCommand extends CLICommand { ...@@ -220,15 +220,15 @@ public class DisablePluginCommand extends CLICommand {
break; break;
case NO_SUCH_PLUGIN: case NO_SUCH_PLUGIN:
returnCode = RETURN_CODE_NO_SUCH_PLUGIN; returnCode = RETURN_CODE_NO_SUCH_PLUGIN;
} break;
default:
if (returnCode == 0) { for (PluginWrapper.PluginDisableResult oneDependentResult : result.getDependentsDisableStatus()) {
for (PluginWrapper.PluginDisableResult oneDependentResult : result.getDependentsDisableStatus()) { returnCode = getResultCode(oneDependentResult);
returnCode = getResultCode(oneDependentResult); if (returnCode != 0) {
if (returnCode != 0) { break;
break; }
} }
} break;
} }
return returnCode; return returnCode;
......
...@@ -2417,6 +2417,7 @@ public class Queue extends ResourceController implements Saveable { ...@@ -2417,6 +2417,7 @@ public class Queue extends ResourceController implements Saveable {
*/ */
@Restricted(NoExternalUse.class) @Restricted(NoExternalUse.class)
@ExportedBean(defaultVisibility = 999) @ExportedBean(defaultVisibility = 999)
@SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD", justification = "it is exported, so it might be used")
public class StubItem { public class StubItem {
@Exported public StubTask task; @Exported public StubTask task;
......
...@@ -1999,11 +1999,14 @@ public class UpdateCenter extends AbstractModelObject implements Saveable, OnMas ...@@ -1999,11 +1999,14 @@ public class UpdateCenter extends AbstractModelObject implements Saveable, OnMas
return; return;
case FAIL: case FAIL:
throwVerificationFailure(entry.getSha512(), job.getComputedSHA512(), file, "SHA-512"); throwVerificationFailure(entry.getSha512(), job.getComputedSHA512(), file, "SHA-512");
break;
case NOT_COMPUTED: case NOT_COMPUTED:
LOGGER.log(WARNING, "Attempt to verify a downloaded file (" + file.getName() + ") using SHA-512 failed since it could not be computed. Falling back to weaker algorithms. Update your JRE."); LOGGER.log(WARNING, "Attempt to verify a downloaded file (" + file.getName() + ") using SHA-512 failed since it could not be computed. Falling back to weaker algorithms. Update your JRE.");
break; break;
case NOT_PROVIDED: case NOT_PROVIDED:
break; break;
default:
throw new IllegalStateException("Unexpected value: " + result512);
} }
VerificationResult result256 = verifyChecksums(entry.getSha256(), job.getComputedSHA256(), false); VerificationResult result256 = verifyChecksums(entry.getSha256(), job.getComputedSHA256(), false);
...@@ -2012,9 +2015,12 @@ public class UpdateCenter extends AbstractModelObject implements Saveable, OnMas ...@@ -2012,9 +2015,12 @@ public class UpdateCenter extends AbstractModelObject implements Saveable, OnMas
return; return;
case FAIL: case FAIL:
throwVerificationFailure(entry.getSha256(), job.getComputedSHA256(), file, "SHA-256"); throwVerificationFailure(entry.getSha256(), job.getComputedSHA256(), file, "SHA-256");
break;
case NOT_COMPUTED: case NOT_COMPUTED:
case NOT_PROVIDED: case NOT_PROVIDED:
break; break;
default:
throw new IllegalStateException("Unexpected value: " + result256);
} }
if (result512 == VerificationResult.NOT_PROVIDED && result256 == VerificationResult.NOT_PROVIDED) { if (result512 == VerificationResult.NOT_PROVIDED && result256 == VerificationResult.NOT_PROVIDED) {
...@@ -2027,6 +2033,7 @@ public class UpdateCenter extends AbstractModelObject implements Saveable, OnMas ...@@ -2027,6 +2033,7 @@ public class UpdateCenter extends AbstractModelObject implements Saveable, OnMas
return; return;
case FAIL: case FAIL:
throwVerificationFailure(entry.getSha1(), job.getComputedSHA1(), file, "SHA-1"); throwVerificationFailure(entry.getSha1(), job.getComputedSHA1(), file, "SHA-1");
break;
case NOT_COMPUTED: case NOT_COMPUTED:
throw new IOException("Failed to compute SHA-1 of downloaded file, refusing installation"); throw new IOException("Failed to compute SHA-1 of downloaded file, refusing installation");
case NOT_PROVIDED: case NOT_PROVIDED:
......
...@@ -57,7 +57,8 @@ typedef struct _SHELLEXECUTEINFO { ...@@ -57,7 +57,8 @@ typedef struct _SHELLEXECUTEINFO {
* @author Kohsuke Kawaguchi * @author Kohsuke Kawaguchi
* @see <a href="http://msdn.microsoft.com/en-us/library/bb759784(v=VS.85).aspx">MSDN: SHELLEXECUTEINFO</a> * @see <a href="http://msdn.microsoft.com/en-us/library/bb759784(v=VS.85).aspx">MSDN: SHELLEXECUTEINFO</a>
*/ */
@SuppressFBWarnings(value = "UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD", justification = "JNA Data Structure") @SuppressFBWarnings(value = {"UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD", "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD"},
justification = "JNA Data Structure")
public class SHELLEXECUTEINFO extends Structure { public class SHELLEXECUTEINFO extends Structure {
public int cbSize = size(); public int cbSize = size();
public int fMask; public int fMask;
...@@ -87,7 +88,8 @@ public class SHELLEXECUTEINFO extends Structure { ...@@ -87,7 +88,8 @@ public class SHELLEXECUTEINFO extends Structure {
"hProcess"); "hProcess");
} }
@SuppressFBWarnings(value = "UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD", justification = "JNA Data Structure") @SuppressFBWarnings(value = {"UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD", "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD"},
justification = "JNA Data Structure")
public static class DUMMYUNIONNAME_union extends Union { public static class DUMMYUNIONNAME_union extends Union {
public Pointer hIcon; public Pointer hIcon;
public Pointer hMonitor; public Pointer hMonitor;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册