8064956: Remove sun.misc.ExtensionInstallationProvider and relevant classes
authorbchristi
Thu, 11 Jun 2015 10:38:29 -0700
changeset 31085 9bde92d55eae
parent 31084 0acb07ceb0bc
child 31086 d24a2c340a47
child 31142 8e60d9bab54b
child 31148 dc8c166a52ef
8064956: Remove sun.misc.ExtensionInstallationProvider and relevant classes Reviewed-by: mchung, alanb
jdk/src/java.base/share/classes/sun/misc/ExtensionDependency.java
jdk/src/java.base/share/classes/sun/misc/ExtensionInfo.java
jdk/src/java.base/share/classes/sun/misc/ExtensionInstallationException.java
jdk/src/java.base/share/classes/sun/misc/ExtensionInstallationProvider.java
--- a/jdk/src/java.base/share/classes/sun/misc/ExtensionDependency.java	Thu Jun 11 17:29:09 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,554 +0,0 @@
-/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.misc;
-
-import java.io.File;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.io.FileNotFoundException;
-import java.util.StringTokenizer;
-import java.util.Vector;
-import java.util.Enumeration;
-import java.util.jar.JarFile;
-import java.util.jar.Manifest;
-import java.util.jar.Attributes;
-import java.util.jar.Attributes.Name;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedExceptionAction;
-import java.security.PrivilegedActionException;
-import java.net.URL;
-import java.net.MalformedURLException;
-import sun.net.www.ParseUtil;
-
-/**
- * This class checks dependent extensions a particular jar file may have
- * declared through its manifest attributes.
- * <p>
- * Jar file declared dependent extensions through the extension-list
- * attribute. The extension-list contains a list of keys used to
- * fetch the other attributes describing the required extension.
- * If key is the extension key declared in the extension-list
- * attribute, the following describing attribute can be found in
- * the manifest:
- * <ul>
- * <li>key-Extension-Name:  (Specification package name)</li>
- * <li>key-Specification-Version: (Specification-Version)</li>
- * <li>key-Implementation-Version: (Implementation-Version)</li>
- * <li>key-Implementation-Vendor-Id: (Imlementation-Vendor-Id)</li>
- * <li>key-Implementation-Version: (Implementation version)</li>
- * <li>key-Implementation-URL: (URL to download the requested extension)</li>
- * </ul>
- * <p>
- * This class also maintain versioning consistency of installed
- * extensions dependencies declared in jar file manifest.
- *
- * @deprecated this class will be removed in a future release.
- * @author  Jerome Dochez
- */
-@Deprecated
-public class ExtensionDependency {
-
-    /* Callbak interfaces to delegate installation of missing extensions */
-    private static Vector<ExtensionInstallationProvider> providers;
-
-    /**
-     * Register an ExtensionInstallationProvider. The provider is responsible
-     * for handling the installation (upgrade) of any missing extensions.
-     *
-     * @param eip ExtensionInstallationProvider implementation
-     */
-    public synchronized static void addExtensionInstallationProvider
-        (ExtensionInstallationProvider eip)
-    {
-        if (providers == null) {
-            providers = new Vector<>();
-        }
-        providers.add(eip);
-    }
-
-    /**
-     * Unregister a previously installed installation provider
-     */
-    public synchronized static void removeExtensionInstallationProvider
-        (ExtensionInstallationProvider eip)
-    {
-        providers.remove(eip);
-    }
-
-    /**
-     * Checks the dependencies of the jar file on installed extension.
-     *
-     * @param jar containing the attributes declaring the dependencies
-     */
-    public static boolean checkExtensionsDependencies(JarFile jar)
-    {
-        if (providers == null) {
-            // no need to bother, nobody is registered to install missing
-            // extensions
-            return true;
-        }
-
-        try {
-            ExtensionDependency extDep = new ExtensionDependency();
-            return extDep.checkExtensions(jar);
-        } catch (ExtensionInstallationException e) {
-            debug(e.getMessage());
-        }
-        return false;
-    }
-
-    /*
-     * Check for all declared required extensions in the jar file
-     * manifest.
-     */
-    protected boolean checkExtensions(JarFile jar)
-        throws ExtensionInstallationException
-    {
-        Manifest man;
-        try {
-            man = jar.getManifest();
-        } catch (IOException e) {
-            return false;
-        }
-
-        if (man == null) {
-            // The applet does not define a manifest file, so
-            // we just assume all dependencies are satisfied.
-            return true;
-        }
-
-        boolean result = true;
-        Attributes attr = man.getMainAttributes();
-        if (attr != null) {
-            // Let's get the list of declared dependencies
-            String value = attr.getValue(Name.EXTENSION_LIST);
-            if (value != null) {
-                StringTokenizer st = new StringTokenizer(value);
-                // Iterate over all declared dependencies
-                while (st.hasMoreTokens()) {
-                    String extensionName = st.nextToken();
-                    debug("The file " + jar.getName() +
-                          " appears to depend on " + extensionName);
-                    // Sanity Check
-                    String extName = extensionName + "-" +
-                        Name.EXTENSION_NAME.toString();
-                    if (attr.getValue(extName) == null) {
-                        debug("The jar file " + jar.getName() +
-                              " appers to depend on "
-                              + extensionName + " but does not define the " +
-                              extName + " attribute in its manifest ");
-
-                    } else {
-                        if (!checkExtension(extensionName, attr)) {
-                            debug("Failed installing " + extensionName);
-                            result = false;
-                        }
-                    }
-                }
-            } else {
-                debug("No dependencies for " + jar.getName());
-            }
-        }
-        return result;
-    }
-
-
-    /*
-     * Check that a particular dependency on an extension is satisfied.
-     *
-     * @param extensionName is the key used for the attributes in the manifest
-     * @param attr is the attributes of the manifest file
-     *
-     * @return true if the dependency is satisfied by the installed extensions
-     */
-    protected synchronized boolean checkExtension(final String extensionName,
-                                     final Attributes attr)
-        throws ExtensionInstallationException
-    {
-        debug("Checking extension " + extensionName);
-        if (checkExtensionAgainstInstalled(extensionName, attr))
-            return true;
-
-        debug("Extension not currently installed ");
-        ExtensionInfo reqInfo = new ExtensionInfo(extensionName, attr);
-        return installExtension(reqInfo, null);
-    }
-
-    /*
-     * Check if a particular extension is part of the currently installed
-     * extensions.
-     *
-     * @param extensionName is the key for the attributes in the manifest
-     * @param attr is the attributes of the manifest
-     *
-     * @return true if the requested extension is already installed
-     */
-    boolean checkExtensionAgainstInstalled(String extensionName,
-                                           Attributes attr)
-        throws ExtensionInstallationException
-    {
-        File fExtension = checkExtensionExists(extensionName);
-
-        if (fExtension != null) {
-        // Extension already installed, just check against this one
-            try {
-                if (checkExtensionAgainst(extensionName, attr, fExtension))
-                    return true;
-            } catch (FileNotFoundException e) {
-                debugException(e);
-            } catch (IOException e) {
-                debugException(e);
-            }
-            return false;
-
-        } else {
-        // Not sure if extension is already installed, so check all the
-        // installed extension jar files to see if we get a match
-
-            File[] installedExts;
-
-            try {
-            // Get the list of installed extension jar files so we can
-            // compare the installed versus the requested extension
-                installedExts = getInstalledExtensions();
-            } catch(IOException e) {
-                debugException(e);
-                return false;
-            }
-
-            for (int i=0;i<installedExts.length;i++) {
-                try {
-                    if (checkExtensionAgainst(extensionName, attr, installedExts[i]))
-                        return true;
-                } catch (FileNotFoundException e) {
-                    debugException(e);
-                } catch (IOException e) {
-                    debugException(e);
-                    // let's continue with the next installed extension
-                }
-            }
-        }
-        return false;
-    }
-
-    /*
-     * Check if the requested extension described by the attributes
-     * in the manifest under the key extensionName is compatible with
-     * the jar file.
-     *
-     * @param extensionName key in the attribute list
-     * @param attr manifest file attributes
-     * @param file installed extension jar file to compare the requested
-     * extension against.
-     */
-    protected boolean checkExtensionAgainst(String extensionName,
-                                            Attributes attr,
-                                            final File file)
-        throws IOException,
-               FileNotFoundException,
-               ExtensionInstallationException
-    {
-
-        debug("Checking extension " + extensionName +
-              " against " + file.getName());
-
-        // Load the jar file ...
-        Manifest man;
-        try {
-            man = AccessController.doPrivileged(
-                new PrivilegedExceptionAction<Manifest>() {
-                    public Manifest run()
-                            throws IOException, FileNotFoundException {
-                         if (!file.exists())
-                             throw new FileNotFoundException(file.getName());
-                         JarFile jarFile =  new JarFile(file);
-                         return jarFile.getManifest();
-                     }
-                 });
-        } catch(PrivilegedActionException e) {
-            if (e.getException() instanceof FileNotFoundException)
-                throw (FileNotFoundException) e.getException();
-            throw (IOException) e.getException();
-        }
-
-        // Construct the extension information object
-        ExtensionInfo reqInfo = new ExtensionInfo(extensionName, attr);
-        debug("Requested Extension : " + reqInfo);
-
-        int isCompatible = ExtensionInfo.INCOMPATIBLE;
-        ExtensionInfo instInfo = null;
-
-        if (man != null) {
-            Attributes instAttr = man.getMainAttributes();
-            if (instAttr != null) {
-                instInfo = new ExtensionInfo(null, instAttr);
-                debug("Extension Installed " + instInfo);
-                isCompatible = instInfo.isCompatibleWith(reqInfo);
-                switch(isCompatible) {
-                case ExtensionInfo.COMPATIBLE:
-                    debug("Extensions are compatible");
-                    return true;
-
-                case ExtensionInfo.INCOMPATIBLE:
-                    debug("Extensions are incompatible");
-                    return false;
-
-                default:
-                    // everything else
-                    debug("Extensions require an upgrade or vendor switch");
-                    return installExtension(reqInfo, instInfo);
-
-                }
-            }
-        }
-        return false;
-    }
-
-    /*
-     * An required extension is missing, if an ExtensionInstallationProvider is
-     * registered, delegate the installation of that particular extension to it.
-     *
-     * @param reqInfo Missing extension information
-     * @param instInfo Older installed version information
-     *
-     * @return true if the installation is successful
-     */
-    protected boolean installExtension(ExtensionInfo reqInfo,
-                                       ExtensionInfo instInfo)
-        throws ExtensionInstallationException
-    {
-        Vector<ExtensionInstallationProvider> currentProviders;
-        synchronized(providers) {
-            @SuppressWarnings("unchecked")
-            Vector<ExtensionInstallationProvider> tmp =
-                (Vector<ExtensionInstallationProvider>) providers.clone();
-            currentProviders = tmp;
-        }
-        for (Enumeration<ExtensionInstallationProvider> e = currentProviders.elements();
-                e.hasMoreElements();) {
-            ExtensionInstallationProvider eip = e.nextElement();
-
-            if (eip!=null) {
-                // delegate the installation to the provider
-                if (eip.installExtension(reqInfo, instInfo)) {
-                    debug(reqInfo.name + " installation successful");
-                    Launcher.ExtClassLoader cl = (Launcher.ExtClassLoader)
-                        Launcher.getLauncher().getClassLoader().getParent();
-                    addNewExtensionsToClassLoader(cl);
-                    return true;
-                }
-            }
-        }
-        // We have tried all of our providers, noone could install this
-        // extension, we just return failure at this point
-        debug(reqInfo.name + " installation failed");
-        return false;
-    }
-
-    /**
-     * Checks if the extension, that is specified in the extension-list in
-     * the applet jar manifest, is already installed (i.e. exists in the
-     * extension directory).
-     *
-     * @param extensionName extension name in the extension-list
-     *
-     * @return the extension if it exists in the extension directory
-     */
-    private File checkExtensionExists(String extensionName) {
-        // Function added to fix bug 4504166
-        final String extName = extensionName;
-        final String[] fileExt = {".jar", ".zip"};
-
-        return AccessController.doPrivileged(
-            new PrivilegedAction<File>() {
-                public File run() {
-                    try {
-                        File fExtension;
-                        File[] dirs = getExtDirs();
-
-                        // Search the extension directories for the extension that is specified
-                        // in the attribute extension-list in the applet jar manifest
-                        for (int i=0;i<dirs.length;i++) {
-                            for (int j=0;j<fileExt.length;j++) {
-                                if (extName.toLowerCase().endsWith(fileExt[j])) {
-                                    fExtension = new File(dirs[i], extName);
-                                } else {
-                                    fExtension = new File(dirs[i], extName+fileExt[j]);
-                                }
-                                debug("checkExtensionExists:fileName " + fExtension.getName());
-                                if (fExtension.exists()) {
-                                    return fExtension;
-                                }
-                            }
-                        }
-                        return null;
-
-                    } catch(Exception e) {
-                         debugException(e);
-                         return null;
-                    }
-                }
-            });
-    }
-
-    /**
-     * @return the java.ext.dirs property as a list of directory
-     */
-    private static File[] getExtDirs() {
-        String s = java.security.AccessController.doPrivileged(
-                new sun.security.action.GetPropertyAction("java.ext.dirs"));
-
-        File[] dirs;
-        if (s != null) {
-            StringTokenizer st =
-                new StringTokenizer(s, File.pathSeparator);
-            int count = st.countTokens();
-            debug("getExtDirs count " + count);
-            dirs = new File[count];
-            for (int i = 0; i < count; i++) {
-                dirs[i] = new File(st.nextToken());
-                debug("getExtDirs dirs["+i+"] "+ dirs[i]);
-            }
-        } else {
-            dirs = new File[0];
-            debug("getExtDirs dirs " + dirs);
-        }
-        debug("getExtDirs dirs.length " + dirs.length);
-        return dirs;
-    }
-
-    /*
-     * Scan the directories and return all files installed in those
-     *
-     * @param dirs list of directories to scan
-     *
-     * @return the list of files installed in all the directories
-     */
-    private static File[] getExtFiles(File[] dirs) throws IOException {
-        Vector<File> urls = new Vector<File>();
-        for (int i = 0; i < dirs.length; i++) {
-            String[] files = dirs[i].list(new JarFilter());
-            if (files != null) {
-                debug("getExtFiles files.length " + files.length);
-                for (int j = 0; j < files.length; j++) {
-                    File f = new File(dirs[i], files[j]);
-                    urls.add(f);
-                    debug("getExtFiles f["+j+"] "+ f);
-                }
-            }
-        }
-        File[] ua = new File[urls.size()];
-        urls.copyInto(ua);
-        debug("getExtFiles ua.length " + ua.length);
-        return ua;
-    }
-
-    /*
-     * @return the list of installed extensions jar files
-     */
-    private File[] getInstalledExtensions() throws IOException {
-        return AccessController.doPrivileged(
-            new PrivilegedAction<File[]>() {
-                public File[] run() {
-                     try {
-                         return getExtFiles(getExtDirs());
-                     } catch(IOException e) {
-                         debug("Cannot get list of installed extensions");
-                         debugException(e);
-                        return new File[0];
-                     }
-                 }
-            });
-    }
-
-    /*
-     * Add the newly installed jar file to the extension class loader.
-     *
-     * @param cl the current installed extension class loader
-     *
-     * @return true if successful
-     */
-    private Boolean addNewExtensionsToClassLoader(Launcher.ExtClassLoader cl) {
-        try {
-            File[] installedExts = getInstalledExtensions();
-            for (int i=0;i<installedExts.length;i++) {
-                final File instFile = installedExts[i];
-                URL instURL = AccessController.doPrivileged(
-                    new PrivilegedAction<URL>() {
-                        public URL run() {
-                            try {
-                                return ParseUtil.fileToEncodedURL(instFile);
-                            } catch (MalformedURLException e) {
-                                debugException(e);
-                                return null;
-                            }
-                        }
-                    });
-                if (instURL != null) {
-                    URL[] urls = cl.getURLs();
-                    boolean found=false;
-                    for (int j = 0; j<urls.length; j++) {
-                        debug("URL["+j+"] is " + urls[j] + " looking for "+
-                                           instURL);
-                        if (urls[j].toString().compareToIgnoreCase(
-                                    instURL.toString())==0) {
-                            found=true;
-                            debug("Found !");
-                        }
-                    }
-                    if (!found) {
-                        debug("Not Found ! adding to the classloader " +
-                              instURL);
-                        cl.addExtURL(instURL);
-                    }
-                }
-            }
-        } catch (MalformedURLException e) {
-            e.printStackTrace();
-        } catch (IOException e) {
-            e.printStackTrace();
-            // let's continue with the next installed extension
-        }
-        return Boolean.TRUE;
-    }
-
-    // True to display all debug and trace messages
-    static final boolean DEBUG = false;
-
-    private static void debug(String s) {
-        if (DEBUG) {
-            System.err.println(s);
-        }
-    }
-
-    private void debugException(Throwable e) {
-        if (DEBUG) {
-            e.printStackTrace();
-        }
-    }
-
-}
--- a/jdk/src/java.base/share/classes/sun/misc/ExtensionInfo.java	Thu Jun 11 17:29:09 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,407 +0,0 @@
-/*
- * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.misc;
-
-import java.util.StringTokenizer;
-import java.util.jar.Attributes;
-import java.util.jar.Attributes.Name;
-import java.util.ResourceBundle;
-import java.util.MissingResourceException;
-import java.text.MessageFormat;
-import java.lang.Character.*;
-
-
-/**
- * This class holds all necessary information to install or
- * upgrade a extension on the user's disk
- *
- * @deprecated this class will be removed in a future release.
- * @author  Jerome Dochez
- */
-@Deprecated
-public class ExtensionInfo {
-
-    /**
-     * public static values returned by the isCompatible method
-     */
-    public static final int COMPATIBLE = 0;
-    public static final int REQUIRE_SPECIFICATION_UPGRADE = 1;
-    public static final int REQUIRE_IMPLEMENTATION_UPGRADE = 2;
-    public static final int REQUIRE_VENDOR_SWITCH = 3;
-    public static final int INCOMPATIBLE = 4;
-
-    /**
-     * attributes fully describer an extension. The underlying described
-     * extension may be installed and requested.
-     */
-    public String title;
-    public String name;
-    public String specVersion;
-    public String specVendor;
-    public String implementationVersion;
-    public String vendor;
-    public String vendorId;
-    public String url;
-
-    // For I18N support
-    private static final ResourceBundle rb =
-        ResourceBundle.getBundle("sun.misc.resources.Messages");
-
-
-    /**
-     * Create a new uninitialized extension information object
-     */
-    public ExtensionInfo() {
-    }
-
-    /**
-     * Create and initialize an extension information object.
-     * The initialization uses the attributes passed as being
-     * the content of a manifest file to load the extension
-     * information from.
-     * Since manifest file may contain information on several
-     * extension they may depend on, the extension key parameter
-     * is prepanded to the attribute name to make the key used
-     * to retrieve the attribute from the manifest file
-     *
-     * @param extensionKey unique extension key in the manifest
-     * @param attr Attributes of a manifest file
-     */
-    public ExtensionInfo(String extensionKey, Attributes attr)
-        throws NullPointerException
-    {
-        String s;
-        if (extensionKey!=null) {
-            s = extensionKey + "-";
-        } else {
-            s ="";
-        }
-
-        String attrKey = s + Name.EXTENSION_NAME.toString();
-        name = attr.getValue(attrKey);
-        if (name != null)
-            name = name.trim();
-
-        attrKey = s + Name.SPECIFICATION_TITLE.toString();
-        title = attr.getValue(attrKey);
-        if (title != null)
-            title = title.trim();
-
-        attrKey = s + Name.SPECIFICATION_VERSION.toString();
-        specVersion = attr.getValue(attrKey);
-        if (specVersion != null)
-            specVersion = specVersion.trim();
-
-        attrKey = s + Name.SPECIFICATION_VENDOR.toString();
-        specVendor = attr.getValue(attrKey);
-        if (specVendor != null)
-            specVendor = specVendor.trim();
-
-        attrKey = s + Name.IMPLEMENTATION_VERSION.toString();
-        implementationVersion = attr.getValue(attrKey);
-        if (implementationVersion != null)
-            implementationVersion = implementationVersion.trim();
-
-        attrKey = s + Name.IMPLEMENTATION_VENDOR.toString();
-        vendor = attr.getValue(attrKey);
-        if (vendor != null)
-            vendor = vendor.trim();
-
-        attrKey = s + Name.IMPLEMENTATION_VENDOR_ID.toString();
-        vendorId = attr.getValue(attrKey);
-        if (vendorId != null)
-            vendorId = vendorId.trim();
-
-        attrKey =s + Name.IMPLEMENTATION_URL.toString();
-        url = attr.getValue(attrKey);
-        if (url != null)
-            url = url.trim();
-    }
-
-    /**
-     * @return true if the extension described by this extension information
-     * is compatible with the extension described by the extension
-     * information passed as a parameter
-     *
-     * @param ei the requested extension information to compare to
-     */
-    public int isCompatibleWith(ExtensionInfo ei) {
-
-        if (name == null || ei.name == null)
-            return INCOMPATIBLE;
-        if (name.compareTo(ei.name)==0) {
-            // is this true, if not spec version is specified, we consider
-            // the value as being "any".
-            if (specVersion == null || ei.specVersion == null)
-                return COMPATIBLE;
-
-            int version = compareExtensionVersion(specVersion, ei.specVersion);
-            if (version<0) {
-                // this extension specification is "older"
-                if (vendorId != null && ei.vendorId !=null) {
-                    if (vendorId.compareTo(ei.vendorId)!=0) {
-                        return REQUIRE_VENDOR_SWITCH;
-                    }
-                }
-                return REQUIRE_SPECIFICATION_UPGRADE;
-            } else {
-                // the extension spec is compatible, let's look at the
-                // implementation attributes
-                if (vendorId != null && ei.vendorId != null) {
-                    // They care who provides the extension
-                    if (vendorId.compareTo(ei.vendorId)!=0) {
-                        // They want to use another vendor implementation
-                        return REQUIRE_VENDOR_SWITCH;
-                    } else {
-                        // Vendor matches, let's see the implementation version
-                        if (implementationVersion != null && ei.implementationVersion != null) {
-                            // they care about the implementation version
-                            version = compareExtensionVersion(implementationVersion, ei.implementationVersion);
-                            if (version<0) {
-                                // This extension is an older implementation
-                                return REQUIRE_IMPLEMENTATION_UPGRADE;
-                            }
-                        }
-                    }
-                }
-                // All othe cases, we consider the extensions to be compatible
-                return COMPATIBLE;
-            }
-        }
-        return INCOMPATIBLE;
-    }
-
-    /**
-     * helper method to print sensible information on the undelying described
-     * extension
-     */
-    public String toString() {
-        return "Extension : title(" + title + "), name(" + name + "), spec vendor(" +
-            specVendor + "), spec version(" + specVersion + "), impl vendor(" +
-            vendor + "), impl vendor id(" + vendorId + "), impl version(" +
-            implementationVersion + "), impl url(" + url + ")";
-    }
-
-    /*
-     * helper method to compare two versions.
-     * version are in the x.y.z.t pattern.
-     *
-     * @param source version to compare to
-     * @param target version used to compare against
-     * @return <pre>{@code
-     *   < 0 if source < version
-     *   > 0 if source > version
-     *   = 0 if source = version}</pre>
-     */
-    private int compareExtensionVersion(String source, String target)
-        throws NumberFormatException
-    {
-        source = source.toLowerCase();
-        target = target.toLowerCase();
-
-        return strictCompareExtensionVersion(source, target);
-    }
-
-
-    /*
-     * helper method to compare two versions.
-     * version are in the x.y.z.t pattern.
-     *
-     * @param source version to compare to
-     * @param target version used to compare against
-     * @return <pre>{@code
-     *   < 0 if source < version
-     *   > 0 if source > version
-     *   = 0 if source = version}</pre>
-     */
-    private int strictCompareExtensionVersion(String source, String target)
-        throws NumberFormatException
-    {
-        if (source.equals(target))
-            return 0;
-
-        StringTokenizer stk = new StringTokenizer(source, ".,");
-        StringTokenizer ttk = new StringTokenizer(target, ".,");
-
-        // Compare number
-        int n = 0, m = 0, result = 0;
-
-        // Convert token into meaning number for comparision
-        if (stk.hasMoreTokens())
-            n = convertToken(stk.nextToken().toString());
-
-        // Convert token into meaning number for comparision
-        if (ttk.hasMoreTokens())
-            m = convertToken(ttk.nextToken().toString());
-
-        if (n > m)
-            return 1;
-        else if (m > n)
-            return -1;
-        else
-        {
-            // Look for index of "." in the string
-            int sIdx = source.indexOf('.');
-            int tIdx = target.indexOf('.');
-
-            if (sIdx == -1)
-                sIdx = source.length() - 1;
-
-            if (tIdx == -1)
-                tIdx = target.length() - 1;
-
-            return strictCompareExtensionVersion(source.substring(sIdx + 1),
-                                                 target.substring(tIdx + 1));
-        }
-    }
-
-    private int convertToken(String token)
-    {
-        if (token == null || token.equals(""))
-            return 0;
-
-        int charValue = 0;
-        int charVersion = 0;
-        int patchVersion = 0;
-        int strLength = token.length();
-        int endIndex = strLength;
-        char lastChar;
-
-        Object[] args = {name};
-        MessageFormat mf = new MessageFormat(rb.getString("optpkg.versionerror"));
-        String versionError = mf.format(args);
-
-        // Look for "-" for pre-release
-        int prIndex = token.indexOf('-');
-
-        // Look for "_" for patch release
-        int patchIndex = token.indexOf('_');
-
-        if (prIndex == -1 && patchIndex == -1)
-        {
-            // This is a FCS release
-            try {
-                return Integer.parseInt(token) * 100;
-            } catch (NumberFormatException e) {
-                System.out.println(versionError);
-                return 0;
-            }
-        }
-        else if (patchIndex != -1)
-        {
-            // This is a patch (update) release
-            int prversion;
-            try {
-                // Obtain the version
-                prversion = Integer.parseInt(token.substring(0, patchIndex));
-
-                // Check to see if the patch version is in the n.n.n_nnl format (special release)
-                lastChar = token.charAt(strLength-1);
-                if (Character.isLetter(lastChar)) {
-                    // letters a-z have values from 10-35
-                    charValue = Character.getNumericValue(lastChar);
-                    endIndex = strLength-1;
-
-                    // Obtain the patch version id
-                    patchVersion = Integer.parseInt(token.substring(patchIndex+1, endIndex));
-
-                    if (charValue >= Character.getNumericValue('a') && charValue <= Character.getNumericValue('z')) {
-                        // This is a special release
-                        charVersion = (patchVersion * 100) + charValue;
-                    } else {
-                        // character is not a a-z letter, ignore
-                        charVersion = 0;
-                        System.out.println(versionError);
-                    }
-                } else {
-                    // This is a regular update release. Obtain the patch version id
-                    patchVersion = Integer.parseInt(token.substring(patchIndex+1, endIndex));
-                }
-            } catch (NumberFormatException e) {
-                System.out.println(versionError);
-                return 0;
-            }
-            return prversion * 100 + (patchVersion + charVersion);
-        }
-        else
-        {
-            //This is a milestone release, either a early access, alpha, beta, or RC
-
-            // Obtain the version
-            int mrversion;
-            try {
-                mrversion = Integer.parseInt(token.substring(0, prIndex));
-            } catch (NumberFormatException e) {
-                System.out.println(versionError);
-                return 0;
-            }
-
-            // Obtain the patch version string, including the milestone + version
-            String prString = token.substring(prIndex + 1);
-
-            // Milestone version
-            String msVersion = "";
-            int delta = 0;
-
-            if (prString.indexOf("ea") != -1)
-            {
-                msVersion = prString.substring(2);
-                delta = 50;
-            }
-            else if (prString.indexOf("alpha") != -1)
-            {
-                msVersion = prString.substring(5);
-                delta = 40;
-            }
-            else if (prString.indexOf("beta") != -1)
-            {
-                msVersion = prString.substring(4);
-                delta = 30;
-            }
-            else if (prString.indexOf("rc") != -1)
-            {
-                msVersion = prString.substring(2);
-                delta = 20;
-            }
-
-            if (msVersion == null || msVersion.equals(""))
-            {
-                // No version after the milestone, assume 0
-                return mrversion * 100 - delta ;
-            }
-            else
-            {
-                // Convert the milestone version
-                try {
-                    return mrversion * 100 - delta + Integer.parseInt(msVersion);
-                } catch (NumberFormatException e) {
-                    System.out.println(versionError);
-                    return 0;
-                }
-            }
-        }
-    }
-}
--- a/jdk/src/java.base/share/classes/sun/misc/ExtensionInstallationException.java	Thu Jun 11 17:29:09 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.misc;
-
-/*
- * Exception when installation of an extension has failed for
- * any reason
- *
- * @deprecated this class will be removed in a future release.
- * @author  Jerome Dochez
- */
-@Deprecated
-public class ExtensionInstallationException extends Exception {
-
-    static final long serialVersionUID = 3139688306909345924L;
-
-    /*
-     * <p>
-     * Construct a new exception with an exception reason
-     * </p>
-     */
-    public ExtensionInstallationException(String s) {
-        super(s);
-    }
-}
--- a/jdk/src/java.base/share/classes/sun/misc/ExtensionInstallationProvider.java	Thu Jun 11 17:29:09 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.misc;
-
-/**
- * This interface defines the contract a extension installation capable
- * provided to the extension installation dependency mechanism to
- * install new extensions on the user's disk
- *
- * @deprecated this class will be removed in a future release.
- * @author  Jerome Dochez
- */
-@Deprecated
-public interface ExtensionInstallationProvider {
-
-    /*
-     * <p>
-     * Request the installation of an extension in the extension directory
-     * </p>
-     *
-     * @param requestExtInfo information on the extension that need to be
-     * installed
-     * @param installedExtInfo information on the current compatible installed
-     * extension. Can be null if no current installation has been found.
-     * @return true if the installation is successful, false if the
-     * installation could not be attempted.
-     * @exception ExtensionInstallationException if an installation was
-     * attempted but did not succeed.
-     */
-    boolean installExtension(ExtensionInfo requestExtInfo,
-                             ExtensionInfo installedExtInfo)
-        throws ExtensionInstallationException;
-}