Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 58B74200BB0 for ; Sun, 30 Oct 2016 21:21:18 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 573B9160B04; Sun, 30 Oct 2016 20:21:18 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 9E2D7160ADD for ; Sun, 30 Oct 2016 21:21:17 +0100 (CET) Received: (qmail 81854 invoked by uid 500); 30 Oct 2016 20:21:15 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 81725 invoked by uid 99); 30 Oct 2016 20:21:15 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 30 Oct 2016 20:21:15 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 9E246E09DE; Sun, 30 Oct 2016 20:21:14 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: wangda@apache.org To: common-commits@hadoop.apache.org Date: Sun, 30 Oct 2016 20:21:14 -0000 Message-Id: <9c0745f01f31436ab63f6b0e5de6a34f@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [01/50] [abbrv] hadoop git commit: HADOOP-10075. addendum to fix compilation on Windows [Forced Update!] archived-at: Sun, 30 Oct 2016 20:21:18 -0000 Repository: hadoop Updated Branches: refs/heads/YARN-3368 97143e966 -> 6b20b8c2c (forced update) HADOOP-10075. addendum to fix compilation on Windows Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/ebb88231 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/ebb88231 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/ebb88231 Branch: refs/heads/YARN-3368 Commit: ebb88231f802918096159da453bed2c4839e6042 Parents: 76a1042 Author: Robert Kanter Authored: Fri Oct 28 17:35:28 2016 -0700 Committer: Robert Kanter Committed: Fri Oct 28 17:35:28 2016 -0700 ---------------------------------------------------------------------- .../maven/plugin/resourcegz/ResourceGzMojo.java | 28 ++++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/ebb88231/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/resourcegz/ResourceGzMojo.java ---------------------------------------------------------------------- diff --git a/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/resourcegz/ResourceGzMojo.java b/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/resourcegz/ResourceGzMojo.java index 5c9e26e..e7ab663 100644 --- a/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/resourcegz/ResourceGzMojo.java +++ b/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/resourcegz/ResourceGzMojo.java @@ -24,10 +24,12 @@ import org.apache.maven.plugins.annotations.Parameter; import java.io.BufferedReader; import java.io.File; import java.io.FileOutputStream; +import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.List; import java.util.function.Consumer; +import java.util.regex.Matcher; import java.util.zip.GZIPOutputStream; /** @@ -101,17 +103,21 @@ public class ResourceGzMojo extends AbstractMojo { } try { File outFile = new File(outputDir, path.toFile().getCanonicalPath() - .replaceFirst(inputDir.getCanonicalPath(), "") + ".gz"); - outFile.getParentFile().mkdirs(); - try ( - GZIPOutputStream os = new GZIPOutputStream( - new FileOutputStream(outFile)); - BufferedReader is = Files.newBufferedReader(path) - ) { - getLog().info("Compressing " + path + " to " + outFile); - IOUtils.copy(is, os); - } catch (Throwable t) { - this.throwable = t; + .replaceFirst(Matcher.quoteReplacement( + inputDir.getCanonicalPath()), "") + ".gz"); + if (outFile.getParentFile().isDirectory() || + outFile.getParentFile().mkdirs()) { + try ( + GZIPOutputStream os = new GZIPOutputStream( + new FileOutputStream(outFile)); + BufferedReader is = Files.newBufferedReader(path) + ) { + getLog().info("Compressing " + path + " to " + outFile); + IOUtils.copy(is, os); + } + } else { + throw new IOException("Directory " + outFile.getParent() + + " does not exist or was unable to be created"); } } catch (Throwable t) { this.throwable = t; --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org For additional commands, e-mail: common-commits-help@hadoop.apache.org