From deb32cf7bdf3fdd9713b91eb63c80eed2ae03977 Mon Sep 17 00:00:00 2001 From: Oliver Bolte Date: Mon, 12 Mar 2007 09:48:40 +0000 Subject: INTEGRATION: CWS sb36 (1.2.4); FILE MERGED 2006/03/14 14:33:15 sb 1.2.4.4: #i51803# Reverted additional ctor introduced in 1.4, which is not used until now, and is obsoleted by the classPath parameter of the other ctor; marked the class as internal again. 2006/03/13 10:38:08 sb 1.2.4.3: RESYNC: (1.3-1.4); FILE MERGED 2005/09/22 04:13:04 sb 1.2.4.2: RESYNC: (1.2-1.3); FILE MERGED 2005/07/11 13:24:40 sb 1.2.4.1: #i51803# Changed parameters of UnoClassLoader ctor, to specifiy a per-UnoClassLoader classpath. --- .../com/sun/star/lib/unoloader/UnoClassLoader.java | 62 +++++++++------------- 1 file changed, 25 insertions(+), 37 deletions(-) diff --git a/ridljar/source/unoloader/com/sun/star/lib/unoloader/UnoClassLoader.java b/ridljar/source/unoloader/com/sun/star/lib/unoloader/UnoClassLoader.java index 304cd3510f42..82e83cdd159d 100644 --- a/ridljar/source/unoloader/com/sun/star/lib/unoloader/UnoClassLoader.java +++ b/ridljar/source/unoloader/com/sun/star/lib/unoloader/UnoClassLoader.java @@ -4,9 +4,9 @@ * * $RCSfile: UnoClassLoader.java,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: obo $ $Date: 2006-01-20 10:10:25 $ + * last change: $Author: obo $ $Date: 2007-03-12 10:48:40 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -56,7 +56,8 @@ import java.util.jar.JarInputStream; * types, and any additional UNO types introduced by components; for the latter, * {@link #addURL} may be necessary).

* - *

This class is not yet stable.

+ *

This is an internal, unstable class of the Uno Runtime Environment; it + * should not be used by client code.

* * @since UDK 3.2.0 */ @@ -68,48 +69,20 @@ public final class UnoClassLoader extends URLClassLoader { * (java_uno.jar, juh.jar, jurt.jar, * ridl.jar) can be found; must not be null. * - * @param parent the parent class loader for delegation. - * - * @throws MalformedURLException if the given base URL is - * malformed. - */ - public UnoClassLoader(URL base, ClassLoader parent) - throws MalformedURLException - { - //TODO Get rid of java_uno.jar here: - super( - new URL[] { - new URL(base, "java_uno.jar"), new URL(base, "juh.jar"), - new URL(base, "jurt.jar"), new URL(base, "ridl.jar") }, - parent); - } - - /** - * Instantiates the root UNO class loader, passing it locations of - * additional UNO types. - * - * @param base a base URL relative to which the URE JARs - * (java_uno.jar, juh.jar, jurt.jar, - * ridl.jar) can be found; must not be null. + * @param classPath an array of URLs that form the class path of this class + * loader; may be null, which is the same as an empty array. + * The URLs are interpreted in the same way as the arguments of a {@link + * URLClassLoader}. * * @param parent the parent class loader for delegation. * - * @param extraTypes a (possibly empty) array of URLs through which Java - * classes representing additional UNO types can be found; must not be - * null. - * * @throws MalformedURLException if the given base URL is * malformed. - * - * @since UDK 3.2.2 */ - public UnoClassLoader(URL base, ClassLoader parent, URL[] extraTypes) + public UnoClassLoader(URL base, URL[] classPath, ClassLoader parent) throws MalformedURLException { - this(base, parent); - for (int i = 0; i < extraTypes.length; ++i) { - addURL(extraTypes[i]); - } + super(createUrls(base, classPath), parent); } /** @@ -231,4 +204,19 @@ public final class UnoClassLoader extends URLClassLoader { } return mf == null ? null : mf.getMainAttributes(); } + + private static URL[] createUrls(URL base, URL[] classPath) + throws MalformedURLException + { + final int JARS = 4; + URL[] urls = new URL[JARS + (classPath == null ? 0 : classPath.length)]; + urls[0] = new URL(base, "java_uno.jar"); //TODO get rid of it here + urls[1] = new URL(base, "juh.jar"); + urls[2] = new URL(base, "jurt.jar"); + urls[3] = new URL(base, "ridl.jar"); + if (classPath != null) { + System.arraycopy(classPath, 0, urls, JARS, classPath.length); + } + return urls; + } } -- cgit