6988317: RowSetProvider.newFactory() may throw unspecified exception
authorlancea
Wed, 06 Oct 2010 10:11:45 -0400
changeset 6847 b45ff1bbe52f
parent 6846 2cfd1dfb014b
child 6848 1a454f5b7209
6988317: RowSetProvider.newFactory() may throw unspecified exception Reviewed-by: darcy
jdk/src/share/classes/javax/sql/rowset/RowSetProvider.java
--- a/jdk/src/share/classes/javax/sql/rowset/RowSetProvider.java	Wed Oct 06 10:09:58 2010 -0400
+++ b/jdk/src/share/classes/javax/sql/rowset/RowSetProvider.java	Wed Oct 06 10:11:45 2010 -0400
@@ -28,6 +28,7 @@
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.sql.SQLException;
+import java.util.ServiceConfigurationError;
 import java.util.ServiceLoader;
 
 /**
@@ -255,13 +256,19 @@
      * Use the ServiceLoader mechanism to load  the default RowSetFactory
      * @return default RowSetFactory Implementation
      */
-    static private RowSetFactory loadViaServiceLoader() {
+    static private RowSetFactory loadViaServiceLoader() throws SQLException {
         RowSetFactory theFactory = null;
-        trace("***in loadViaServiceLoader()");
-        for (RowSetFactory factory : ServiceLoader.load(javax.sql.rowset.RowSetFactory.class)) {
-            trace(" Loading done by the java.util.ServiceLoader :" + factory.getClass().getName());
-            theFactory = factory;
-            break;
+        try {
+            trace("***in loadViaServiceLoader():");
+            for (RowSetFactory factory : ServiceLoader.load(javax.sql.rowset.RowSetFactory.class)) {
+                trace(" Loading done by the java.util.ServiceLoader :" + factory.getClass().getName());
+                theFactory = factory;
+                break;
+            }
+        } catch (ServiceConfigurationError e) {
+            throw new SQLException(
+                    "RowSetFactory: Error locating RowSetFactory using Service "
+                    + "Loader API: " + e, e);
         }
         return theFactory;