From 6500a507bbeb7e91146bcc6208f648be1b5ebfa1 Mon Sep 17 00:00:00 2001 From: Conor MacNeill Date: Tue, 16 Jan 2001 13:36:38 +0000 Subject: [PATCH] Handle directories with # in them by passing the parser an inputstream, rather than a name. Submitted by: Yossie Teitz git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268462 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/org/apache/tools/ant/ProjectHelper.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/org/apache/tools/ant/ProjectHelper.java b/src/main/org/apache/tools/ant/ProjectHelper.java index f8f048749..2243c1f69 100644 --- a/src/main/org/apache/tools/ant/ProjectHelper.java +++ b/src/main/org/apache/tools/ant/ProjectHelper.java @@ -98,10 +98,14 @@ public class ProjectHelper { * Parses the project file. */ private void parse() throws BuildException { + FileInputStream inputStream = null; + try { SAXParser saxParser = getParserFactory().newSAXParser(); parser = saxParser.getParser(); - saxParser.parse(buildFile, new RootHandler()); + + inputStream = new FileInputStream(buildFile); + saxParser.parse(inputStream, new RootHandler()); } catch(ParserConfigurationException exc) { throw new BuildException("Parser has not been configured correctly", exc); @@ -134,6 +138,16 @@ public class ProjectHelper { catch(IOException exc) { throw new BuildException("Error reading project file", exc); } + finally { + if (inputStream != null) { + try { + inputStream.close(); + } + catch (IOException ioe) { + // ignore this + } + } + } } /**