Skip to content

Commit

Permalink
Merge pull request kitodo#5894 from matthias-ronge/patch-85
Browse files Browse the repository at this point in the history
Catch Exceptions in indexing processes, log warning and continue
  • Loading branch information
solth authored Feb 16, 2024
2 parents e7c7f08 + b0d52f7 commit 46484e5
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@

import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.io.IOUtils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.lucene.search.join.ScoreMode;
Expand Down Expand Up @@ -352,11 +353,16 @@ private void enrichProcessData(Process process, boolean forIndexingAll) throws I
if (!fileService.fileExist(metadataFilePath)) {
logger.info("No metadata file for indexing: {}", metadataFilePath);
} else {
Workpiece workpiece = ServiceManager.getMetsService().loadWorkpiece(metadataFilePath);
process.setNumberOfImages(getNumberOfImagesForIndex(workpiece));
process.setNumberOfMetadata(getNumberOfMetadata(workpiece));
process.setNumberOfStructures(getNumberOfStructures(workpiece));
process.setBaseType(getBaseType(workpiece));
try {
Workpiece workpiece = ServiceManager.getMetsService().loadWorkpiece(metadataFilePath);
process.setNumberOfImages(getNumberOfImagesForIndex(workpiece));
process.setNumberOfMetadata(getNumberOfMetadata(workpiece));
process.setNumberOfStructures(getNumberOfStructures(workpiece));
process.setBaseType(getBaseType(workpiece));
} catch (IllegalArgumentException | IOException e) {
logger.warn("Cannot read metadata file for indexing: {}", metadataFilePath);
logger.catching(Level.DEBUG, e);
}
}
}

Expand Down

0 comments on commit 46484e5

Please sign in to comment.