diff --git a/src/main/java/com/rultor/agents/github/Understands.java b/src/main/java/com/rultor/agents/github/Understands.java index 78bf346b98..5d331f06a5 100644 --- a/src/main/java/com/rultor/agents/github/Understands.java +++ b/src/main/java/com/rultor/agents/github/Understands.java @@ -62,6 +62,7 @@ @Immutable @ToString @EqualsAndHashCode(callSuper = false, of = { "github", "question" }) +@SuppressWarnings("PMD.CyclomaticComplexity") public final class Understands extends AbstractAgent { /** @@ -124,6 +125,14 @@ public Iterable process(final XML xml) throws IOException { break; } } + if (next < seen) { + throw new IllegalStateException( + String.format( + "comment #%d is younger than #%d, something is wrong", + next, seen + ) + ); + } final Directives dirs = new Directives(); if (req.equals(Req.EMPTY)) { Logger.info( @@ -141,7 +150,7 @@ public Iterable process(final XML xml) throws IOException { issue.repo().coordinates(), issue.number(), next ); } else { - dirs.xpath("/talk[not(request)]").add("request") + dirs.xpath("/talk[not(request)]").strict(1).add("request") .attr("id", Integer.toString(next)) .append(req.dirs()); }