do not try to create a thumbnail if the image doesn't exist
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user