@@ -137,8 +137,8 @@ private IndexCheck() {
137
137
* on whether projects are enabled in the configuration.
138
138
* @return true on success, false on failure
139
139
*/
140
- public static boolean check (@ NotNull Configuration configuration , IndexCheckMode mode ,
141
- Collection <String > projectNames ) {
140
+ public static boolean isOkay (@ NotNull Configuration configuration , IndexCheckMode mode ,
141
+ Collection <String > projectNames ) {
142
142
143
143
if (mode .equals (IndexCheckMode .NO_CHECK )) {
144
144
LOGGER .log (Level .WARNING , "no index check mode selected" );
@@ -151,15 +151,15 @@ public static boolean check(@NotNull Configuration configuration, IndexCheckMode
151
151
if (!projectNames .isEmpty ()) {
152
152
// Assumes projects are enabled.
153
153
for (String projectName : projectNames ) {
154
- ret |= checkDirNoExceptions (Path .of (indexRoot .toString (), projectName ), mode , projectName );
154
+ ret |= checkDirNoExceptions (Path .of (indexRoot .toString (), projectName ), mode );
155
155
}
156
156
} else {
157
157
if (configuration .isProjectsEnabled ()) {
158
158
for (String projectName : configuration .getProjects ().keySet ()) {
159
- ret |= checkDirNoExceptions (Path .of (indexRoot .toString (), projectName ), mode , projectName );
159
+ ret |= checkDirNoExceptions (Path .of (indexRoot .toString (), projectName ), mode );
160
160
}
161
161
} else {
162
- ret |= checkDirNoExceptions (indexRoot , mode , "" );
162
+ ret |= checkDirNoExceptions (indexRoot , mode );
163
163
}
164
164
}
165
165
@@ -170,10 +170,13 @@ public static boolean check(@NotNull Configuration configuration, IndexCheckMode
170
170
* @param indexPath directory with index
171
171
* @return 0 on success, 1 on failure
172
172
*/
173
- private static int checkDirNoExceptions (Path indexPath , IndexCheckMode mode , String projectName ) {
173
+ private static int checkDirNoExceptions (Path indexPath , IndexCheckMode mode ) {
174
174
try {
175
175
LOGGER .log (Level .INFO , "Checking index in ''{0}''" , indexPath );
176
176
checkDir (indexPath , mode );
177
+ } catch (IOException e ) {
178
+ LOGGER .log (Level .WARNING , String .format ("Could not perform index check for directory '%s'" , indexPath ), e );
179
+ return 0 ;
177
180
} catch (Exception e ) {
178
181
LOGGER .log (Level .WARNING , String .format ("Index check for directory '%s' failed" , indexPath ), e );
179
182
return 1 ;
@@ -191,6 +194,7 @@ private static int checkDirNoExceptions(Path indexPath, IndexCheckMode mode, Str
191
194
* @param mode index check mode
192
195
* @throws IOException if the directory cannot be opened
193
196
* @throws IndexVersionException if the version of the index does not match Lucene index version
197
+ * @throws IndexDocumentException if there are duplicate documents in the index
194
198
*/
195
199
public static void checkDir (Path indexPath , IndexCheckMode mode )
196
200
throws IndexVersionException , IndexDocumentException , IOException {
0 commit comments