You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by an...@apache.org on 2012/04/10 16:03:22 UTC

svn commit: r1311729 - /openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/ConnectionManager.java

Author: andygumbrecht
Date: Tue Apr 10 14:03:21 2012
New Revision: 1311729

URL: http://svn.apache.org/viewvc?rev=1311729&view=rev
Log:
More verbose on error, but do not mask 'unsupported' errors.

Modified:
    openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/ConnectionManager.java

Modified: openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/ConnectionManager.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/ConnectionManager.java?rev=1311729&r1=1311728&r2=1311729&view=diff
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/ConnectionManager.java (original)
+++ openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/ConnectionManager.java Tue Apr 10 14:03:21 2012
@@ -74,10 +74,11 @@ public class ConnectionManager {
         if (name == null) name = "default";
 
         final ConnectionStrategy strategy = strategies.get(name);
+        if (strategy == null) {
+            throw new UnsupportedConnectionStrategyException(name);
+        }
 
         try {
-            if (strategy == null) throw new UnsupportedConnectionStrategyException(name);
-
             //Do not leave this in production code
             //logger.finest("connect: strategy=" + name + ", uri=" + server.getLocation() + ", strategy-impl=" + strategy.getClass().getName());
 
@@ -97,15 +98,12 @@ public class ConnectionManager {
         if (uri == null) throw new IllegalArgumentException("uri cannot be null");
 
         final String scheme = uri.getScheme();
+        final ConnectionFactory factory = factories.get(scheme);
+        if (factory == null) {
+            throw new UnsupportedConnectionFactoryException(scheme);
+        }
 
         try {
-
-            final ConnectionFactory factory = factories.get(scheme);
-
-            if (factory == null) {
-                throw new UnsupportedConnectionFactoryException(scheme);
-            }
-
             //Do not leave this in production code
             //logger.finest("connect: scheme=" + scheme + ", uri=" + uri + ", factory-impl=" + factory.getClass().getName());
 
@@ -152,10 +150,11 @@ public class ConnectionManager {
     }
 
     /**
-     * @param factory
-     * @throws IOException
-     * @Deprecated use register("default", factory);
+     * @param factory ConnectionFactory
+     * @throws IOException On error
+     * @deprecated Use register("default", factory);
      */
+    @Deprecated
     public static void setFactory(final ConnectionFactory factory) throws IOException {
         registerFactory("default", factory);
     }