@Override public void execute(PatchingTaskContext context) throws IOException { // delete the file or directory recursively boolean ok = IoUtils.recursiveDelete(target); for(ContentModification mod : rollback) { // Add the rollback (add actions) // We skip the change - misc files are reused in the processed patch context.recordChange(null, mod); } if(! ok) { throw PatchLogger.ROOT_LOGGER.failedToDelete(target.getAbsolutePath()); } }
@Override public void execute(PatchingTaskContext context) throws IOException { // delete the file or directory recursively boolean ok = IoUtils.recursiveDelete(target); for(ContentModification mod : rollback) { // Add the rollback (add actions) // We skip the change - misc files are reused in the processed patch context.recordChange(null, mod); } if(! ok) { throw PatchLogger.ROOT_LOGGER.failedToDelete(target.getAbsolutePath()); } }
@Override public void execute(final PatchingTaskContext context) throws IOException { if (ignoreApply) { return; } final PatchContentLoader contentLoader = description.getLoader(); final boolean skip = skipExecution | context.isExcluded(contentItem); final byte[] contentHash; if(skip) { contentHash = backupHash; // Reuse the backup hash } else { contentHash = apply(context, contentLoader); // Copy the content } // Add the rollback action final ContentModification original = getOriginalModification(contentHash, backupHash); final ContentModification rollbackAction = createRollbackEntry(original, contentHash, backupHash); context.recordChange(original, rollbackAction); // Fail after adding the undo action if (! Arrays.equals(contentHash, contentItem.getContentHash()) && failOnContentMismatch(context)) { throw PatchLogger.ROOT_LOGGER.wrongCopiedContent(contentItem); } }
@Override public void execute(final PatchingTaskContext context) throws IOException { if (ignoreApply) { return; } final PatchContentLoader contentLoader = description.getLoader(); final boolean skip = skipExecution | context.isExcluded(contentItem); final byte[] contentHash; if(skip) { contentHash = backupHash; // Reuse the backup hash } else { contentHash = apply(context, contentLoader); // Copy the content } // Add the rollback action final ContentModification original = getOriginalModification(contentHash, backupHash); final ContentModification rollbackAction = createRollbackEntry(original, contentHash, backupHash); context.recordChange(original, rollbackAction); // Fail after adding the undo action if (! Arrays.equals(contentHash, contentItem.getContentHash()) && failOnContentMismatch(context)) { throw PatchLogger.ROOT_LOGGER.wrongCopiedContent(contentItem); } }