Skip to content

Commit 4b34795

Browse files
committed
match the exact number of dashes
1 parent 059d25e commit 4b34795

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/history/CVSHistoryParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public void processStream(InputStream input) throws IOException {
138138
s = in.readLine();
139139
}
140140
if (state == ParseState.COMMENT) {
141-
if (s.startsWith("--------")) {
141+
if (s.equals("----------------------------")) {
142142
state = ParseState.REVISION;
143143
} else if (s.startsWith("========")) {
144144
state = ParseState.NAMES;

opengrok-indexer/src/test/java/org/opengrok/indexer/history/CVSHistoryParserTest.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
2222
*/
2323
package org.opengrok.indexer.history;
2424

@@ -36,7 +36,7 @@
3636
*
3737
* @author austvik
3838
*/
39-
public class CVSHistoryParserTest {
39+
class CVSHistoryParserTest {
4040

4141
CVSHistoryParser instance;
4242

@@ -55,19 +55,17 @@ public void tearDown() {
5555
* @throws Exception exception
5656
*/
5757
@Test
58-
public void parseEmpty() throws Exception {
58+
void parseEmpty() throws Exception {
5959
History result = instance.parse("");
6060
assertNotNull(result);
6161
assertEquals(0, result.getHistoryEntries().size(), "Should not contain any history entries");
6262
}
6363

6464
/**
6565
* Parse something that could come out from the W3C public CVS repository.
66-
*
67-
* @throws java.lang.Exception
6866
*/
6967
@Test
70-
public void parseALaW3C() throws Exception {
68+
void parseALaW3C() throws Exception {
7169
String revId1 = "1.2";
7270
String revId2 = "1.2.4.5";
7371
String revId3 = "1.134";
@@ -104,7 +102,8 @@ public void parseALaW3C() throws Exception {
104102
"date: " + date1 + "; author: " + author1 +
105103
"; state: Exp; lines: +6 -2;\n" +
106104
"some comment that is\n" +
107-
"spanning two lines\n" +
105+
"--------\n" +
106+
"spanning multiple lines\n" +
108107
"==========================================================" +
109108
"===================\n";
110109
History result = instance.parse(output);
@@ -123,7 +122,7 @@ public void parseALaW3C() throws Exception {
123122
assertEquals(author1, e2.getAuthor());
124123
assertEquals(0, e2.getFiles().size());
125124
assertTrue(e2.getMessage().contains("some"), "Should contain comment of both lines: line 1");
126-
assertTrue(e2.getMessage().contains("two"), "Should contain comment of both lines: line 2");
125+
assertTrue(e2.getMessage().contains("multiple"), "Should contain comment of both lines: line 2");
127126

128127
assertEquals(Map.of(revId2, tag1), result.getTags());
129128
}

0 commit comments

Comments
 (0)