private List resultsFromExceptions()

in main/src/main/java/org/apache/james/jdkim/DKIMVerifier.java [449:472]


    private List<Result> resultsFromExceptions(Map<String, FailException> exceptions) {
        List<Result> results = new ArrayList<>();
        for (Map.Entry<String, FailException> e : exceptions.entrySet()) {
            SignatureRecord rec = e.getValue().getRelatedRecord();
            if (rec == null) {
                rec = new SignatureRecordTemplate("v=1; d=invalid; h=from; s=invalid; b=invalidsig");
            }

            Result.Type resultType = Result.Type.NONE;
            if (e.getValue() instanceof TempFailException) {
                resultType = Result.Type.TEMPERROR;
            } else if (e.getValue() instanceof PermFailException) {
                if (e.getValue().getRelatedRecord() == null) {
                    //FailException without the SignatureRecord
                    resultType = Result.Type.PERMERROR;
                } else {
                    resultType = Result.Type.FAIL;
                }
            }
            results.add(new Result(e.getValue().getMessage(), e.getKey() != null ? e.getKey() : "", rec, resultType));
        }

        return results;
    }