ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sbaill...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional TraXLiaison.java
Date Thu, 16 Aug 2001 09:43:03 GMT
sbailliez    01/08/16 02:43:03

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional Tag:
                        ANT_14_BRANCH TraXLiaison.java
  Log:
  Fixed systemid bug that shows up only with crimson (bug #3132)
  
  The TraXLiaison testcase was demonstrating this error but it didn't show up
  because I had xerces in the path and xerces handles this without complaining.
  
  Crimson expect systemid as being fully /'ed. It gets the base uri by
  doing a lastIndexOf('/') meaning that windows like pathname were
  returning a file:/// as the base uri...
  
  Now the systemid is /'ed which should be the standard...
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.3.2.2   +13 -3     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
  
  Index: TraXLiaison.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java,v
  retrieving revision 1.3.2.1
  retrieving revision 1.3.2.2
  diff -u -r1.3.2.1 -r1.3.2.2
  --- TraXLiaison.java	2001/08/11 22:06:45	1.3.2.1
  +++ TraXLiaison.java	2001/08/16 09:43:03	1.3.2.2
  @@ -107,7 +107,7 @@
       public void setStylesheet(File stylesheet) throws Exception {
           xslStream = new FileInputStream(stylesheet);
           StreamSource src = new StreamSource(xslStream);
  -        src.setSystemId(FILE_PROTOCOL_PREFIX + stylesheet.getAbsolutePath());
  +        src.setSystemId(getSystemId(stylesheet));
           templates = tfactory.newTemplates(src);
           transformer = templates.newTransformer();
       }
  @@ -119,10 +119,10 @@
               fis = new FileInputStream(infile);
               fos = new FileOutputStream(outfile);
               StreamSource src = new StreamSource(fis);
  -            src.setSystemId(FILE_PROTOCOL_PREFIX + infile.getAbsolutePath());
  +            src.setSystemId(getSystemId(infile));
               StreamResult res = new StreamResult(fos);
               // not sure what could be the need of this...
  -            res.setSystemId(FILE_PROTOCOL_PREFIX + outfile.getAbsolutePath());
  +            res.setSystemId(getSystemId(outfile));
   
               transformer.transform(src, res);
           } finally {
  @@ -145,6 +145,16 @@
                   }
               } catch (IOException ignored){}
           }
  +    }
  +
  +    // make sure that the systemid is made of '/' and not '\' otherwise
  +    // crimson will complain that it cannot resolve relative entities
  +    // because it grabs the base uri via lastIndexOf('/') without
  +    // making sure it is really a /'ed path
  +    protected String getSystemId(File file){
  +      String path = file.getAbsolutePath();
  +      path = path.replace('\\','/');
  +      return FILE_PROTOCOL_PREFIX + path;
       }
   
       public void addParam(String name, String value){
  
  
  

Mime
View raw message