diff --git a/web/documentserver-example/java/src/main/java/helpers/TrackManager.java b/web/documentserver-example/java/src/main/java/helpers/TrackManager.java index 55a78b329..a2e74edbd 100755 --- a/web/documentserver-example/java/src/main/java/helpers/TrackManager.java +++ b/web/documentserver-example/java/src/main/java/helpers/TrackManager.java @@ -192,8 +192,12 @@ public static void processSave(final JSONObject body, ver.mkdirs(); } - // get the path to the previous file version and rename the last file version with it - lastVersion.renameTo(new File(versionDir + File.separator + "prev." + curExt)); + if (lastVersion.exists()) { + // get the path to the previous file version and rename the last file version with it + lastVersion.renameTo(new File(versionDir + File.separator + "prev." + curExt)); + } else { + throw new Exception("The file not exist: " + lastVersion.getAbsolutePath()); + } saveFile(byteArrayFile, toSave); // save document file