From 6cd4baf0a84de6ce7edc5544ed81597fbc5dc7c7 Mon Sep 17 00:00:00 2001 From: Peter Reilly Date: Thu, 20 Nov 2003 12:08:17 +0000 Subject: [PATCH] Check if parent file is not null before using it git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275649 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/org/apache/tools/ant/util/FileUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/org/apache/tools/ant/util/FileUtils.java b/src/main/org/apache/tools/ant/util/FileUtils.java index 9f2ba84c4..af3894ace 100644 --- a/src/main/org/apache/tools/ant/util/FileUtils.java +++ b/src/main/org/apache/tools/ant/util/FileUtils.java @@ -545,7 +545,7 @@ public class FileUtils { // ensure that parent dir of dest file exists! // not using getParentFile method to stay 1.1 compat File parent = getParentFile(destFile); - if (!parent.exists()) { + if (parent != null && !parent.exists()) { parent.mkdirs(); } @@ -1383,7 +1383,7 @@ public class FileUtils { } File parent = getParentFile(to); - if (!parent.exists() && !parent.mkdirs()) { + if (parent != null && !parent.exists() && !parent.mkdirs()) { throw new IOException("Failed to create directory " + parent + " while trying to rename " + from); }