summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/src/ServiceLoader.java19
1 files changed, 18 insertions, 1 deletions
diff --git a/java/src/ServiceLoader.java b/java/src/ServiceLoader.java
index 540f72b07b7..86f15dc57c9 100644
--- a/java/src/ServiceLoader.java
+++ b/java/src/ServiceLoader.java
@@ -63,6 +63,23 @@ public class ServiceLoader extends ClassLoader
public Class loadClass (URL url, boolean resolve) throws ClassNotFoundException
{
Class newClass = null;
+
+ // Extract the name of the class from the URL
+
+ String className = url.getFile();
+
+ // Remove any directory information
+ int idx = className.lastIndexOf("/");
+ if (idx != -1)
+ className = className.substring(idx + 1);
+
+ // Get rid of the class suffix
+ idx = className.lastIndexOf(".class");
+ if (idx != -1)
+ className = className.substring(0, idx);
+
+ ACE.DEBUG("The name of the class about to load is " + className);
+
// Try to load it the class by reading in the bytes.
// Note that we are not catching ClassNotFoundException here
// since our caller will catch it.
@@ -81,7 +98,7 @@ public class ServiceLoader extends ClassLoader
// Now read all the data into the buffer
i.readFully (buf);
- newClass = defineClass (buf, 0, buf.length);
+ newClass = defineClass (className, buf, 0, buf.length);
// ACE.DEBUG ("Loaded class: "+ name);
// Check if we need to load other classes referred to by this class.