Skip to content

Commit 6158753

Browse files
committed
take care of comments when parsing pom
1 parent da2c222 commit 6158753

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

src/test/java/org/htmlunit/ExternalTest.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,27 @@ public void pom() throws Exception {
8686
final List<String> lines = FileUtils.readLines(new File("pom.xml"), ISO_8859_1);
8787

8888
final List<String> wrongVersions = new LinkedList<>();
89+
boolean inComment = false;
8990
for (int i = 0; i < lines.size(); i++) {
90-
final String line = lines.get(i);
91+
String line = lines.get(i);
92+
93+
String cleaned = "";
94+
if (!inComment) {
95+
final int startIdx = line.indexOf("<!--");
96+
if (startIdx != -1) {
97+
cleaned += line.substring(0, startIdx);
98+
inComment = true;
99+
}
100+
}
101+
if (inComment) {
102+
final int endIdx = line.indexOf("-->");
103+
if (endIdx != -1) {
104+
cleaned += line.substring(endIdx + 3, line.length());
105+
inComment = false;
106+
}
107+
line = cleaned;
108+
}
109+
91110
if (line.trim().equals("<properties>")) {
92111
processProperties(lines, i + 1, properties);
93112
}

0 commit comments

Comments
 (0)