summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreea1 <eea1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-05-20 18:20:35 +0000
committereea1 <eea1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-05-20 18:20:35 +0000
commit2842b70e8ea58d1d514f0f634e39c87b84a02485 (patch)
tree27e29833ebe72cc84937c7003cb827aa741ff800
parent78314e8a1363f906259ddabfd650e92809507f22 (diff)
downloadATCD-2842b70e8ea58d1d514f0f634e39c87b84a02485.tar.gz
Removed the deprecation warning of defineClass in the loadClass
method for loading over a network. I did this by extracting the class name for the URL file name.
-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.