--- old/src/share/jaxws_classes/javax/xml/ws/spi/Provider.java 2014-06-03 11:32:04.000000000 +0200
+++ new/src/share/jaxws_classes/javax/xml/ws/spi/Provider.java 2014-06-03 11:32:04.000000000 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -29,7 +29,7 @@
import java.util.List;
import java.util.Iterator;
import java.util.Map;
-import java.lang.reflect.Method;
+import java.util.ServiceLoader;
import javax.xml.namespace.QName;
import javax.xml.ws.*;
import javax.xml.ws.wsaddressing.W3CEndpointReference;
@@ -50,8 +50,7 @@
* name of a Provider
implementation
* class.
*/
- static public final String JAXWSPROVIDER_PROPERTY
- = "javax.xml.ws.spi.Provider";
+ static public final String JAXWSPROVIDER_PROPERTY = "javax.xml.ws.spi.Provider";
/**
* A constant representing the name of the default
@@ -62,29 +61,6 @@
= "com.sun"+".xml.internal.ws.spi.ProviderImpl";
/**
- * Take advantage of Java SE 6's java.util.ServiceLoader API.
- * Using reflection so that there is no compile-time dependency on SE 6.
- */
- static private final Method loadMethod;
- static private final Method iteratorMethod;
- static {
- Method tLoadMethod = null;
- Method tIteratorMethod = null;
- try {
- Class> clazz = Class.forName("java.util.ServiceLoader");
- tLoadMethod = clazz.getMethod("load", Class.class);
- tIteratorMethod = clazz.getMethod("iterator");
- } catch(ClassNotFoundException ce) {
- // Running on Java SE 5
- } catch(NoSuchMethodException ne) {
- // Shouldn't happen
- }
- loadMethod = tLoadMethod;
- iteratorMethod = tIteratorMethod;
- }
-
-
- /**
* Creates a new instance of Provider
*/
protected Provider() {
@@ -146,25 +122,16 @@
}
}
-
private static Provider getProviderUsingServiceLoader() {
- if (loadMethod != null) {
- Object loader;
- try {
- loader = loadMethod.invoke(null, Provider.class);
- } catch (Exception e) {
- throw new WebServiceException("Cannot invoke java.util.ServiceLoader#load()", e);
- }
-
- Iterator it;
- try {
- it = (Iterator)iteratorMethod.invoke(loader);
- } catch(Exception e) {
- throw new WebServiceException("Cannot invoke java.util.ServiceLoader#iterator()", e);
- }
- return it.hasNext() ? it.next() : null;
+ 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 null;
+ return ((it != null) && it.hasNext()) ? it.next() : null;
}
/**