ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgl...@apache.org
Subject cvs commit: ant/src/testcases/org/apache/tools/ant/taskdefs/optional AbstractXSLTLiaisonTest.java
Date Tue, 07 Dec 2004 09:02:33 GMT
jglick      2004/12/07 01:02:33

  Modified:    src/testcases/org/apache/tools/ant/taskdefs/optional
                        AbstractXSLTLiaisonTest.java
  Log:
  1. Never use new File(url.getFile()); it is not safe with all paths.
  2. Using File.deleteOnExit for temp files, just in case the VM croaks.
  
  Revision  Changes    Path
  1.9       +10 -8     ant/src/testcases/org/apache/tools/ant/taskdefs/optional/AbstractXSLTLiaisonTest.java
  
  Index: AbstractXSLTLiaisonTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/optional/AbstractXSLTLiaisonTest.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AbstractXSLTLiaisonTest.java	9 Feb 2004 21:05:44 -0000	1.8
  +++ AbstractXSLTLiaisonTest.java	7 Dec 2004 09:02:33 -0000	1.9
  @@ -1,5 +1,3 @@
  -package org.apache.tools.ant.taskdefs.optional;
  -
   /*
    * Copyright  2001,2004 The Apache Software Foundation
    *
  @@ -17,15 +15,17 @@
    *
    */
   
  -import junit.framework.TestCase;
  -import org.apache.tools.ant.taskdefs.XSLTLiaison;
  -import org.w3c.dom.Document;
  +package org.apache.tools.ant.taskdefs.optional;
   
  -import javax.xml.parsers.DocumentBuilder;
  -import javax.xml.parsers.DocumentBuilderFactory;
   import java.io.File;
   import java.io.FileNotFoundException;
   import java.net.URL;
  +import javax.xml.parsers.DocumentBuilder;
  +import javax.xml.parsers.DocumentBuilderFactory;
  +import junit.framework.TestCase;
  +import org.apache.tools.ant.taskdefs.XSLTLiaison;
  +import org.apache.tools.ant.util.FileUtils;
  +import org.w3c.dom.Document;
   
   /**
    * Abtract testcase for XSLTLiaison.
  @@ -54,7 +54,7 @@
           if (url == null){
             throw new FileNotFoundException("Unable to load '" + name + "' from classpath");
           }
  -        return new File(url.getFile());
  +        return new File(FileUtils.newFileUtils().fromURI(url.toExternalForm()));
       }
   
       /** keep it simple stupid */
  @@ -64,6 +64,7 @@
           liaison.addParam("param", "value");
           File in = getFile("/taskdefs/optional/xsltliaison-in.xml");
           File out = new File("xsltliaison.tmp");
  +        out.deleteOnExit(); // just to be sure
           try {
               liaison.transform(in, out);
           } finally {
  @@ -76,6 +77,7 @@
           liaison.setStylesheet(xsl);
           File in = getFile("/taskdefs/optional/xsltliaison-encoding-in.xml");
           File out = new File("xsltliaison-encoding.tmp");
  +        out.deleteOnExit(); // just to be sure
           try {
               liaison.transform(in, out);
               Document doc = parseXML(out);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message