Skip to content

Commit 2066188

Browse files
author
Vladimir Kotal
committed
always create xref writer
fixes #858
1 parent cbbb3bf commit 2066188

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexDatabase.java

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ private void addFile(File file, String path, Ctags ctags)
725725
fa.setFoldingEnabled(env.isFoldingEnabled());
726726

727727
Document doc = new Document();
728-
try (Writer xrefOut = newXrefWriter(fa, path)) {
728+
try (Writer xrefOut = newXrefWriter(path)) {
729729
analyzerGuru.populateDocument(doc, file, path, fa, xrefOut);
730730
} catch (InterruptedException e) {
731731
LOGGER.log(Level.WARNING, "File ''{0}'' interrupted--{1}",
@@ -1629,19 +1629,13 @@ public int hashCode() {
16291629
return hash;
16301630
}
16311631

1632-
private boolean isXrefWriter(AbstractAnalyzer fa) {
1633-
AbstractAnalyzer.Genre g = fa.getFactory().getGenre();
1634-
return (g == AbstractAnalyzer.Genre.PLAIN || g == AbstractAnalyzer.Genre.XREFABLE);
1635-
}
1636-
16371632
/**
16381633
* Get a writer to which the xref can be written, or null if no xref
16391634
* should be produced for files of this type.
16401635
*/
1641-
private Writer newXrefWriter(AbstractAnalyzer fa, String path)
1642-
throws IOException {
1636+
private Writer newXrefWriter(String path) throws IOException {
16431637
RuntimeEnvironment env = RuntimeEnvironment.getInstance();
1644-
if (env.isGenerateHtml() && isXrefWriter(fa)) {
1638+
if (env.isGenerateHtml()) {
16451639
boolean compressed = env.isCompressXref();
16461640
File xrefFile = whatXrefFile(path, compressed);
16471641
File parentFile = xrefFile.getParentFile();
@@ -1721,7 +1715,7 @@ private boolean checkSettings(File file,
17211715
String path) throws IOException {
17221716

17231717
RuntimeEnvironment env = RuntimeEnvironment.getInstance();
1724-
boolean outIsXrefWriter = false;
1718+
boolean outIsXrefWriter = false; // potential xref writer
17251719
int reqTabSize = project != null && project.hasTabSizeSetting() ?
17261720
project.getTabSize() : 0;
17271721
Integer actTabSize = settings.getTabSize();
@@ -1799,7 +1793,7 @@ private boolean checkSettings(File file,
17991793
}
18001794

18011795
if (fa != null) {
1802-
outIsXrefWriter = isXrefWriter(fa);
1796+
outIsXrefWriter = true;
18031797
}
18041798

18051799
// The versions checks have passed.

0 commit comments

Comments
 (0)