Skip to content

Commit

Permalink
Fix processing of line immediately after # in properties file
Browse files Browse the repository at this point in the history
Fixes gh-24158
  • Loading branch information
mbhave committed Nov 18, 2020
1 parent c86ce27 commit e342d7d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
Expand Up @@ -168,8 +168,10 @@ boolean isNewDocument(CharacterReader reader) throws IOException {
result = result && readAndExpect(reader, reader::isHyphenCharacter);
result = result && readAndExpect(reader, reader::isHyphenCharacter);
result = result && readAndExpect(reader, reader::isHyphenCharacter);
reader.read();
reader.skipWhitespace();
if (!reader.isEndOfLine()) {
reader.read();
reader.skipWhitespace();
}
return result && reader.isEndOfLine();
}

Expand Down
Expand Up @@ -293,6 +293,12 @@ void existingCommentsAreNotTreatedAsMultiDoc() throws Exception {
assertThat(this.documents.size()).isEqualTo(1);
}

@Test
void getPropertyAfterPoundCharacter() {
OriginTrackedValue value = getFromFirst("test-line-after-empty-pound");
assertThat(getValue(value)).isEqualTo("abc");
}

private OriginTrackedValue getFromFirst(String key) {
return this.documents.get(0).asMap().get(key);
}
Expand Down
Expand Up @@ -43,3 +43,6 @@ test-iso8859-1-chars=

test-with-trailing-space= trailing
test-with-escaped-trailing-space= trailing\

#
test-line-after-empty-pound=abc

0 comments on commit e342d7d

Please sign in to comment.