ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@locus.apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant ProjectHelper.java
Date Thu, 19 Oct 2000 10:57:50 GMT
bodewig     00/10/19 03:57:48

  Modified:    src/main/org/apache/tools/ant ProjectHelper.java
  Log:
  Resolve filenames in SYSTEM entity declarations relative to the
  project's basedir.
  
  Revision  Changes    Path
  1.34      +18 -0     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.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- ProjectHelper.java	2000/10/06 07:35:54	1.33
  +++ ProjectHelper.java	2000/10/19 10:57:48	1.34
  @@ -179,6 +179,24 @@
        * Handler for the root element. It's only child must be the "project" element.
        */
       private class RootHandler extends HandlerBase {
  +
  +        /**
  +         * resolve file: URIs as releative to the project's basedir.
  +         */
  +        public InputSource resolveEntity(String publicId,
  +                                         String systemId) {
  +
  +            if (systemId.startsWith("file:")) {
  +                try {
  +                    return new InputSource(new FileInputStream(project.resolveFile(systemId.substring(5))));
  +                } catch (FileNotFoundException fne) {
  +                    project.log(fne.getMessage(), Project.MSG_WARN);
  +                }
  +            }
  +            // use default if not file or file not found
  +            return null;
  +        }
  +
           public void startElement(String tag, AttributeList attrs) throws SAXParseException
{
               if (tag.equals("project")) {
                   new ProjectHandler(this).init(tag, attrs);
  
  
  

Mime
View raw message