Skip to content

Commit

Permalink
remove duplicate error whaen Osa is not licensed
Browse files Browse the repository at this point in the history
  • Loading branch information
nusiGal committed Dec 6, 2016
1 parent e684d61 commit b51b088
Showing 1 changed file with 4 additions and 24 deletions.
28 changes: 4 additions & 24 deletions src/main/java/com/checkmarx/jenkins/CxScanBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -1212,12 +1212,12 @@ public String getCurrentTime() {
* Note: This method is called concurrently by multiple threads, refrain from using mutable
* shared state to avoid synchronization issues.
*/
public FormValidation doCheckIncludeOpenSourceFolders(@QueryParameter final boolean useOwnServerCredentials, @QueryParameter final String serverUrl, @QueryParameter final String password,
@QueryParameter final String username, @QueryParameter final String includeOpenSourceFolders, @QueryParameter final String timestamp) {
public FormValidation doCheckOsaEnabled(@QueryParameter final boolean useOwnServerCredentials, @QueryParameter final String serverUrl, @QueryParameter final String password,
@QueryParameter final String username, @QueryParameter final boolean osaEnabled, @QueryParameter final String timestamp) {
// timestamp is not used in code, it is one of the arguments to invalidate Internet Explorer cache
CxWebService cxWebService = null;

if (!osaConfigured(includeOpenSourceFolders)) {
if (!osaEnabled) {
return FormValidation.ok();
}

Expand All @@ -1240,6 +1240,7 @@ public FormValidation doCheckIncludeOpenSourceFolders(@QueryParameter final bool
}
}


private boolean timeoutValid(double timeInput) {
return timeInput >= MINIMUM_TIMEOUT_IN_MINUTES;
}
Expand Down Expand Up @@ -1321,27 +1322,6 @@ public ComboBoxModel doFillProjectNameItems(@QueryParameter final boolean useOwn
}
}

public FormValidation doCheckOsaEnabled(@QueryParameter boolean useOwnServerCredentials,
@QueryParameter String serverUrl,
@QueryParameter String username,
@QueryParameter String password) {
boolean hasOSALicense = true;
try {

final CxWebService cxWebService = prepareLoggedInWebservice(useOwnServerCredentials, serverUrl, username, getPasswordPlainText(password));
hasOSALicense = cxWebService.isOsaLicenseValid();

} catch (Exception e) {
logger.debug("fail to check OSA license", e);
}

if(!hasOSALicense) {
return FormValidation.error("Open Source Analysis license is not enabled for this project. Please contact your CxSAST Administrator");
}

return FormValidation.ok();
}

/*
* Note: This method is called concurrently by multiple threads, refrain from using mutable
* shared state to avoid synchronization issues.
Expand Down

0 comments on commit b51b088

Please sign in to comment.