[Libreoffice-commits] core.git: javaunohelper/com javaunohelper/Jar_juh.mk odk/Package_javadoc.mk odk/source

Stephan Bergmann sbergman at redhat.com
Thu Aug 29 03:09:33 PDT 2013


 javaunohelper/Jar_juh.mk                            |    1 
 javaunohelper/com/sun/star/comp/helper/UnoInfo.java |  107 --------------------
 odk/Package_javadoc.mk                              |    2 
 odk/source/com/sun/star/lib/loader/Loader.java      |   50 ---------
 4 files changed, 1 insertion(+), 159 deletions(-)

New commits:
commit 617c5e44e13eb12dd58559289bc83def9f2b77e9
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Aug 29 11:40:11 2013 +0200

    [API CHANGE] Remove obsolete com.sun.star.comp.helper.UnoInfo
    
    It had originally been used in the SDK's "Simple Bootstrap" for Java,
    com.sun.star.lib.loader.Loader class, but only left in there for backwards
    compatibility with pre--three-layer OOo versions (i.e., < OOo 3) when that
    Loader was switched to use the unoinfo executable with the fix for #i88687#
    "C++/Java Simple Bootstrap broken" in e2b7ea631a5e7297346ec826527a019e2baca020
    "INTEGRATION: CWS sb87 (1.5.10); FILE MERGED: 2008/05/07 11:34:25 sb
    1.5.10.1: #i88687# let Loader call new unoinfo instead of old juh.jar
    UnoInfo.getJars."
    
    Recent work in AOO to undo three-layer caused AOO to now accidentally use the
    backwards-compatibility code, so AOO ran into a problem that they solved with a
    change to com.sun.star.comp.helper.UnoInfo that LO erroneously merged in as
    95ada2d65f6d999920f2a04599ac132fa632d66d "Related: #i122483# set correct
    classpath, include unoil.jar."
    
    The better approach is to get rid of that backwards-compatibility code and
    remove the obsolete UnoInfo class.  While this is nominally incompatible, in
    practice no other client code but the SDK's com.sun.star.lib.loader.Loader
    should ever have used it (it should have been designed as a private interface
    for just that one client from the start, anyway).  Java applications using
    "Simple Bootstrap" and built against old versions of the SDK (post the fix
    for #i88687# and its introduction of the unoinfo exectuable in OOo 3) will
    continue to work against new LO versions (as the backwards-compatibility code
    that would call the removed UnoInfo class will not be triggered anyway; and even
    if it were, all resulting exceptions would be caught and the new code path using
    the unoinfo executable be chosen then).  Likewise, Java applications using
    "Simple Bootstrap" and built against the new SDK will continue to work against
    old OOo/LO/AOO vesions as far back as the fix for #i88687# and its introduction
    of the unoinfo exectuable in OOo 3.
    
    Change-Id: I64824ed002c3ccdf6912eab67499beb0c423081e

diff --git a/javaunohelper/Jar_juh.mk b/javaunohelper/Jar_juh.mk
index a4f1f4c..32f7449 100644
--- a/javaunohelper/Jar_juh.mk
+++ b/javaunohelper/Jar_juh.mk
@@ -26,7 +26,6 @@ $(eval $(call gb_Jar_add_sourcefiles,juh,\
     javaunohelper/com/sun/star/comp/helper/ComponentContext \
     javaunohelper/com/sun/star/comp/helper/ComponentContextEntry \
     javaunohelper/com/sun/star/comp/helper/SharedLibraryLoader \
-    javaunohelper/com/sun/star/comp/helper/UnoInfo \
     javaunohelper/com/sun/star/lib/uno/adapter/ByteArrayToXInputStreamAdapter \
     javaunohelper/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter \
     javaunohelper/com/sun/star/lib/uno/adapter/OutputStreamToXOutputStreamAdapter \
diff --git a/javaunohelper/com/sun/star/comp/helper/UnoInfo.java b/javaunohelper/com/sun/star/comp/helper/UnoInfo.java
deleted file mode 100644
index 67a3594..0000000
--- a/javaunohelper/com/sun/star/comp/helper/UnoInfo.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package com.sun.star.comp.helper;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-
-/**
- * UnoInfo offers functionality to obtain the UNO jar files.
- */
-public final class UnoInfo {
-
-    /**
-     * do not instantiate
-     */
-    private UnoInfo() {}
-
-    /**
-     * Gets the URL base.
-     *
-     * @return the URL base
-     */
-    private static String getBase() {
-
-        final String JUHJAR = "/juh.jar";
-
-        String base = null;
-
-        URLClassLoader cl = (URLClassLoader) UnoInfo.class.getClassLoader();
-        URL[] urls = cl.getURLs();
-        for ( int i = 0; i < urls.length; i++ ) {
-            String url = urls[i].toString();
-            if ( url.endsWith( JUHJAR ) )
-            {
-                int index = url.lastIndexOf( JUHJAR );
-                if ( index >= 0 ) {
-                    base = url.substring( 0, index + 1 );
-                    break;
-                }
-            }
-        }
-
-        return base;
-    }
-
-    /**
-     * Gets a list of URLs for the given jar files.
-     *
-     * @return the list of URLs
-     */
-    private static URL[] getURLs( String[] jarFileNames ) {
-
-        URL[] jars = new URL[jarFileNames.length];
-        String base = getBase();
-        for ( int i = 0; i < jarFileNames.length; i++ ) {
-            try {
-                jars[i] = new URL( base + jarFileNames[i] );
-            } catch ( MalformedURLException e ) {
-                return null;
-            }
-        }
-
-        return jars;
-    }
-
-    /**
-     * Gets the UNO jar files.
-     *
-     * @return the UNO jar files
-     */
-    public static URL[] getJars() {
-
-        String[] jarFileNames = new String[] {
-            "jurt.jar",
-            "ridl.jar",
-            "juh.jar",
-            "unoil.jar" };
-
-        return getURLs( jarFileNames );
-    }
-
-    /**
-     * Gets the extra UNO types.
-     *
-     * @return the extra UNO types
-     */
-    public static URL[] getExtraTypes() {
-        return new URL[0];
-    }
-}
diff --git a/odk/Package_javadoc.mk b/odk/Package_javadoc.mk
index 7b1007c..15b0691 100644
--- a/odk/Package_javadoc.mk
+++ b/odk/Package_javadoc.mk
@@ -19,13 +19,11 @@ $(eval $(call gb_Package_add_files_with_dir,odk_javadoc,$(gb_Package_SDKDIRNAME)
 	com/sun/star/comp/helper/ComponentContext.html \
 	com/sun/star/comp/helper/ComponentContextEntry.html \
 	com/sun/star/comp/helper/SharedLibraryLoader.html \
-	com/sun/star/comp/helper/UnoInfo.html \
 	com/sun/star/comp/helper/class-use/Bootstrap.html \
 	com/sun/star/comp/helper/class-use/BootstrapException.html \
 	com/sun/star/comp/helper/class-use/ComponentContext.html \
 	com/sun/star/comp/helper/class-use/ComponentContextEntry.html \
 	com/sun/star/comp/helper/class-use/SharedLibraryLoader.html \
-	com/sun/star/comp/helper/class-use/UnoInfo.html \
 	com/sun/star/comp/helper/package-frame.html \
 	com/sun/star/comp/helper/package-summary.html \
 	com/sun/star/comp/helper/package-tree.html \
diff --git a/odk/source/com/sun/star/lib/loader/Loader.java b/odk/source/com/sun/star/lib/loader/Loader.java
index a11937d..d6b67b7 100644
--- a/odk/source/com/sun/star/lib/loader/Loader.java
+++ b/odk/source/com/sun/star/lib/loader/Loader.java
@@ -22,7 +22,6 @@ import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
-import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.net.JarURLConnection;
 import java.net.MalformedURLException;
@@ -137,10 +136,6 @@ public final class Loader {
      * @return the customized class loader
      */
     public static synchronized ClassLoader getCustomLoader() {
-
-        final String CLASSESDIR = "classes";
-        final String JUHJAR = "juh.jar";
-
         if ( m_Loader == null ) {
 
             // get the urls from which to load classes and resources
@@ -164,50 +159,7 @@ public final class Loader {
             // from the UNO installation
             String path = InstallationFinder.getPath();
             if ( path != null ) {
-                File fClassesDir = new File( path, CLASSESDIR );
-                File fJuh = new File( fClassesDir, JUHJAR );
-                if ( fJuh.exists() ) {
-                    URL[] clurls = new URL[1];
-                    try {
-                        clurls[0] = fJuh.toURI().toURL();
-                        ClassLoader cl = new CustomURLClassLoader( clurls );
-                        Class c = cl.loadClass(
-                            "com.sun.star.comp.helper.UnoInfo" );
-                        Method m = c.getMethod( "getJars", (Class[]) null );
-                        URL[] jarurls = (URL[]) m.invoke(
-                            null, (Object[]) null );
-                        for ( int i = 0; i < jarurls.length; i++ ) {
-                            vec.add( jarurls[i] );
-                        }
-                    } catch ( MalformedURLException e ) {
-                        // don't add the UNO jar files to the list of class
-                        // loader URLs
-                        System.err.println( "com.sun.star.lib.loader.Loader::" +
-                            "getCustomLoader: cannot add UNO jar files: " + e );
-                    } catch ( ClassNotFoundException e ) {
-                        // don't add the UNO jar files to the list of class
-                        // loader URLs
-                        System.err.println( "com.sun.star.lib.loader.Loader::" +
-                            "getCustomLoader: cannot add UNO jar files: " + e );
-                    } catch ( NoSuchMethodException e ) {
-                        // don't add the UNO jar files to the list of class
-                        // loader URLs
-                        System.err.println( "com.sun.star.lib.loader.Loader::" +
-                            "getCustomLoader: cannot add UNO jar files: " + e );
-                    } catch ( IllegalAccessException e ) {
-                        // don't add the UNO jar files to the list of class
-                        // loader URLs
-                        System.err.println( "com.sun.star.lib.loader.Loader::" +
-                            "getCustomLoader: cannot add UNO jar files: " + e );
-                    } catch ( InvocationTargetException e ) {
-                        // don't add the UNO jar files to the list of class
-                        // loader URLs
-                        System.err.println( "com.sun.star.lib.loader.Loader::" +
-                            "getCustomLoader: cannot add UNO jar files: " + e );
-                    }
-                } else {
-                    callUnoinfo(path, vec);
-                }
+                callUnoinfo(path, vec);
             } else {
                 System.err.println( "com.sun.star.lib.loader.Loader::" +
                     "getCustomLoader: no UNO installation found!" );


More information about the Libreoffice-commits mailing list