From 2c0cdf69f7273ffd2c2120e93ca9388cb2ec0fcd Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 15 Aug 2018 00:01:14 +0300 Subject: Trying to fix NoSuchFileException when moving temp file --- juick-common/src/main/java/com/juick/server/util/ImageUtils.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'juick-common/src/main/java') diff --git a/juick-common/src/main/java/com/juick/server/util/ImageUtils.java b/juick-common/src/main/java/com/juick/server/util/ImageUtils.java index 3e03314b..d16faf8f 100644 --- a/juick-common/src/main/java/com/juick/server/util/ImageUtils.java +++ b/juick-common/src/main/java/com/juick/server/util/ImageUtils.java @@ -25,6 +25,7 @@ import org.apache.commons.imaging.common.ImageMetadata; import org.apache.commons.imaging.formats.jpeg.JpegImageMetadata; import org.apache.commons.imaging.formats.tiff.TiffField; import org.apache.commons.imaging.formats.tiff.constants.TiffTagConstants; +import org.apache.commons.io.FileUtils; import org.apache.commons.io.FilenameUtils; import org.imgscalr.Scalr; import org.imgscalr.Scalr.Rotation; @@ -120,7 +121,9 @@ public class ImageUtils { String ext = FilenameUtils.getExtension(outputFilename); Path outputImagePath = Paths.get(imgDir, "p", outputFilename); - Files.move(Paths.get(tmpDir, tempFilename), outputImagePath); + // this throws strange exceptions + // Files.move(Paths.get(tmpDir, tempFilename), outputImagePath); + FileUtils.moveFile(Paths.get(tmpDir, tempFilename).toFile(), outputImagePath.toFile()); BufferedImage originalImage = readImageWithOrientation(outputImagePath.toFile()); int width = originalImage.getWidth(); -- cgit v1.2.3