コード例 #1
0
  private void findNewFindings(
      org.jcoderz.phoenix.report.jaxb.File newFile, org.jcoderz.phoenix.report.jaxb.File oldFile) {
    final List<Item> newFindings = new ArrayList<Item>((List<Item>) newFile.getItem());
    final List<Item> oldFindings = new ArrayList<Item>((List<Item>) oldFile.getItem());

    filterLowSeverity(newFindings);
    filterLowSeverity(oldFindings);
    filterFullMatches(newFindings, oldFindings);
    filterPartialMatches(newFindings, oldFindings);

    // the rest...
    flaggAllAsNew(newFindings);
    for (Item item : oldFindings) {
      addAsOld(newFile.getItem(), item);
    }
  }
コード例 #2
0
  /**
   * Searches for new findings based on the old jcReport and increases the severity of such findings
   * to NEW.
   */
  public void flagNewFindings() {
    logger.log(Level.FINE, "Searching for NEW findings...");
    try {
      final JAXBContext ctx = JAXBContext.newInstance(new Class[] {Report.class});

      final Report currentReport = (Report) ctx.createUnmarshaller().unmarshal(mOutFile);
      final Report oldReport = (Report) ctx.createUnmarshaller().unmarshal(mOldReport);
      for (org.jcoderz.phoenix.report.jaxb.File newFile :
          (List<org.jcoderz.phoenix.report.jaxb.File>) currentReport.getFile()) {
        final org.jcoderz.phoenix.report.jaxb.File oldFile = findFile(newFile, oldReport);
        if (oldFile != null) {
          findNewFindings(newFile, oldFile);
        } else {
          flaggAllAsNew(newFile.getItem());
        }
      }

      writeResult(currentReport, mOutFile);
    } catch (Exception ex) {
      logger.log(Level.WARNING, "Failed to flagNewFindings. Cause " + ex.getMessage(), ex);
    }
  }