From 531e66cb1e7a5c8c495d724a0dc52ab65a77faf7 Mon Sep 17 00:00:00 2001 From: Matthew Jason Benson Date: Tue, 20 Apr 2004 19:27:54 +0000 Subject: [PATCH] Switch getParentFile(File) to delegate to File.getParentFile() and deprecate. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276364 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/org/apache/tools/ant/Main.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/org/apache/tools/ant/Main.java b/src/main/org/apache/tools/ant/Main.java index 507e8117b..6dd940dd7 100644 --- a/src/main/org/apache/tools/ant/Main.java +++ b/src/main/org/apache/tools/ant/Main.java @@ -506,20 +506,19 @@ public class Main implements AntMain { * Helper to get the parent file for a given file. *

* Added to simulate File.getParentFile() from JDK 1.2. + * @deprecated * * @param file File to find parent of. Must not be null. * @return Parent file or null if none */ private File getParentFile(File file) { - String filename = file.getAbsolutePath(); - file = new File(filename); - filename = file.getParent(); + File parent = file.getParentFile(); - if (filename != null && msgOutputLevel >= Project.MSG_VERBOSE) { - System.out.println("Searching in " + filename); + if (parent != null && msgOutputLevel >= Project.MSG_VERBOSE) { + System.out.println("Searching in " + parent.getAbsolutePath()); } - return (filename == null) ? null : new File(filename); + return parent; } /**