aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-08-15 00:01:14 +0300
committerGravatar Vitaly Takmazov2018-08-15 00:01:14 +0300
commit2c0cdf69f7273ffd2c2120e93ca9388cb2ec0fcd (patch)
tree8886b81d0efa1a6daf6ad7f73d35b1e72055fe19
parentd521327847864742286ca50207d73454006cd792 (diff)
Trying to fix NoSuchFileException when moving temp file
-rw-r--r--juick-common/src/main/java/com/juick/server/util/ImageUtils.java5
1 files changed, 4 insertions, 1 deletions
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();