Skip to content

Commit

Permalink
Fix validation of @dot.xml files
Browse files Browse the repository at this point in the history
As per https://www.eclipse.org/jdt/core/compiler_32_006.dtd problem tag
has mandatory id attribute. Set it to the value passed as problemId.
  • Loading branch information
akurtakov authored and laeubi committed Apr 16, 2024
1 parent 0db7b56 commit 14ea4d6
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
Expand Down Expand Up @@ -155,6 +154,7 @@ public void addProblem(String severity, int lineNumber, int charStart, int charE
Element element = new Element("problem");
element.setAttribute("line", Integer.toString(lineNumber));
element.setAttribute("severity", severity);
element.setAttribute("id", Integer.toString(problemId));
element.setAttribute("charStart", Integer.toString(charStart));
element.setAttribute("charEnd", Integer.toString(charEnd));
element.setAttribute("categoryID", Integer.toString(categoryId));
Expand Down Expand Up @@ -183,8 +183,8 @@ public void addProblem(String severity, int lineNumber, int charStart, int charE
}

public boolean hasClass(String classFile) {
return source.getChildren("classfile").stream().map(elem -> elem.getAttributeValue("path")).filter(Objects::nonNull)
.anyMatch(path -> path.endsWith(classFile));
return source.getChildren("classfile").stream().map(elem -> elem.getAttributeValue("path"))
.filter(Objects::nonNull).anyMatch(path -> path.endsWith(classFile));
}

}
Expand Down

0 comments on commit 14ea4d6

Please sign in to comment.