@Override protected void process(DBKey dbKey, HttpServletRequest req, HttpServletResponse resp) throws IOException { String id = req.getParameter(Helper.ID_PARAM); resp.setCharacterEncoding("UTF-8"); Artifact artifact = artifactsDAO.getArtifact(dbKey, id); artifactsDAO.getArtifact(dbKey, id); if (artifact != null) { sendArtifact(req, resp, artifact); } else { sendErrorMessage(dbKey, resp, id); } }
} else { try (InputStream collectedArtifact = artifactsDAO .getArtifact(properties, properties.getCollectedId()).getArtifactStream(); InputStream patternArtifact = artifactsDAO .getArtifact(properties, properties.getPatternId()).getArtifactStream()) {
@Override public ComparatorStepResult compare() throws ProcessingException { ComparatorStepResult comparatorStepResult; InputStream sourceStream = null; try { LOGGER.info("Checking w3c for artifact {} in {} {} using validator: {}.", properties.getCompany(), properties.getProject(), properties.getPatternId(), properties); sourceStream = artifactsDAO.getArtifact(properties, properties.getCollectedId()) .getArtifactStream(); String json = wrapper.validate(sourceStream); W3cHtml5ComparatorResult w3cComparatorResult = validationResultParser.parse(json); comparatorStepResult = getComparatorStepResult(w3cComparatorResult); } catch (Exception e) { throw new ProcessingException(e.getMessage(), e); } finally { IOUtils.closeQuietly(sourceStream); } return comparatorStepResult; }
@Override public ComparatorStepResult compare() throws ProcessingException { ComparatorStepResult comparatorStepResult; InputStream sourceStream = null; try { LOGGER.info("Checking w3c for artifact {} in {} {} using validator: {}.", properties.getCompany(), properties.getProject(), properties.getPatternId(), properties); sourceStream = artifactsDAO.getArtifact(properties, properties.getCollectedId()) .getArtifactStream(); String json = wrapper.validate(sourceStream); W3cHtml5ComparatorResult w3cComparatorResult = validationResultParser.parse(json); comparatorStepResult = getComparatorStepResult(w3cComparatorResult); } catch (Exception e) { throw new ProcessingException(e.getMessage(), e); } finally { IOUtils.closeQuietly(sourceStream); } return comparatorStepResult; }
} else { try (InputStream collectedArtifact = artifactsDAO .getArtifact(properties, properties.getCollectedId()).getArtifactStream(); InputStream patternArtifact = artifactsDAO .getArtifact(properties, properties.getPatternId()).getArtifactStream()) {