private static Hashtable createFactoryStore()

in src/main/java/org/apache/commons/logging/LogFactory.java [436:472]


    private static Hashtable<ClassLoader, LogFactory> createFactoryStore() {
        Hashtable<ClassLoader, LogFactory> result = null;
        String storeImplementationClass;
        try {
            storeImplementationClass = getSystemProperty(HASHTABLE_IMPLEMENTATION_PROPERTY, null);
        } catch (final SecurityException ex) {
            // Permissions don't allow this to be accessed. Default to the "modern"
            // weak hash table implementation if it is available.
            storeImplementationClass = null;
        }
        if (storeImplementationClass == null) {
            storeImplementationClass = WEAK_HASHTABLE_CLASSNAME;
        }
        try {
            final Class<Hashtable<ClassLoader, LogFactory>> implementationClass = (Class<Hashtable<ClassLoader, LogFactory>>) Class
                    .forName(storeImplementationClass);
            result = implementationClass.getConstructor().newInstance();
        } catch (final Throwable t) {
            handleThrowable(t); // may re-throw t
            // ignore
            if (!WEAK_HASHTABLE_CLASSNAME.equals(storeImplementationClass)) {
                // if the user's trying to set up a custom implementation, give a clue
                if (isDiagnosticsEnabled()) {
                    // use internal logging to issue the warning
                    logDiagnostic("[ERROR] LogFactory: Load of custom Hashtable failed");
                } else {
                    // we *really* want this output, even if diagnostics weren't
                    // explicitly enabled by the user.
                    System.err.println("[ERROR] LogFactory: Load of custom Hashtable failed");
                }
            }
        }
        if (result == null) {
            result = new Hashtable<>();
        }
        return result;
    }