changeset 2886:6fd4928b82a2

6988317: RowSetProvider.newFactory() may throw unspecified exception Reviewed-by: darcy
author lancea
date Wed, 06 Oct 2010 10:11:45 -0400
parents 0f23a139e819
children a6295291fab1
files src/share/classes/javax/sql/rowset/RowSetProvider.java
diffstat 1 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/javax/sql/rowset/RowSetProvider.java	Wed Oct 06 10:09:58 2010 -0400
+++ b/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;