Problem is as following. The patch is attached...

The project file readers does not handle external entity correctly. The
following build.xml is from Jakarta Log4J project. The current Ant 1.3
Beta 2
can not handle this build.xml

The file in question is

src/main/org/apache/tools/ant/ProjectHelper.java


<!-- This file is intended for ANT, a Java based build tool. ANT is
     availale from http://jakarta.apache.org/ant/index.html
  -->

<!DOCTYPE project [
  <!ENTITY depth "../../..">
  <!ENTITY package "">
  <!ENTITY build.inc SYSTEM "build.inc">
]>

<project name="log4j" default="Usage" basedir="." >
  &build.inc;
</project>

---
Index: src/main/org/apache/tools/ant/ProjectHelper.java
===================================================================
RCS file: 
/home/topware/cvsroot/Enhydra/modules/Ant/src/main/org/apache/tools/ant/ProjectHelper.java,v
retrieving revision 1.1.2.5
diff -c -r1.1.2.5 ProjectHelper.java
*** src/main/org/apache/tools/ant/ProjectHelper.java    2001/02/16 06:36:00     
1.1.2.5
--- src/main/org/apache/tools/ant/ProjectHelper.java    2001/02/16 06:50:11
***************
*** 104,111 ****
              SAXParser saxParser = getParserFactory().newSAXParser();
              parser = saxParser.getParser();
              
!             inputStream = new FileInputStream(buildFile);
!             saxParser.parse(inputStream, new RootHandler());
          }
          catch(ParserConfigurationException exc) {
              throw new BuildException("Parser has not been configured 
correctly", exc);
--- 104,110 ----
              SAXParser saxParser = getParserFactory().newSAXParser();
              parser = saxParser.getParser();
              
!             saxParser.parse(buildFile, new RootHandler());
          }
          catch(ParserConfigurationException exc) {
              throw new BuildException("Parser has not been configured 
correctly", exc);
***************
*** 215,227 ****
                  if (!file.isAbsolute()) {
                      file = new File(buildFileParent, path);
                  }
!                 
!                 try {
!                     return new InputSource(new FileInputStream(file));
!                 } catch (FileNotFoundException fne) {
!                     project.log(file.getAbsolutePath()+" could not be found", 
!                                 Project.MSG_WARN);
!                 }
              }
              // use default if not file or file not found
              return null;
--- 214,220 ----
                  if (!file.isAbsolute()) {
                      file = new File(buildFileParent, path);
                  }
!                 return new InputSource(file.getAbsolutePath());
              }
              // use default if not file or file not found
              return null;

Reply via email to