conor       01/01/16 05:36:39

  Modified:    src/main/org/apache/tools/ant ProjectHelper.java
  Log:
  Handle directories with # in them by passing the parser
  an inputstream, rather than a name.
  
  Submitted by: Yossie Teitz <[EMAIL PROTECTED]>
  
  Revision  Changes    Path
  1.45      +15 -1     
jakarta-ant/src/main/org/apache/tools/ant/ProjectHelper.java
  
  Index: ProjectHelper.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/ProjectHelper.java,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- ProjectHelper.java        2001/01/16 13:09:43     1.44
  +++ ProjectHelper.java        2001/01/16 13:36:38     1.45
  @@ -98,10 +98,14 @@
        * 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);
  @@ -133,6 +137,16 @@
           }
           catch(IOException exc) {
               throw new BuildException("Error reading project file", exc);
  +        }
  +        finally {
  +            if (inputStream != null) {
  +                try {
  +                    inputStream.close();
  +                }
  +                catch (IOException ioe) {
  +                    // ignore this
  +                }
  +            }
           }
       }
   
  
  
  

Reply via email to