@@ -1075,8 +1075,6 @@ private void indexDown(File dir, String parent, IndexDownArgs args)
1075
1075
}
1076
1076
Arrays .sort (files , FILENAME_COMPARATOR );
1077
1077
1078
- final boolean [] outIsXrefWriter = new boolean [1 ];
1079
-
1080
1078
for (File file : files ) {
1081
1079
String path = parent + File .separator + file .getName ();
1082
1080
if (!accept (dir , file , outLocalRelPath )) {
@@ -1122,15 +1120,11 @@ private void indexDown(File dir, String parent, IndexDownArgs args)
1122
1120
}
1123
1121
}
1124
1122
1125
- /**
1126
- * If the file was not modified, probably skip to the
1127
- * next one.
1128
- */
1129
- if (uidIter != null && uidIter .term () != null
1130
- && uidIter .term ().bytesEquals (buid )) {
1131
- boolean chkres = chkSettings (outIsXrefWriter , file ,
1132
- path ) && (!outIsXrefWriter [0 ] ||
1133
- checkXrefExistence (path ));
1123
+ // If the file was not modified, probably skip to the next one.
1124
+ if (uidIter != null && uidIter .term () != null &&
1125
+ uidIter .term ().bytesEquals (buid )) {
1126
+
1127
+ boolean chkres = checkSettings (file , path );
1134
1128
if (!chkres ) {
1135
1129
removeFile (false );
1136
1130
}
@@ -1666,16 +1660,15 @@ private void finishWriting() throws IOException {
1666
1660
/**
1667
1661
* Verify TABSIZE, and evaluate AnalyzerGuru version together with ZVER --
1668
1662
* or return a value to indicate mismatch.
1669
- * @param outIsXrefWriter boolean array. After return its first member will
1670
- * contain return value of {@code isXrefWriter()}
1671
- * for the file analyzer matching given file
1672
1663
* @param file the source file object
1673
1664
* @param path the source file path
1674
1665
* @return {@code false} if a mismatch is detected
1675
1666
*/
1676
- private boolean chkSettings ( boolean [] outIsXrefWriter , File file ,
1677
- String path ) throws IOException {
1667
+ private boolean checkSettings ( File file ,
1668
+ String path ) throws IOException {
1678
1669
1670
+ RuntimeEnvironment env = RuntimeEnvironment .getInstance ();
1671
+ boolean outIsXrefWriter = false ;
1679
1672
int reqTabSize = project != null && project .hasTabSizeSetting () ?
1680
1673
project .getTabSize () : 0 ;
1681
1674
Integer actTabSize = settings .getTabSize ();
@@ -1697,7 +1690,7 @@ private boolean chkSettings(boolean[] outIsXrefWriter, File file,
1697
1690
1698
1691
long reqGuruVersion = AnalyzerGuru .getVersionNo ();
1699
1692
Long actGuruVersion = settings .getAnalyzerGuruVersion ();
1700
- /**
1693
+ /*
1701
1694
* For an older OpenGrok index that does not yet have a defined,
1702
1695
* stored analyzerGuruVersion, break so that no extra work is done.
1703
1696
* After a re-index, the guru version check will be active.
@@ -1722,7 +1715,7 @@ private boolean chkSettings(boolean[] outIsXrefWriter, File file,
1722
1715
fa = fac .getAnalyzer ();
1723
1716
}
1724
1717
} else {
1725
- /**
1718
+ /*
1726
1719
* If the stored guru version does not match, re-verify the
1727
1720
* selection of analyzer or return a value to indicate the
1728
1721
* analyzer is now mis-matched.
@@ -1753,7 +1746,7 @@ private boolean chkSettings(boolean[] outIsXrefWriter, File file,
1753
1746
}
1754
1747
1755
1748
if (fa != null ) {
1756
- outIsXrefWriter [ 0 ] = isXrefWriter (fa );
1749
+ outIsXrefWriter = isXrefWriter (fa );
1757
1750
}
1758
1751
1759
1752
// The versions checks have passed.
@@ -1764,8 +1757,16 @@ private boolean chkSettings(boolean[] outIsXrefWriter, File file,
1764
1757
return false ;
1765
1758
}
1766
1759
1767
- // Assume "true" if otherwise no discrepancies were observed.
1768
- return true ;
1760
+ // If the economy mode is on, this should be treated as a match.
1761
+ if (!env .isGenerateHtml ()) {
1762
+ if (xrefExistsFor (path )) {
1763
+ LOGGER .log (Level .FINEST , "Extraneous {0} , removing its xref file" , path );
1764
+ removeXrefFile (path );
1765
+ }
1766
+ return true ;
1767
+ }
1768
+
1769
+ return (!outIsXrefWriter || xrefExistsFor (path ));
1769
1770
}
1770
1771
1771
1772
private void writeAnalysisSettings () throws IOException {
@@ -1785,22 +1786,14 @@ private IndexAnalysisSettings2 readAnalysisSettings() throws IOException {
1785
1786
return dao .read (reader );
1786
1787
}
1787
1788
1788
- private boolean checkXrefExistence (String path ) {
1789
+ private boolean xrefExistsFor (String path ) {
1789
1790
RuntimeEnvironment env = RuntimeEnvironment .getInstance ();
1790
- boolean chkres = whatXrefFile (path , env .isCompressXref ()).exists ();
1791
-
1792
- if (!env .isGenerateHtml ()) {
1793
- if (chkres ) {
1794
- LOGGER .log (Level .FINEST , "Extraneous {0}" , path );
1795
- removeXrefFile (path );
1796
- }
1797
- return true ;
1798
- }
1799
-
1800
- if (!chkres ) {
1791
+ if (!whatXrefFile (path , env .isCompressXref ()).exists ()) {
1801
1792
LOGGER .log (Level .FINEST , "Missing {0}" , path );
1793
+ return false ;
1802
1794
}
1803
- return chkres ;
1795
+
1796
+ return true ;
1804
1797
}
1805
1798
1806
1799
private class IndexDownArgs {
0 commit comments