未验证 提交 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 @@
*/
package hudson;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.model.TaskListener;
import jenkins.util.MemoryReductionUtil;
import hudson.util.QuotedStringTokenizer;
......@@ -692,6 +693,7 @@ public class Util {
* number of milliseconds.
*/
@Nonnull
@SuppressFBWarnings(value = "ICAST_IDIV_CAST_TO_DOUBLE", justification = "We want to truncate here.")
public static String getTimeSpanString(long duration) {
// Break the duration up in to units.
long years = duration / ONE_YEAR_MS;
......
......@@ -220,15 +220,15 @@ public class DisablePluginCommand extends CLICommand {
break;
case NO_SUCH_PLUGIN:
returnCode = RETURN_CODE_NO_SUCH_PLUGIN;
}
if (returnCode == 0) {
for (PluginWrapper.PluginDisableResult oneDependentResult : result.getDependentsDisableStatus()) {
returnCode = getResultCode(oneDependentResult);
if (returnCode != 0) {
break;
break;
default:
for (PluginWrapper.PluginDisableResult oneDependentResult : result.getDependentsDisableStatus()) {
returnCode = getResultCode(oneDependentResult);
if (returnCode != 0) {
break;
}
}
}
break;
}
return returnCode;
......
......@@ -2417,6 +2417,7 @@ public class Queue extends ResourceController implements Saveable {
*/
@Restricted(NoExternalUse.class)
@ExportedBean(defaultVisibility = 999)
@SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD", justification = "it is exported, so it might be used")
public class StubItem {
@Exported public StubTask task;
......
......@@ -1999,11 +1999,14 @@ public class UpdateCenter extends AbstractModelObject implements Saveable, OnMas
return;
case FAIL:
throwVerificationFailure(entry.getSha512(), job.getComputedSHA512(), file, "SHA-512");
break;
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.");
break;
case NOT_PROVIDED:
break;
default:
throw new IllegalStateException("Unexpected value: " + result512);
}
VerificationResult result256 = verifyChecksums(entry.getSha256(), job.getComputedSHA256(), false);
......@@ -2012,9 +2015,12 @@ public class UpdateCenter extends AbstractModelObject implements Saveable, OnMas
return;
case FAIL:
throwVerificationFailure(entry.getSha256(), job.getComputedSHA256(), file, "SHA-256");
break;
case NOT_COMPUTED:
case NOT_PROVIDED:
break;
default:
throw new IllegalStateException("Unexpected value: " + result256);
}
if (result512 == VerificationResult.NOT_PROVIDED && result256 == VerificationResult.NOT_PROVIDED) {
......@@ -2027,6 +2033,7 @@ public class UpdateCenter extends AbstractModelObject implements Saveable, OnMas
return;
case FAIL:
throwVerificationFailure(entry.getSha1(), job.getComputedSHA1(), file, "SHA-1");
break;
case NOT_COMPUTED:
throw new IOException("Failed to compute SHA-1 of downloaded file, refusing installation");
case NOT_PROVIDED:
......
......@@ -57,7 +57,8 @@ typedef struct _SHELLEXECUTEINFO {
* @author Kohsuke Kawaguchi
* @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 int cbSize = size();
public int fMask;
......@@ -87,7 +88,8 @@ public class SHELLEXECUTEINFO extends Structure {
"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 Pointer hIcon;
public Pointer hMonitor;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册