private ViolationDTO createViolationDTO(Violation violation) throws RuleInstantionException, LanguageNotFoundException, RuleTypeNotFoundException { try { RuleTypeDTO rule = createRuleTypeDTO(violation); ViolationTypeDTO violationtype = rule.getViolationTypes()[0]; final String classPathFrom = violation.getClassPathFrom(); final String classPathTo = violation.getClassPathTo(); final String logicalModuleFromPath = violation.getLogicalModules().getLogicalModuleFrom().getLogicalModulePath(); final String logicalModuleToPath = violation.getLogicalModules().getLogicalModuleTo().getLogicalModulePath(); final String message = messagebuilder.createMessage(violation.getMessage()); final int linenumber = violation.getLinenumber(); if (violation.getSeverity() != null) { final Severity severity = violation.getSeverity(); final Color color = severity.getColor(); final String userDefinedName = severity.getUserName(); final String systemDefinedName = severity.getDefaultName(); final int severityValue = configuration.getSeverityValue(violation.getSeverity()); return new ViolationDTO( classPathFrom, classPathTo, logicalModuleFromPath, logicalModuleToPath, violationtype, rule, message, linenumber, color, userDefinedName, systemDefinedName, severityValue); } else { return new ViolationDTO( classPathFrom, classPathTo, logicalModuleFromPath, logicalModuleToPath, violationtype, rule, message, linenumber, Color.BLACK, "", "", 0); } } catch (ViolationTypeNotFoundException e) { throw new ViolationTypeNotFoundException(); } }