do not try to create a thumbnail if the image doesn't exist

This commit is contained in:
2018-04-28 19:59:00 +02:00
parent d4b09d4dab
commit 022d5a21c5

View File

@@ -152,7 +152,7 @@ public class ScatterPlot implements ConcretePlotter {
final int thumbnailMaxHeight) {
Path result;
if (thumbnailMaxWidth > 0 && thumbnailMaxHeight > 0) {
if (thumbnailMaxWidth > 0 && thumbnailMaxHeight > 0 && Files.exists(originalImage)) {
try {
final long start = System.nanoTime();
final BufferedImage image = ImageIO.read(originalImage.toFile());
@@ -164,7 +164,7 @@ public class ScatterPlot implements ConcretePlotter {
ImageIO.write(thumbnail, "JPG", thumbnailPath.toFile());
LOGGER.info("thumbnail creation: " + (System.nanoTime() - start) / 1_000_000.0 + "ms");
result = thumbnailPath;
} catch (final IOException e) {
} catch (final IOException | RuntimeException e) {
LOGGER.warn("failed to scale image", e);
result = null;
}