Package com.denimgroup.threadfix.data

Examples of com.denimgroup.threadfix.data.ScanCheckResultBean


    }
   
    if (valid) {
      return testSAXInput(new SSVLChannelSAXValidator());
    } else {
      return new ScanCheckResultBean(ScanImportStatus.FAILED_XSD);
    }
  }
View Full Code Here


  @Nonnull
    @Override
  public ScanCheckResultBean checkFile() {
        // TODO more validation
    return new ScanCheckResultBean(ScanImportStatus.SUCCESSFUL_SCAN);
   
    //return testSAXInput(new AppScanSourceSAXValidator());
  }
View Full Code Here

            return failure("Failed to determine the scan type.");
        }

        String fileName = scanTypeCalculationService.saveFile(myChannelId, file);

        ScanCheckResultBean returnValue = scanService.checkFile(myChannelId, fileName);

        if (ScanImportStatus.SUCCESSFUL_SCAN == returnValue.getScanCheckResult()) {
            Scan scan = scanMergeService.saveRemoteScanAndRun(myChannelId, fileName);

            if (scan != null) {
                Organization organization = organizationService.loadById(orgId);
                return success(organization);
            } else {
                return failure("Something went wrong while processing the scan.");
            }
        } else {
            return failure(returnValue.getScanCheckResult().toString());
        }
    }
View Full Code Here

    protected ScanCheckResultBean testSAXInput(DefaultHandler handler) {
        log.debug("Starting SAX Test.");

        if (channelTypeDao == null) {
            log.error("Spring configuration didn't have an entry for ChannelTypeDao.");
            return new ScanCheckResultBean(ScanImportStatus.CONFIGURATION_ERROR);
        }

        if (inputStream == null) {
            log.warn(ScanImportStatus.NULL_INPUT_ERROR.toString());
            return new ScanCheckResultBean(ScanImportStatus.NULL_INPUT_ERROR);
        }

        if (doSAXExceptionCheck) {
            if (ScanUtils.isBadXml(inputStream)) {
                log.warn("Bad XML format - ensure correct, uniform encoding.");
                return new ScanCheckResultBean(ScanImportStatus.BADLY_FORMED_XML);
            }
            closeInputStream(inputStream);
            try {
                inputStream = new FileInputStream(inputFileName);
            } catch (FileNotFoundException e) {
                log.error("Cannot find file '" + inputFileName + "'.", e);
            }
        }

        ScanUtils.readSAXInput(handler, FILE_CHECK_COMPLETED, inputStream);
        closeInputStream(inputStream);

        log.info("Scan status: " + testStatus);
        return new ScanCheckResultBean(testStatus, testDate);
    }
View Full Code Here

    public ScanCheckResultBean checkFile() {
      try {
        zipFile = unpackZipStream();

        if (zipFile == null)
          return new ScanCheckResultBean(ScanImportStatus.NULL_INPUT_ERROR);

        InputStream indexHtml = getFileFromZip("index.html");
        if (indexHtml == null)
          return new ScanCheckResultBean(ScanImportStatus.WRONG_FORMAT_ERROR);

        Integer findingCount = getFindingCount(zipFile);
        if (findingCount == null)
          return new ScanCheckResultBean(ScanImportStatus.WRONG_FORMAT_ERROR);
        else if (findingCount < 1)
          return new ScanCheckResultBean(ScanImportStatus.EMPTY_SCAN_ERROR);

        testDate = getTestDate(indexHtml);

        ScanImportStatus scanImportStatus = checkTestDate();

        return new ScanCheckResultBean(scanImportStatus, testDate);

      } finally {
        deleteZipFile();
      }
  }
View Full Code Here

        ScannerType scannerType = bridge.getType(file);

        if (scannerType == null) {
            throw new TypeParsingException();
        } else {
            ScanCheckResultBean resultBean = bridge.testScan(scannerType, file);

            if (resultBean.getScanCheckResult() == ScanImportStatus.SUCCESSFUL_SCAN) {
                return bridge.getScan(scannerType, file);
            } else {
                throw new ScanTestingException(resultBean.getScanCheckResult());
            }
        }
    }
View Full Code Here

            return importer.checkFile();
      } catch (RestIOException e) {
        LOG.warn("Received exception for file " +
            inputFile.getAbsolutePath() +
            ", returning invalid format bean.", e);
        return new ScanCheckResultBean(ScanImportStatus.WRONG_FORMAT_ERROR);
      }
    }
View Full Code Here

TOP

Related Classes of com.denimgroup.threadfix.data.ScanCheckResultBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.