private static Object newInstanceNoServiceLoader(
         Class<?> providerClass
    ) {
        // Retain maximum compatibility if no security manager.
        if (System.getSecurityManager() == null) {
            return null;
        }
        try {
            Method creationMethod =
                providerClass.getDeclaredMethod(
                    "newXPathFactoryNoServiceLoader"
                );
                return creationMethod.invoke(null, null);
            } catch (NoSuchMethodException exc) {
                return null;
            } catch (Exception exc) {
                return null;
        }
    }