Skip to content

Commit 67bf5f9

Browse files
committed
add javadoc, log versions
1 parent 3d9acce commit 67bf5f9

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,13 @@ private static void checkDefinitions(Path sourcePath, Path indexPath) throws IOE
382382
}
383383
}
384384

385-
private static boolean checkVersion(Path indexPath) throws IOException, IndexVersionException {
385+
/**
386+
* @param indexPath path to the index directory
387+
* @throws IOException on I/O error
388+
* @throws IndexVersionException if the version stored in the document does not match the version
389+
* used by the running program
390+
*/
391+
private static void checkVersion(Path indexPath) throws IOException, IndexVersionException {
386392
LockFactory lockFactory = NativeFSLockFactory.INSTANCE;
387393
int segVersion;
388394

@@ -392,18 +398,17 @@ private static boolean checkVersion(Path indexPath) throws IOException, IndexVer
392398
segVersion = segInfos.getIndexCreatedVersionMajor();
393399
} catch (IndexNotFoundException e) {
394400
LOGGER.log(Level.WARNING, "no index found in ''{0}''", indexDirectory);
395-
return true;
401+
return;
396402
}
397403
}
398404

399-
LOGGER.log(Level.FINE, "Checking index version in ''{0}''", indexPath);
405+
LOGGER.log(Level.FINE, "Checking index version in ''{0}'': index={1} program={2}",
406+
new Object[]{indexPath, segVersion, Version.LATEST.major});
400407
if (segVersion != Version.LATEST.major) {
401408
throw new IndexVersionException(
402409
String.format("Directory '%s' has index version discrepancy", indexPath),
403410
Version.LATEST.major, segVersion);
404411
}
405-
406-
return false;
407412
}
408413

409414
public static IndexReader getIndexReader(Path indexPath) throws IOException {

0 commit comments

Comments
 (0)