From 1967c958ff5363f25742a8b7687a0c9dddcfa38a Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Fri, 8 Nov 2002 10:27:40 +0000 Subject: [PATCH] Missing pieces from Craeg's patch. Fix small backwards incompatibility introduced by last commit. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273515 13f79535-47bb-0310-9956-ffa450edef68 --- build.xml | 1 - .../taskdefs/optional/XMLValidateTask.java | 6 +- .../tools/ant/types/EntityLocation.java | 72 ------------------- .../tools/ant/types/ResourceLocation.java | 1 + .../ant/types/resolver/ApacheCatalog.java | 1 + .../types/resolver/ApacheCatalogResolver.java | 1 + .../tools/ant/types/XMLCatalogTest.java | 54 ++++++++------ 7 files changed, 40 insertions(+), 96 deletions(-) delete mode 100644 src/main/org/apache/tools/ant/types/EntityLocation.java diff --git a/build.xml b/build.xml index 9963fdf3a..83384bb2c 100644 --- a/build.xml +++ b/build.xml @@ -292,7 +292,6 @@ - catalog1 --> catalog - DTDLocation dtd = new DTDLocation(); + ResourceLocation dtd = new ResourceLocation(); dtd.setPublicId(publicId); dtd.setLocation(sysid); catalog.addDTD(dtd); @@ -268,7 +282,7 @@ public class XMLCatalogTest extends TestCase { String uri = "http://foo.com/bar/blah.xml"; String uriLoc = "src/etc/testcases/taskdefs/optional/xml/about.xml"; - DTDLocation entity = new DTDLocation(); + ResourceLocation entity = new ResourceLocation(); entity.setPublicId(uri); entity.setLocation(uriLoc); catalog.addEntity(entity); @@ -310,7 +324,7 @@ public class XMLCatalogTest extends TestCase { String publicId = "-//stevo//DTD doc 1.0//EN"; String dtdLoc = "src/etc/testcases/taskdefs/optional/xml/doc.dtd"; - DTDLocation dtd = new DTDLocation(); + ResourceLocation dtd = new ResourceLocation(); dtd.setPublicId(publicId); dtd.setLocation(dtdLoc); catalog.addDTD(dtd); @@ -319,7 +333,7 @@ public class XMLCatalogTest extends TestCase { String uri = "http://foo.com/bar/blah.xml"; String uriLoc = "src/etc/testcases/taskdefs/optional/xml/about.xml"; - DTDLocation entity = new DTDLocation(); + ResourceLocation entity = new ResourceLocation(); entity.setPublicId(uri); entity.setLocation(uriLoc); catalog.addEntity(entity); @@ -355,12 +369,12 @@ public class XMLCatalogTest extends TestCase { String uriLoc = "etc/testcases/taskdefs/optional/xml/about.xml"; String base = null; try { - base = toURLString(project.getBaseDir()) + "src/"; + base = toURLString(project.getBaseDir()) + "/src/"; } catch (MalformedURLException ex) { fail (ex.toString()); } - DTDLocation entity = new DTDLocation(); + ResourceLocation entity = new ResourceLocation(); entity.setPublicId(uri); entity.setLocation(uriLoc); catalog.addEntity(entity); @@ -383,7 +397,7 @@ public class XMLCatalogTest extends TestCase { String dtdLoc = "testcases/taskdefs/optional/xml/doc.dtd"; String path1 = project.getBaseDir().toString() + "/src/etc"; - DTDLocation dtd = new DTDLocation(); + ResourceLocation dtd = new ResourceLocation(); dtd.setPublicId(publicId); dtd.setLocation(dtdLoc); catalog.addDTD(dtd); @@ -393,7 +407,7 @@ public class XMLCatalogTest extends TestCase { String uriLoc = "etc/testcases/taskdefs/optional/xml/about.xml"; String path2 = project.getBaseDir().toString() + "/src"; - DTDLocation entity = new DTDLocation(); + ResourceLocation entity = new ResourceLocation(); entity.setPublicId(uri); entity.setLocation(uriLoc); catalog.addEntity(entity); @@ -407,8 +421,8 @@ public class XMLCatalogTest extends TestCase { InputSource result = catalog.resolveEntity(publicId, "nap:chemical+brothers"); assertNotNull(result); - assertEquals(toURLString(dtdFile), - result.getSystemId()); + String resultStr = new URL(result.getSystemId()).getFile(); + assertTrue(toURLString(dtdFile).endsWith(resultStr)); } catch (Exception e) { fail("resolveEntity() failed!" + e.toString()); } @@ -416,8 +430,8 @@ public class XMLCatalogTest extends TestCase { try { Source result = catalog.resolve(uri, null); assertNotNull(result); - assertEquals(toURLString(xmlFile), - result.getSystemId()); + String resultStr = new URL(result.getSystemId()).getFile(); + assertTrue(toURLString(xmlFile).endsWith(resultStr)); } catch (Exception e) { fail("resolve() failed!" + e.toString()); }