Author: heiko.braun(a)jboss.com
Date: 2007-06-20 06:05:32 -0400 (Wed, 20 Jun 2007)
New Revision: 3647
Modified:
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/tools/ant/WSProvideTask.java
Log:
Align classloader with trunk version
Modified:
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/tools/ant/WSProvideTask.java
===================================================================
---
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/tools/ant/WSProvideTask.java 2007-06-20
10:04:44 UTC (rev 3646)
+++
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/tools/ant/WSProvideTask.java 2007-06-20
10:05:32 UTC (rev 3647)
@@ -35,6 +35,12 @@
import java.io.File;
import java.io.PrintStream;
+import java.net.URLClassLoader;
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.util.StringTokenizer;
+import java.util.List;
+import java.util.ArrayList;
/**
* Ant task which invokes provides a Web Service contract and portable JAX-WS wrapper
classes.
@@ -161,8 +167,28 @@
private ClassLoader getClasspathLoader(ClassLoader parent)
{
- AntClassLoader loader = new AntClassLoader(parent, getProject(), classpath, false);
- return loader;
+ AntClassLoader antLoader = new AntClassLoader(parent, getProject(), classpath, false);
+
+ // It's necessary to wrap it into an URLLoader in order to extract that
information
+ // within the actual provider impl.
+ // See SunRIProviderImpl for instance
+ List<URL> urls = new ArrayList<URL>();
+ StringTokenizer tok = new StringTokenizer(antLoader.getClasspath(), File.separator);
+ while(tok.hasMoreTokens())
+ {
+ try
+ {
+ urls.add(new URL(tok.nextToken()));
+ }
+ catch (MalformedURLException e)
+ {
+ throw new IllegalArgumentException("Failed to wrap classloader", e);
+ }
+
+ }
+
+ ClassLoader wrapper = new URLClassLoader(urls.toArray(new URL[0]), antLoader);
+ return wrapper;
}
public void executeNonForked()
@@ -265,4 +291,4 @@
if (execute.fork(this) != 0)
throw new BuildException("Could not invoke WSProvideTask",
getLocation());
}
-}
\ No newline at end of file
+}
Show replies by date