Skip to content

Commit

Permalink
Changed timeout duration variable name back to scanTimeoutDuration so…
Browse files Browse the repository at this point in the history
… the config file would remain the same.

Saving hours again instead of minutes. When reading / saving - multiplying / dividing by 60, so the user would see the timeout in minutes in the UI.
  • Loading branch information
Ilan Shtokhamer authored and Ilan Shtokhamer committed Sep 21, 2016
1 parent 60fba1c commit 95e96f6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main/java/com/checkmarx/jenkins/CxScanBuilder.java
Expand Up @@ -738,7 +738,7 @@ public static final class DescriptorImpl extends BuildStepDescriptor<Builder> {
private JobGlobalStatusOnError jobGlobalStatusOnError;
private JobGlobalStatusOnError jobGlobalStatusOnThresholdViolation = JobGlobalStatusOnError.FAILURE;
private boolean scanTimeOutEnabled;
private int scanTimeoutDurationInMinutes;
private double scanTimeoutDuration; // In Hours.
private boolean lockVulnerabilitySettings = true;

private final transient Pattern msGuid = Pattern.compile("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$");
Expand Down Expand Up @@ -843,16 +843,16 @@ public void setScanTimeOutEnabled(boolean scanTimeOutEnabled) {
}

public int getScanTimeoutDuration() {
if (!timeoutValid(scanTimeoutDurationInMinutes)) {
scanTimeoutDurationInMinutes = 60;
if (!timeoutValid(scanTimeoutDuration)) {
scanTimeoutDuration = 1;
}

return scanTimeoutDurationInMinutes;
return (int)Math.round(scanTimeoutDuration * 60);
}

public void setScanTimeoutDuration(int scanTimeoutDurationInMinutes) {
if (timeoutValid(scanTimeoutDurationInMinutes)) {
this.scanTimeoutDurationInMinutes = scanTimeoutDurationInMinutes;
this.scanTimeoutDuration = scanTimeoutDurationInMinutes / (double)60;
}
}

Expand Down Expand Up @@ -924,7 +924,7 @@ public FormValidation doCheckIncludeOpenSourceFolders(@QueryParameter final bool
}
}

private boolean timeoutValid(int timeInput)
private boolean timeoutValid(double timeInput)
{
return timeInput >= MINIMUM_TIMEOUT_IN_MINUTES;
}
Expand Down

0 comments on commit 95e96f6

Please sign in to comment.