diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/AccuRevAnnotationParser.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/AccuRevAnnotationParser.java index 8d07ec494b6..a1557ce4eb1 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/AccuRevAnnotationParser.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/AccuRevAnnotationParser.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. */ package org.opengrok.indexer.history; @@ -49,11 +49,14 @@ public class AccuRevAnnotationParser implements Executor.StreamHandler { */ private final Annotation annotation; + private final String fileName; + /** * @param fileName the name of the file being annotated */ public AccuRevAnnotationParser(String fileName) { annotation = new Annotation(fileName); + this.fileName = fileName; } /** @@ -85,14 +88,14 @@ public void processStream(InputStream input) throws IOException { String author = matcher.group(2); annotation.addLine(version, author, true); } else { - LOGGER.log(Level.SEVERE, - "Did not find annotation in line {0}: [{1}]", - new Object[]{lineno, line}); + LOGGER.log(Level.WARNING, + "Did not find annotation in line {0} for ''{1}'': [{2}]", + new Object[]{lineno, this.fileName, line}); } } } catch (IOException e) { - LOGGER.log(Level.SEVERE, - "Could not read annotations for " + annotation.getFilename(), e); + LOGGER.log(Level.WARNING, + String.format("Could not read annotations for '%s'", this.fileName), e); } } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/BazaarAnnotationParser.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/BazaarAnnotationParser.java index 6d706f15b39..de8760c57b5 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/BazaarAnnotationParser.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/BazaarAnnotationParser.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. */ package org.opengrok.indexer.history; @@ -49,14 +49,16 @@ public class BazaarAnnotationParser implements Executor.StreamHandler { /** * Pattern used to extract author/revision. */ - private static final Pattern BLAME_PATTERN - = Pattern.compile("^\\W*(\\S+)\\W+(\\S+).*$"); + private static final Pattern BLAME_PATTERN = Pattern.compile("^\\W*(\\S+)\\W+(\\S+).*$"); + + private final String fileName; /** * @param fileName the name of the file being annotated */ public BazaarAnnotationParser(String fileName) { annotation = new Annotation(fileName); + this.fileName = fileName; } /** @@ -82,9 +84,9 @@ public void processStream(InputStream input) throws IOException { String author = matcher.group(2).trim(); annotation.addLine(rev, author, true); } else { - LOGGER.log(Level.SEVERE, - "Error: did not find annotation in line {0}: [{1}]", - new Object[]{String.valueOf(lineno), line}); + LOGGER.log(Level.WARNING, + "Error: did not find annotation in line {0} for ''{1}'': [{2}]", + new Object[]{String.valueOf(lineno), this.fileName, line}); } } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/CVSAnnotationParser.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/CVSAnnotationParser.java index 59d6e704ecd..0caa314049d 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/CVSAnnotationParser.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/CVSAnnotationParser.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. */ package org.opengrok.indexer.history; @@ -43,19 +43,21 @@ public class CVSAnnotationParser implements Executor.StreamHandler { /** * Pattern used to extract author/revision from {@code cvs annotate}. */ - private static final Pattern ANNOTATE_PATTERN - = Pattern.compile("([\\.\\d]+)\\W+\\((\\w+)"); + private static final Pattern ANNOTATE_PATTERN = Pattern.compile("([\\.\\d]+)\\W+\\((\\w+)"); /** * Store annotation created by processStream. */ private final Annotation annotation; + private final String fileName; + /** * @param fileName the name of the file being annotated */ public CVSAnnotationParser(String fileName) { annotation = new Annotation(fileName); + this.fileName = fileName; } /** @@ -76,8 +78,7 @@ public void processStream(InputStream input) throws IOException { Matcher matcher = ANNOTATE_PATTERN.matcher(line); while ((line = in.readLine()) != null) { // Skip header - if (!hasStarted && (line.length() == 0 - || !Character.isDigit(line.charAt(0)))) { + if (!hasStarted && (line.length() == 0 || !Character.isDigit(line.charAt(0)))) { continue; } hasStarted = true; @@ -90,9 +91,9 @@ public void processStream(InputStream input) throws IOException { String author = matcher.group(2).trim(); annotation.addLine(rev, author, true); } else { - LOGGER.log(Level.SEVERE, - "Error: did not find annotation in line {0}: [{1}]", - new Object[]{String.valueOf(lineno), line}); + LOGGER.log(Level.WARNING, + "Error: did not find annotation in line {0} for ''{1}'': [{2}]", + new Object[]{String.valueOf(lineno), this.fileName, line}); } } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/MercurialAnnotationParser.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/MercurialAnnotationParser.java index 916ea8e6f37..c884e1ab48b 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/MercurialAnnotationParser.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/MercurialAnnotationParser.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. */ package org.opengrok.indexer.history; @@ -50,8 +50,7 @@ class MercurialAnnotationParser implements Executor.StreamHandler { /** * Pattern used to extract author/revision from {@code hg annotate}. */ - private static final Pattern ANNOTATION_PATTERN - = Pattern.compile("^\\s*(\\d+):"); + private static final Pattern ANNOTATION_PATTERN = Pattern.compile("^\\s*(\\d+):"); MercurialAnnotationParser(File file, HashMap revs) { this.file = file; @@ -78,9 +77,9 @@ public void processStream(InputStream input) throws IOException { } annotation.addLine(rev, Util.getEmail(author.trim()), true); } else { - LOGGER.log(Level.SEVERE, - "Error: did not find annotation in line {0}: [{1}]", - new Object[]{lineno, line}); + LOGGER.log(Level.WARNING, + "Error: did not find annotation in line {0} for ''{1}'': [{2}]", + new Object[]{lineno, this.file, line}); } } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/PerforceAnnotationParser.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/PerforceAnnotationParser.java index bbcf8cb8644..7ef71584d6a 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/PerforceAnnotationParser.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/PerforceAnnotationParser.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. * Portions Copyright (c) 2020, Chris Fraire . */ package org.opengrok.indexer.history; @@ -101,14 +101,14 @@ public void processStream(InputStream input) throws IOException { String author = revAuthor.get(revision); annotation.addLine(revision, author, true); } else { - LOGGER.log(Level.SEVERE, - "Error: did not find annotation in line {0}: [{1}]", - new Object[]{lineno, line}); + LOGGER.log(Level.WARNING, + "Error: did not find annotation in line {0} for ''{1}'': [{2}]", + new Object[]{lineno, this.file, line}); } } } catch (IOException e) { - LOGGER.log(Level.SEVERE, - "Error: Could not read annotations for " + annotation.getFilename(), e); + LOGGER.log(Level.WARNING, + String.format("Error: Could not read annotations for '%s'", this.file), e); } } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/RCSAnnotationParser.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/RCSAnnotationParser.java index 86c14f2160c..fc8b9d0dd9b 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/RCSAnnotationParser.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/RCSAnnotationParser.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. */ package org.opengrok.indexer.history; @@ -67,9 +67,9 @@ public void processStream(InputStream input) throws IOException { String author = matcher.group(2); annotation.addLine(rev, author, true); } else { - LOGGER.log(Level.SEVERE, - "Error: did not find annotation in line {0}: [{1}]", - new Object[]{lineno, line}); + LOGGER.log(Level.WARNING, + "Error: did not find annotation in line {0} for ''{1}'': [{2}]", + new Object[]{lineno, this.file, line}); } } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/SSCMRepository.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/SSCMRepository.java index 6a5d9ca5df7..7ef1692b5d8 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/history/SSCMRepository.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/history/SSCMRepository.java @@ -18,7 +18,7 @@ */ /* - * Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. * Portions Copyright (c) 2018, Chris Fraire . */ package org.opengrok.indexer.history; @@ -333,9 +333,9 @@ protected Annotation parseAnnotation(Reader input, String fileName) String author = matcher.group(1); ret.addLine(rev, author, true); } else if (hasStarted) { - LOGGER.log(Level.SEVERE, - "Error: did not find annotation in line {0}: [{1}]", - new Object[]{String.valueOf(lineno), line}); + LOGGER.log(Level.WARNING, + "Error: did not find annotation in line {0} for ''{1}'': [{2}]", + new Object[]{String.valueOf(lineno), fileName, line}); } } return ret;