public void renameFiles() throws IOException { List<String> failures = PatchUtils.readRefs(renamingFailureMarker); for(String path : failures) { File toBeRenamed = new File(path); if(toBeRenamed.exists()) { if(!toBeRenamed.renameTo(PatchUtils.getRenamedFileName(toBeRenamed))) { log.cannotDeleteFile(path); } } } renamingFailureMarker.delete(); } }
private static void backup(final IdentityPatchContext context, final File file) { String fileName = file.getName(); if (fileName.endsWith(JAR_EXT)) { File targetFile = PatchUtils.getRenamedFileName(file); if (!file.renameTo(targetFile)) { if (context != null) { context.failedToRenameFile(file, targetFile); } else { throw PatchLogger.ROOT_LOGGER.cannotRenameFileDuringBackup(file.getAbsolutePath()); } } } }
public void renameFiles() throws IOException { List<String> failures = PatchUtils.readRefs(renamingFailureMarker); for(String path : failures) { File toBeRenamed = new File(path); if(toBeRenamed.exists()) { if(!toBeRenamed.renameTo(PatchUtils.getRenamedFileName(toBeRenamed))) { log.cannotDeleteFile(path); } } } renamingFailureMarker.delete(); } }
private static void backup(final IdentityPatchContext context, final File file) { String fileName = file.getName(); if (fileName.endsWith(JAR_EXT)) { File targetFile = PatchUtils.getRenamedFileName(file); if (!file.renameTo(targetFile)) { if (context != null) { context.failedToRenameFile(file, targetFile); } else { throw PatchLogger.ROOT_LOGGER.cannotRenameFileDuringBackup(file.getAbsolutePath()); } } } }
private static void restore(final IdentityPatchContext context, final File file) { String fileName = file.getName(); if (fileName.endsWith(BACKUP_EXT)) { File targetFile = PatchUtils.getRenamedFileName(file); if (!file.renameTo(targetFile)) { if (context != null) { context.failedToRenameFile(file, targetFile); } else { throw PatchLogger.ROOT_LOGGER.cannotRenameFileDuringRestore(file.getAbsolutePath()); } } } }
private static void restore(final IdentityPatchContext context, final File file) { String fileName = file.getName(); if (fileName.endsWith(BACKUP_EXT)) { File targetFile = PatchUtils.getRenamedFileName(file); if (!file.renameTo(targetFile)) { if (context != null) { context.failedToRenameFile(file, targetFile); } else { throw PatchLogger.ROOT_LOGGER.cannotRenameFileDuringRestore(file.getAbsolutePath()); } } } }