diff --git a/pom.xml b/pom.xml index f8a71c45..4346b545 100644 --- a/pom.xml +++ b/pom.xml @@ -81,7 +81,7 @@ com.hcl appscan.sdk - 1.1.0 + 1.1.2 org.apache.wink diff --git a/src/main/java/com/hcl/appscan/jenkins/plugin/builders/AppScanBuildStep.java b/src/main/java/com/hcl/appscan/jenkins/plugin/builders/AppScanBuildStep.java index 312ef116..2f172f65 100644 --- a/src/main/java/com/hcl/appscan/jenkins/plugin/builders/AppScanBuildStep.java +++ b/src/main/java/com/hcl/appscan/jenkins/plugin/builders/AppScanBuildStep.java @@ -304,37 +304,41 @@ private void shouldFailBuild(IResultsProvider provider,Run build) throws Ab throw new AbortException(Messages.error_checking_results(provider.getStatus())); } } - - private void perform(Run build, Launcher launcher, TaskListener listener) throws InterruptedException, IOException { - m_authProvider = new JenkinsAuthenticationProvider(m_credentials, build.getParent().getParent()); - final IProgress progress = new ScanProgress(listener); - final boolean suspend = m_wait; - Map properties = getScanProperties(build,listener); - String target = properties.get(CoreConstants.TARGET); - final IScan scan = ScanFactory.createScan(properties, progress, m_authProvider); - boolean isAppScan360 = ((JenkinsAuthenticationProvider) m_authProvider).isAppScan360(); + + private void validations(boolean isAppScan360, Map properties, IProgress progress, String target) throws AbortException { if(isAppScan360) { - if (m_type.equals("Dynamic Analyzer") && properties.containsKey(Scanner.PRESENCE_ID)) { + if (m_type.equals(Scanner.DYNAMIC_ANALYZER) && properties.containsKey(Scanner.PRESENCE_ID)) { throw new AbortException(Messages.error_presence_AppScan360()); } if (m_type.equals(CoreConstants.SOFTWARE_COMPOSITION_ANALYZER)) { throw new AbortException(Messages.error_sca_AppScan360()); } if (m_intervention) { progress.setStatus(new Message(Message.WARNING, Messages.warning_allow_intervention_AppScan360())); - } if (properties.get("openSourceOnly") != null) { + } if (properties.get(CoreConstants.OPEN_SOURCE_ONLY) != null) { throw new AbortException(Messages.error_sca_AppScan360()); } } else if (m_authProvider.getacceptInvalidCerts()) { progress.setStatus(new Message(Message.WARNING, Messages.warning_asoc_certificates())); } - if (m_type.equals("Static Analyzer") && properties.containsKey(CoreConstants.OPEN_SOURCE_ONLY)) { + if (m_type.equals(Scanner.STATIC_ANALYZER) && properties.containsKey(CoreConstants.OPEN_SOURCE_ONLY)) { progress.setStatus(new Message(Message.WARNING, Messages.warning_sca())); } - if(m_type.equals("Dynamic Analyzer") && !properties.containsKey(Scanner.PRESENCE_ID) && !ServiceUtil.isValidUrl(target, m_authProvider, m_authProvider.getProxy())) { + if(!isAppScan360 && m_type.equals(Scanner.DYNAMIC_ANALYZER) && !properties.containsKey(Scanner.PRESENCE_ID) && !ServiceUtil.isValidUrl(target, m_authProvider, m_authProvider.getProxy())) { throw new AbortException(Messages.error_url_validation(target)); } + } + + private void perform(Run build, Launcher launcher, TaskListener listener) throws InterruptedException, IOException { + m_authProvider = new JenkinsAuthenticationProvider(m_credentials, build.getParent().getParent()); + final IProgress progress = new ScanProgress(listener); + final boolean suspend = m_wait; + Map properties = getScanProperties(build,listener); + String target = properties.get(CoreConstants.TARGET); + final IScan scan = ScanFactory.createScan(properties, progress, m_authProvider); + boolean isAppScan360 = ((JenkinsAuthenticationProvider) m_authProvider).isAppScan360(); + validations(isAppScan360, properties, progress, target); IResultsProvider provider = launcher.getChannel().call(new Callable() { private static final long serialVersionUID = 1L;