Skip to content

Commit 2ca22b5

Browse files
Increase IOException logging
1 parent 68d4aed commit 2ca22b5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/main/java/org/icatproject/lucene/Lucene.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,7 @@ public void modify(@Context HttpServletRequest request) throws LuceneException {
481481
}
482482
count = operations.size();
483483
} catch (IOException e) {
484+
logger.error("IOException while attempting to modify document(s)", e);
484485
throw new LuceneException(HttpURLConnection.HTTP_INTERNAL_ERROR, e.getMessage());
485486
}
486487
logger.debug("Modified {} documents", count);
@@ -509,6 +510,7 @@ public void addNow(@Context HttpServletRequest request, @PathParam("entityName")
509510
logger.error("Could not parse JSON from {}", value);
510511
throw new LuceneException(HttpURLConnection.HTTP_INTERNAL_ERROR, e.getMessage());
511512
} catch (IOException e) {
513+
logger.error("IOException while attempting to add document(s)", e);
512514
throw new LuceneException(HttpURLConnection.HTTP_INTERNAL_ERROR, e.getMessage());
513515
}
514516
logger.debug("Added {} {} documents", documents.size(), entityName);
@@ -530,6 +532,7 @@ public void clear() throws LuceneException {
530532
Files.walk(luceneDirectory, FileVisitOption.FOLLOW_LINKS).sorted(Comparator.reverseOrder())
531533
.filter(f -> !luceneDirectory.equals(f)).map(java.nio.file.Path::toFile).forEach(File::delete);
532534
} catch (IOException e) {
535+
logger.error("IOException while attempting to clear", e);
533536
throw new LuceneException(HttpURLConnection.HTTP_INTERNAL_ERROR, e.getMessage());
534537
}
535538

@@ -554,6 +557,7 @@ public void commit() throws LuceneException {
554557
}
555558
}
556559
} catch (IOException e) {
560+
logger.error("IOException while attempting to commit", e);
557561
throw new LuceneException(HttpURLConnection.HTTP_INTERNAL_ERROR, e.getMessage());
558562
}
559563
}
@@ -803,6 +807,7 @@ private void delete(JsonObject operationBody) throws LuceneException, IOExceptio
803807
shardBucket.indexWriter.deleteDocuments(idQuery);
804808
}
805809
} catch (IOException e) {
810+
logger.error("IOException while attempting to delete document(s)", e);
806811
throw new LuceneException(HttpURLConnection.HTTP_INTERNAL_ERROR, e.getMessage());
807812
}
808813
}
@@ -958,6 +963,7 @@ public void freeSearcher(SearchBucket search) throws LuceneException {
958963
indexBuckets.computeIfAbsent(name.toLowerCase(), k -> new IndexBucket(k))
959964
.releaseSearchers(subReaders);
960965
} catch (IOException e) {
966+
logger.error("IOException while attempting to freeSearcher", e);
961967
throw new LuceneException(HttpURLConnection.HTTP_INTERNAL_ERROR, e.getMessage());
962968
}
963969
}
@@ -1173,6 +1179,7 @@ public void lock(@PathParam("entityName") String entityName, @QueryParam("minId"
11731179
}
11741180
}
11751181
} catch (IOException e) {
1182+
logger.error("IOException while attempting to lock", e);
11761183
throw new LuceneException(HttpURLConnection.HTTP_INTERNAL_ERROR, e.getMessage());
11771184
}
11781185
}
@@ -1736,6 +1743,7 @@ public void unlock(@PathParam("entityName") String entityName) throws LuceneExce
17361743
try {
17371744
bucket.commit("Unlock", entityName);
17381745
} catch (IOException e) {
1746+
logger.error("IOException while attempting to unlock", e);
17391747
throw new LuceneException(HttpURLConnection.HTTP_INTERNAL_ERROR, e.getMessage());
17401748
}
17411749
}

0 commit comments

Comments
 (0)