Skip to content

Commit db1007f

Browse files
committed
check argument of doCtags()
fixes ##4187
1 parent 6ebaff3 commit db1007f

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/AnalyzerGuru.java

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

2020
/*
21-
* Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
2222
* Portions Copyright (c) 2017, 2021, Chris Fraire <[email protected]>.
2323
*/
2424
package org.opengrok.indexer.analysis;
@@ -57,6 +57,7 @@
5757
import org.apache.lucene.document.StringField;
5858
import org.apache.lucene.document.TextField;
5959
import org.apache.lucene.util.BytesRef;
60+
import org.jetbrains.annotations.Nullable;
6061
import org.opengrok.indexer.analysis.FileAnalyzerFactory.Matcher;
6162
import org.opengrok.indexer.analysis.ada.AdaAnalyzerFactory;
6263
import org.opengrok.indexer.analysis.archive.BZip2AnalyzerFactory;
@@ -663,7 +664,7 @@ private static void populateDocumentHistory(Document doc, File file) {
663664
* @throws java.io.IOException If an error occurs while creating the output
664665
*/
665666
public static void writeXref(AnalyzerFactory factory, Reader in,
666-
Writer out, Definitions defs,
667+
Writer out, @Nullable Definitions defs,
667668
Annotation annotation, Project project, File file)
668669
throws IOException {
669670

@@ -704,7 +705,7 @@ public static void writeXref(AnalyzerFactory factory, Reader in,
704705
*/
705706
public static void writeDumpedXref(String contextPath,
706707
AnalyzerFactory factory, Reader in, Writer out,
707-
Definitions defs, Annotation annotation, Project project, File file) throws IOException {
708+
@Nullable Definitions defs, Annotation annotation, Project project, File file) throws IOException {
708709

709710
File xrefTemp = File.createTempFile("ogxref", ".html");
710711
try {

opengrok-web/src/main/webapp/xref.jspf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ org.opengrok.indexer.web.QueryParameters"
6363
if (HistoryGuru.getInstance().getRevision(tempf, resourceFile.getParent(), basename, rev)) {
6464
in = new BufferedInputStream(new FileInputStream(tempf));
6565
} else {
66+
LOGGER.log(Level.WARNING, "failed to retrieve history contents of ''{0}'' in revision {1}",
67+
new Object[]{resourceFile, rev});
6668
tempf.delete();
6769
tempf = null;
6870
}
@@ -96,7 +98,7 @@ org.opengrok.indexer.web.QueryParameters"
9698
Definitions defs = null;
9799
ObjectPool<Ctags> ctagsPool = cfg.getEnv().getIndexerParallelizer().getCtagsPool();
98100
int tries = 2;
99-
while (cfg.getEnv().isWebappCtags()) {
101+
while (cfg.getEnv().isWebappCtags() && tempf != null) {
100102
Ctags ctags = ctagsPool.get();
101103
try {
102104
ctags.setTabSize(project != null ?

0 commit comments

Comments
 (0)