Browse Source

Some places where url.toFile has been used instead of FileUtils.fromURI.

PR: 30593, 30642
Submitted by:	Kevin Greiner <kgreiner at xpediantsolutions dot com>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277003 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 21 years ago
parent
commit
32365ed4e0
2 changed files with 6 additions and 2 deletions
  1. +1
    -1
      src/main/org/apache/tools/ant/types/XMLCatalog.java
  2. +5
    -1
      src/testcases/org/apache/tools/ant/taskdefs/optional/sitraka/XMLReportTest.java

+ 1
- 1
src/main/org/apache/tools/ant/types/XMLCatalog.java View File

@@ -679,7 +679,7 @@ public class XMLCatalog extends DataType
} }


if (url != null) { if (url != null) {
String fileName = url.getFile();
String fileName = fileUtils.fromURI(url.toString());
if (fileName != null) { if (fileName != null) {
log("fileName " + fileName, Project.MSG_DEBUG); log("fileName " + fileName, Project.MSG_DEBUG);
File resFile = new File(fileName); File resFile = new File(fileName);


+ 5
- 1
src/testcases/org/apache/tools/ant/taskdefs/optional/sitraka/XMLReportTest.java View File

@@ -28,6 +28,7 @@ import javax.xml.transform.stream.StreamResult;


import junit.framework.TestCase; import junit.framework.TestCase;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.util.FileUtils;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
@@ -36,6 +37,9 @@ import org.w3c.dom.NodeList;
* Ensure that reference classpath feature is working fine... * Ensure that reference classpath feature is working fine...
*/ */
public class XMLReportTest extends TestCase { public class XMLReportTest extends TestCase {
/** helper for some File/URL connversions */
private static FileUtils fileUtils = FileUtils.newFileUtils();

public XMLReportTest(String s) { public XMLReportTest(String s) {
super(s); super(s);
} }
@@ -45,7 +49,7 @@ public class XMLReportTest extends TestCase {
if (url == null) { if (url == null) {
throw new FileNotFoundException("Unable to load '" + name + "' from classpath"); throw new FileNotFoundException("Unable to load '" + name + "' from classpath");
} }
return new File(url.getFile());
return new File(fileUtils.fromURI(url.toString()));
} }


public void testCreateDocument() throws Exception { public void testCreateDocument() throws Exception {


Loading…
Cancel
Save