summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2005-06-17 08:58:03 +0000
committerOliver Bolte <obo@openoffice.org>2005-06-17 08:58:03 +0000
commit5477fd2dce5b3a86fe654b43aa84fee814cf948a (patch)
treee8e12b8707771a7d94d853c41338c13f8a1959be
parentf2eb9faff7b351a9b99fb9a3c69e6d8e4ede9779 (diff)
INTEGRATION: CWS sb31 (1.7.30); FILE MERGED
2005/04/21 13:37:31 sb 1.7.30.2: #120220# Adapted to reworked unoloader.jar. 2005/04/07 12:03:29 sb 1.7.30.1: #120220# Load Java UNO components with a class loader that inherits from the UnoClassLoader, and make sure that any (Java classes representing) additional UNO types that a UNO component brings with it are found by the UnoClassLoader (the latter still needs TODO).
-rw-r--r--jurt/com/sun/star/comp/loader/RegistrationClassFinder.java25
1 files changed, 15 insertions, 10 deletions
diff --git a/jurt/com/sun/star/comp/loader/RegistrationClassFinder.java b/jurt/com/sun/star/comp/loader/RegistrationClassFinder.java
index a3f0f7b40a25..c430513f3ab6 100644
--- a/jurt/com/sun/star/comp/loader/RegistrationClassFinder.java
+++ b/jurt/com/sun/star/comp/loader/RegistrationClassFinder.java
@@ -2,9 +2,9 @@
*
* $RCSfile: RegistrationClassFinder.java,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: rt $ $Date: 2004-07-23 14:43:52 $
+ * last change: $Author: obo $ $Date: 2005-06-17 09:58:03 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -61,14 +61,14 @@
package com.sun.star.comp.loader;
+import com.sun.star.lib.unoloader.UnoClassLoader;
import com.sun.star.lib.util.WeakMap;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.StringTokenizer;
-import java.util.jar.JarInputStream;
-import java.util.jar.Manifest;
+import java.util.jar.Attributes;
final class RegistrationClassFinder {
public static Class find(String locationUrl)
@@ -82,15 +82,20 @@ final class RegistrationClassFinder {
}
URL url = new URL(locationUrl);
checkAccess(url);
- String name = null;
- Manifest mf = new JarInputStream(url.openStream()).getManifest();
- if (mf != null) {
- name = mf.getMainAttributes().getValue("RegistrationClassName");
- }
+ Attributes attr = UnoClassLoader.getJarMainAttributes(url);
+ String name = attr == null
+ ? null : attr.getValue("RegistrationClassName");
if (name == null) {
return null;
}
- Class c = new URLClassLoader(new URL[] { url }).loadClass(name);
+ ClassLoader cl1 = RegistrationClassFinder.class.getClassLoader();
+ ClassLoader cl2;
+ if (cl1 instanceof UnoClassLoader) {
+ cl2 = ((UnoClassLoader) cl1).getClassLoader(url, attr);
+ } else {
+ cl2 = URLClassLoader.newInstance(new URL[] { url }, cl1);
+ }
+ Class c = cl2.loadClass(name);
synchronized (map) {
Class c2 = (Class) WeakMap.getValue(map.get(locationUrl));
if (c2 != null) {