--- old/src/java.xml.ws/share/classes/javax/xml/ws/spi/Provider.java 2015-09-16 11:12:50.000000000 +0200 +++ new/src/java.xml.ws/share/classes/javax/xml/ws/spi/Provider.java 2015-09-16 11:12:49.000000000 +0200 @@ -45,19 +45,12 @@ public abstract class Provider { /** - * A constant representing the property used to lookup the - * name of a {@code Provider} implementation - * class. - */ - static public final String JAXWSPROVIDER_PROPERTY = "javax.xml.ws.spi.Provider"; - - /** * A constant representing the name of the default * {@code Provider} implementation class. **/ // Using two strings so that package renaming doesn't change it - static final String DEFAULT_JAXWSPROVIDER - = "com.sun"+".xml.internal.ws.spi.ProviderImpl"; + private static final String DEFAULT_JAXWSPROVIDER = + "com.sun"+".xml.internal.ws.spi.ProviderImpl"; /** * Creates a new instance of Provider @@ -72,47 +65,22 @@ * The algorithm used to locate the provider subclass to use consists * of the following steps: * * */ public static Provider provider() { try { - Object provider = getProviderUsingServiceLoader(); - if (provider == null) { - provider = FactoryFinder.find(JAXWSPROVIDER_PROPERTY, DEFAULT_JAXWSPROVIDER); - } - if (!(provider instanceof Provider)) { - Class pClass = Provider.class; - String classnameAsResource = pClass.getName().replace('.', '/') + ".class"; - ClassLoader loader = pClass.getClassLoader(); - if(loader == null) { - loader = ClassLoader.getSystemClassLoader(); - } - URL targetTypeURL = loader.getResource(classnameAsResource); - throw new LinkageError("ClassCastException: attempting to cast" + - provider.getClass().getClassLoader().getResource(classnameAsResource) + - "to" + targetTypeURL.toString() ); - } - return (Provider) provider; + return FactoryFinder.find(Provider.class, DEFAULT_JAXWSPROVIDER); } catch (WebServiceException ex) { throw ex; } catch (Exception ex) { @@ -120,18 +88,6 @@ } } - private static Provider getProviderUsingServiceLoader() { - ServiceLoader sl; - Iterator it; - try { - sl = ServiceLoader.load(Provider.class); - it = (Iterator)sl.iterator(); - } catch (Exception e) { - throw new WebServiceException("Cannot invoke java.util.ServiceLoader#iterator()", e); - } - return ((it != null) && it.hasNext()) ? it.next() : null; - } - /** * Creates a service delegate object. *