From commits-return-75442-archive-asf-public=cust-asf.ponee.io@commons.apache.org Thu Aug 6 23:42:42 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mailroute1-lw-us.apache.org (mailroute1-lw-us.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with ESMTPS id F0F2A18061A for ; Fri, 7 Aug 2020 01:42:41 +0200 (CEST) Received: from mail.apache.org (localhost [127.0.0.1]) by mailroute1-lw-us.apache.org (ASF Mail Server at mailroute1-lw-us.apache.org) with SMTP id 07A97126CE8 for ; Thu, 6 Aug 2020 23:42:41 +0000 (UTC) Received: (qmail 7277 invoked by uid 500); 6 Aug 2020 23:42:40 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 7268 invoked by uid 99); 6 Aug 2020 23:42:40 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Aug 2020 23:42:40 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 20F3C8242E; Thu, 6 Aug 2020 23:42:39 +0000 (UTC) Date: Thu, 06 Aug 2020 23:42:39 +0000 To: "commits@commons.apache.org" Subject: [commons-io] branch master updated: Refactor for simpler subclassing. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <159675735989.24673.10085147448572690317@gitbox.apache.org> From: ggregory@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: commons-io X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 291a35ef8be015be252664e2cbde0af741cd82f1 X-Git-Newrev: 3ac63df5d5660d14212b9dad50ef2da3d26305f3 X-Git-Rev: 3ac63df5d5660d14212b9dad50ef2da3d26305f3 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-io.git The following commit(s) were added to refs/heads/master by this push: new 3ac63df Refactor for simpler subclassing. new 71bfef4 Merge branch 'master' of https://gitbox.apache.org/repos/asf/commons-io.git 3ac63df is described below commit 3ac63df5d5660d14212b9dad50ef2da3d26305f3 Author: Gary Gregory AuthorDate: Thu Aug 6 19:42:08 2020 -0400 Refactor for simpler subclassing. --- .../org/apache/commons/io/file/CopyDirectoryVisitor.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/io/file/CopyDirectoryVisitor.java b/src/main/java/org/apache/commons/io/file/CopyDirectoryVisitor.java index b5a39d5..ff25d31 100644 --- a/src/main/java/org/apache/commons/io/file/CopyDirectoryVisitor.java +++ b/src/main/java/org/apache/commons/io/file/CopyDirectoryVisitor.java @@ -55,6 +55,18 @@ public class CopyDirectoryVisitor extends CountingPathVisitor { this.copyOptions = copyOptions == null ? EMPTY_COPY_OPTIONS : copyOptions.clone(); } + /** + * Copies the sourceFile to the targetFile. + * + * @param sourceFile the source file. + * @param targetFile the target file. + * @throws IOException if an I/O error occurs. + * @since 2.8.0 + */ + protected void copy(final Path sourceFile, final Path targetFile) throws IOException { + Files.copy(sourceFile, targetFile, copyOptions); + } + @Override public FileVisitResult preVisitDirectory(final Path directory, final BasicFileAttributes attributes) throws IOException { @@ -68,7 +80,7 @@ public class CopyDirectoryVisitor extends CountingPathVisitor { @Override public FileVisitResult visitFile(final Path sourceFile, final BasicFileAttributes attributes) throws IOException { final Path targetFile = targetDirectory.resolve(sourceDirectory.relativize(sourceFile)); - Files.copy(sourceFile, targetFile, copyOptions); + copy(sourceFile, targetFile); return super.visitFile(targetFile, attributes); }