Skip to content

Commit 8a7aa08

Browse files
authored
decrease log level for annotation problems (#4083)
1 parent 3333c27 commit 8a7aa08

File tree

7 files changed

+45
-40
lines changed

7 files changed

+45
-40
lines changed

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

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

2020
/*
21-
* Copyright (c) 2008, 2017, 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

@@ -49,11 +49,14 @@ public class AccuRevAnnotationParser implements Executor.StreamHandler {
4949
*/
5050
private final Annotation annotation;
5151

52+
private final String fileName;
53+
5254
/**
5355
* @param fileName the name of the file being annotated
5456
*/
5557
public AccuRevAnnotationParser(String fileName) {
5658
annotation = new Annotation(fileName);
59+
this.fileName = fileName;
5760
}
5861

5962
/**
@@ -85,14 +88,14 @@ public void processStream(InputStream input) throws IOException {
8588
String author = matcher.group(2);
8689
annotation.addLine(version, author, true);
8790
} else {
88-
LOGGER.log(Level.SEVERE,
89-
"Did not find annotation in line {0}: [{1}]",
90-
new Object[]{lineno, line});
91+
LOGGER.log(Level.WARNING,
92+
"Did not find annotation in line {0} for ''{1}'': [{2}]",
93+
new Object[]{lineno, this.fileName, line});
9194
}
9295
}
9396
} catch (IOException e) {
94-
LOGGER.log(Level.SEVERE,
95-
"Could not read annotations for " + annotation.getFilename(), e);
97+
LOGGER.log(Level.WARNING,
98+
String.format("Could not read annotations for '%s'", this.fileName), e);
9699
}
97100
}
98101
}

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

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

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

@@ -49,14 +49,16 @@ public class BazaarAnnotationParser implements Executor.StreamHandler {
4949
/**
5050
* Pattern used to extract author/revision.
5151
*/
52-
private static final Pattern BLAME_PATTERN
53-
= Pattern.compile("^\\W*(\\S+)\\W+(\\S+).*$");
52+
private static final Pattern BLAME_PATTERN = Pattern.compile("^\\W*(\\S+)\\W+(\\S+).*$");
53+
54+
private final String fileName;
5455

5556
/**
5657
* @param fileName the name of the file being annotated
5758
*/
5859
public BazaarAnnotationParser(String fileName) {
5960
annotation = new Annotation(fileName);
61+
this.fileName = fileName;
6062
}
6163

6264
/**
@@ -82,9 +84,9 @@ public void processStream(InputStream input) throws IOException {
8284
String author = matcher.group(2).trim();
8385
annotation.addLine(rev, author, true);
8486
} else {
85-
LOGGER.log(Level.SEVERE,
86-
"Error: did not find annotation in line {0}: [{1}]",
87-
new Object[]{String.valueOf(lineno), line});
87+
LOGGER.log(Level.WARNING,
88+
"Error: did not find annotation in line {0} for ''{1}'': [{2}]",
89+
new Object[]{String.valueOf(lineno), this.fileName, line});
8890
}
8991
}
9092
}

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

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

2020
/*
21-
* Copyright (c) 2008, 2018, 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

@@ -43,19 +43,21 @@ public class CVSAnnotationParser implements Executor.StreamHandler {
4343
/**
4444
* Pattern used to extract author/revision from {@code cvs annotate}.
4545
*/
46-
private static final Pattern ANNOTATE_PATTERN
47-
= Pattern.compile("([\\.\\d]+)\\W+\\((\\w+)");
46+
private static final Pattern ANNOTATE_PATTERN = Pattern.compile("([\\.\\d]+)\\W+\\((\\w+)");
4847

4948
/**
5049
* Store annotation created by processStream.
5150
*/
5251
private final Annotation annotation;
5352

53+
private final String fileName;
54+
5455
/**
5556
* @param fileName the name of the file being annotated
5657
*/
5758
public CVSAnnotationParser(String fileName) {
5859
annotation = new Annotation(fileName);
60+
this.fileName = fileName;
5961
}
6062

6163
/**
@@ -76,8 +78,7 @@ public void processStream(InputStream input) throws IOException {
7678
Matcher matcher = ANNOTATE_PATTERN.matcher(line);
7779
while ((line = in.readLine()) != null) {
7880
// Skip header
79-
if (!hasStarted && (line.length() == 0
80-
|| !Character.isDigit(line.charAt(0)))) {
81+
if (!hasStarted && (line.length() == 0 || !Character.isDigit(line.charAt(0)))) {
8182
continue;
8283
}
8384
hasStarted = true;
@@ -90,9 +91,9 @@ public void processStream(InputStream input) throws IOException {
9091
String author = matcher.group(2).trim();
9192
annotation.addLine(rev, author, true);
9293
} else {
93-
LOGGER.log(Level.SEVERE,
94-
"Error: did not find annotation in line {0}: [{1}]",
95-
new Object[]{String.valueOf(lineno), line});
94+
LOGGER.log(Level.WARNING,
95+
"Error: did not find annotation in line {0} for ''{1}'': [{2}]",
96+
new Object[]{String.valueOf(lineno), this.fileName, line});
9697
}
9798
}
9899
}

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

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

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

@@ -50,8 +50,7 @@ class MercurialAnnotationParser implements Executor.StreamHandler {
5050
/**
5151
* Pattern used to extract author/revision from {@code hg annotate}.
5252
*/
53-
private static final Pattern ANNOTATION_PATTERN
54-
= Pattern.compile("^\\s*(\\d+):");
53+
private static final Pattern ANNOTATION_PATTERN = Pattern.compile("^\\s*(\\d+):");
5554

5655
MercurialAnnotationParser(File file, HashMap<String, HistoryEntry> revs) {
5756
this.file = file;
@@ -78,9 +77,9 @@ public void processStream(InputStream input) throws IOException {
7877
}
7978
annotation.addLine(rev, Util.getEmail(author.trim()), true);
8079
} else {
81-
LOGGER.log(Level.SEVERE,
82-
"Error: did not find annotation in line {0}: [{1}]",
83-
new Object[]{lineno, line});
80+
LOGGER.log(Level.WARNING,
81+
"Error: did not find annotation in line {0} for ''{1}'': [{2}]",
82+
new Object[]{lineno, this.file, line});
8483
}
8584
}
8685
}

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

Lines changed: 6 additions & 6 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
* Portions Copyright (c) 2020, Chris Fraire <cfraire@me.com>.
2323
*/
2424
package org.opengrok.indexer.history;
@@ -101,14 +101,14 @@ public void processStream(InputStream input) throws IOException {
101101
String author = revAuthor.get(revision);
102102
annotation.addLine(revision, author, true);
103103
} else {
104-
LOGGER.log(Level.SEVERE,
105-
"Error: did not find annotation in line {0}: [{1}]",
106-
new Object[]{lineno, line});
104+
LOGGER.log(Level.WARNING,
105+
"Error: did not find annotation in line {0} for ''{1}'': [{2}]",
106+
new Object[]{lineno, this.file, line});
107107
}
108108
}
109109
} catch (IOException e) {
110-
LOGGER.log(Level.SEVERE,
111-
"Error: Could not read annotations for " + annotation.getFilename(), e);
110+
LOGGER.log(Level.WARNING,
111+
String.format("Error: Could not read annotations for '%s'", this.file), e);
112112
}
113113
}
114114
}

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

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

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

@@ -67,9 +67,9 @@ public void processStream(InputStream input) throws IOException {
6767
String author = matcher.group(2);
6868
annotation.addLine(rev, author, true);
6969
} else {
70-
LOGGER.log(Level.SEVERE,
71-
"Error: did not find annotation in line {0}: [{1}]",
72-
new Object[]{lineno, line});
70+
LOGGER.log(Level.WARNING,
71+
"Error: did not find annotation in line {0} for ''{1}'': [{2}]",
72+
new Object[]{lineno, this.file, line});
7373
}
7474
}
7575
}

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

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

2020
/*
21-
* Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved.
2222
* Portions Copyright (c) 2018, Chris Fraire <cfraire@me.com>.
2323
*/
2424
package org.opengrok.indexer.history;
@@ -333,9 +333,9 @@ protected Annotation parseAnnotation(Reader input, String fileName)
333333
String author = matcher.group(1);
334334
ret.addLine(rev, author, true);
335335
} else if (hasStarted) {
336-
LOGGER.log(Level.SEVERE,
337-
"Error: did not find annotation in line {0}: [{1}]",
338-
new Object[]{String.valueOf(lineno), line});
336+
LOGGER.log(Level.WARNING,
337+
"Error: did not find annotation in line {0} for ''{1}'': [{2}]",
338+
new Object[]{String.valueOf(lineno), fileName, line});
339339
}
340340
}
341341
return ret;

0 commit comments

Comments
 (0)