@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); } }