Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/com/sun/jndi/ldap/VersionHelper.java
38924 views
/*1* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package com.sun.jndi.ldap;2627import java.net.MalformedURLException;28import java.net.URL;2930abstract class VersionHelper {3132private static VersionHelper helper = null;3334VersionHelper() {} // Disallow anyone from creating one of these.3536static {37try {38Class.forName("java.net.URLClassLoader"); // 1.2 test39Class.forName("java.security.PrivilegedAction"); // 1.2 test40helper = (VersionHelper)41Class.forName(42"com.sun.jndi.ldap.VersionHelper12").newInstance();43} catch (Exception e) {44}4546// Use 1.1 helper if 1.2 test fails, or if we cannot create 1.2 helper47if (helper == null) {48try {49helper = (VersionHelper)50Class.forName(51"com.sun.jndi.ldap.VersionHelper11").newInstance();52} catch (Exception e) {53// should never happen54}55}56}5758static VersionHelper getVersionHelper() {59return helper;60}6162abstract ClassLoader getURLClassLoader(String[] url)63throws MalformedURLException;646566static protected URL[] getUrlArray(String[] url) throws MalformedURLException {67URL[] urlArray = new URL[url.length];68for (int i = 0; i < urlArray.length; i++) {69urlArray[i] = new URL(url[i]);70}71return urlArray;72}7374abstract Class<?> loadClass(String className) throws ClassNotFoundException;7576abstract Thread createThread(Runnable r);77}787980