From 1e2699687e05e61e544410b0b57d2b6efbf1e272 Mon Sep 17 00:00:00 2001 From: Antoine Levy-Lambert Date: Fri, 21 Oct 2005 00:53:22 +0000 Subject: [PATCH] solve problem refering jars specfied by Class-Path attribute in manifest of a ant task jar file, when this ant task jar file is located in a directory with space. Bugzilla Report 37085. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@327056 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/tools/ant/AntClassLoaderTest.java | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/testcases/org/apache/tools/ant/AntClassLoaderTest.java b/src/testcases/org/apache/tools/ant/AntClassLoaderTest.java index fcc3c5791..d4036eeb8 100644 --- a/src/testcases/org/apache/tools/ant/AntClassLoaderTest.java +++ b/src/testcases/org/apache/tools/ant/AntClassLoaderTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2002,2004 The Apache Software Foundation + * Copyright 2000-2002,2004-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,24 +18,13 @@ package org.apache.tools.ant; import java.io.File; -import java.io.IOException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Enumeration; -import java.util.List; -import junit.framework.TestCase; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.util.FileUtils; /** * Test case for ant class loader * */ -public class AntClassLoaderTest extends TestCase { +public class AntClassLoaderTest extends BuildFileTest { private Project p; @@ -46,8 +35,24 @@ public class AntClassLoaderTest extends TestCase { public void setUp() { p = new Project(); p.init(); + configureProject("src/etc/testcases/core/antclassloader.xml"); + getProject().executeTarget("setup"); } + public void tearDown() { + getProject().executeTarget("cleanup"); + } + //test inspired by bug report 37085 + public void testJarWithManifestInDirWithSpace() { + String mainjarstring = getProject().getProperty("main.jar"); + String extjarstring = getProject().getProperty("ext.jar"); + Path myPath = new Path(getProject()); + myPath.setLocation(new File(mainjarstring)); + getProject().setUserProperty("build.sysclasspath","ignore"); + AntClassLoader myLoader = getProject().createClassLoader(myPath); + String path = myLoader.getClasspath(); + assertEquals(mainjarstring + File.pathSeparator + extjarstring, path); + } public void testCleanup() throws BuildException { Path path = new Path(p, "."); AntClassLoader loader = new AntClassLoader(p, path);