@@ -382,7 +382,13 @@ private static void checkDefinitions(Path sourcePath, Path indexPath) throws IOE
382
382
}
383
383
}
384
384
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 {
386
392
LockFactory lockFactory = NativeFSLockFactory .INSTANCE ;
387
393
int segVersion ;
388
394
@@ -392,18 +398,17 @@ private static boolean checkVersion(Path indexPath) throws IOException, IndexVer
392
398
segVersion = segInfos .getIndexCreatedVersionMajor ();
393
399
} catch (IndexNotFoundException e ) {
394
400
LOGGER .log (Level .WARNING , "no index found in ''{0}''" , indexDirectory );
395
- return true ;
401
+ return ;
396
402
}
397
403
}
398
404
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 });
400
407
if (segVersion != Version .LATEST .major ) {
401
408
throw new IndexVersionException (
402
409
String .format ("Directory '%s' has index version discrepancy" , indexPath ),
403
410
Version .LATEST .major , segVersion );
404
411
}
405
-
406
- return false ;
407
412
}
408
413
409
414
public static IndexReader getIndexReader (Path indexPath ) throws IOException {
0 commit comments