handle all content extraction errors

This commit is contained in:
bgamard 2020-05-19 15:11:05 +02:00
parent d428e89c30
commit cb29dcd6cc
2 changed files with 6 additions and 4 deletions

View File

@ -166,17 +166,17 @@ public class FileProcessingAsyncListener {
ImageUtil.writeJpeg(thumbnail, outputStream); ImageUtil.writeJpeg(thumbnail, outputStream);
} }
} }
} catch (Exception e) { } catch (Throwable e) {
log.error("Unable to generate thumbnails for: " + file, e); log.error("Unable to generate thumbnails for: " + file, e);
} }
// Extract text content from the file // Extract text content from the file
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
String content = null; String content = null;
log.error("Start extracting content from: " + file); log.info("Start extracting content from: " + file);
try { try {
content = formatHandler.extractContent(event.getLanguage(), event.getUnencryptedFile()); content = formatHandler.extractContent(event.getLanguage(), event.getUnencryptedFile());
} catch (Exception e) { } catch (Throwable e) {
log.error("Error extracting content from: " + file, e); log.error("Error extracting content from: " + file, e);
} }
log.info(MessageFormat.format("File content extracted in {0}ms: " + file.getId(), System.currentTimeMillis() - startTime)); log.info(MessageFormat.format("File content extracted in {0}ms: " + file.getId(), System.currentTimeMillis() - startTime));

View File

@ -34,7 +34,9 @@ public class InputStreamReaderThread extends Thread {
try { try {
BufferedReader reader = closer.register(new BufferedReader(new InputStreamReader(is))); BufferedReader reader = closer.register(new BufferedReader(new InputStreamReader(is)));
for (String line = reader.readLine(); line != null; line = reader.readLine()) { for (String line = reader.readLine(); line != null; line = reader.readLine()) {
logger.error(String.format(name + ": %s", line)); if (logger.isDebugEnabled()) {
logger.debug(String.format(name + ": %s", line));
}
} }
} catch (IOException x) { } catch (IOException x) {
// NOP // NOP