diff --git a/src/main/java/ocl/Validation.java b/src/main/java/ocl/Validation.java index 22ea4f5..93b194e 100644 --- a/src/main/java/ocl/Validation.java +++ b/src/main/java/ocl/Validation.java @@ -183,25 +183,35 @@ private List getErrors(Diagnostic diagnostics, HashMap res = validation.getErrors(validation.evaluate(xmlStream,entry.getName()), rules); - OutputStream zipout = Files.newOutputStream(Paths.get(file.getParentFile().getAbsolutePath() + File.separator +entry.getName().replace("xmi","json") +".zip")); ZipOutputStream zipOutputStream = new ZipOutputStream(zipout); String json = new Gson().toJson(res); @@ -241,7 +250,6 @@ public static void main(String[] args) throws IOException, SAXException, ParserC zipOutputStream.close(); file.delete(); res=null; - xmlStream.close(); } diff --git a/src/main/java/ocl/util/EvaluationResult.java b/src/main/java/ocl/util/EvaluationResult.java index fe9e3b5..7490d0d 100644 --- a/src/main/java/ocl/util/EvaluationResult.java +++ b/src/main/java/ocl/util/EvaluationResult.java @@ -67,22 +67,28 @@ public void setLevel(Integer level) { this.level = level; } + public String getSpecificMessage(){return specificMessage;} + + public void setSpecificMessage(String specificMessage){this.specificMessage=specificMessage;} + private String type; private String id; private String name; private Integer level; + private String specificMessage; - public EvaluationResult(String severity, String rule, Integer level, String type, String id, String name) { + public EvaluationResult(String severity, String rule, Integer level, String type, String id, String name, String specificMessage) { this.severity = severity; this.rule = rule; this.type = type; this.id = id; this.name = name; this.level = level; + this.specificMessage=specificMessage; } public String toString(){ - String s = String.format("%-40s %-5s: %-25s %-37s %-30s", this.rule, this.level, this.type, (id!=null)?id:"", (name!=null)?name:""); + String s = String.format("%-40s %-5s: %-25s %-37s %-30s %-40s", this.rule, this.level, this.type, (id!=null)?id:"", (name!=null)?name:"", (specificMessage!=null)?specificMessage:""); return s; } diff --git a/src/main/java/ocl/util/XLSWriter.java b/src/main/java/ocl/util/XLSWriter.java index 95ad36f..4d4fe83 100644 --- a/src/main/java/ocl/util/XLSWriter.java +++ b/src/main/java/ocl/util/XLSWriter.java @@ -102,11 +102,13 @@ else if (severity.equalsIgnoreCase("WARNING")) String name = res.getName(); cell.setCellValue(name==null?"":name); cell = row.createCell(colNum++); - String message = res.getName(); + if (rules.get(infringedRule)==null) cell.setCellValue(""); - else - cell.setCellValue(rules.get(infringedRule).getMessage()); + else { + String message = res.getSpecificMessage()!=null? rules.get(infringedRule).getMessage() + " " + res.getSpecificMessage():rules.get(infringedRule).getMessage() ; + cell.setCellValue(message); + } } sheet.setAutoFilter(new CellRangeAddress(0, 0, 0, colNum-1));