[hibernate-commits] Hibernate SVN: r19280 - in core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate: connection and 1 other directory.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Thu Apr 22 05:40:05 EDT 2010


Author: stliu
Date: 2010-04-22 05:40:04 -0400 (Thu, 22 Apr 2010)
New Revision: 19280

Modified:
   core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/cache/impl/bridge/RegionFactoryCacheProviderBridge.java
   core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/connection/ConnectionProviderFactory.java
Log:
JBPAPP-2440 Exceptions due to missing non-supported connection and cache providers are not meaningful

Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/cache/impl/bridge/RegionFactoryCacheProviderBridge.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/cache/impl/bridge/RegionFactoryCacheProviderBridge.java	2010-04-22 08:29:46 UTC (rev 19279)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/cache/impl/bridge/RegionFactoryCacheProviderBridge.java	2010-04-22 09:40:04 UTC (rev 19280)
@@ -62,8 +62,13 @@
 		try {
 			cacheProvider = ( CacheProvider ) ReflectHelper.classForName( providerClassName ).newInstance();
 		}
-		catch ( Exception cnfe ) {
-			throw new CacheException( "could not instantiate CacheProvider [" + providerClassName + "]", cnfe );
+		catch ( Throwable cnfe ) {
+			String msg = "Could not instantiate cache provider: "
+				+ providerClassName
+				+ "\nUnsupported cache provider implemention is not included our Product."
+				+ "\nThis error may be caused by the configured cache provider was not found in the classpath."
+				+ "\nPlease check the cache configuration and make sure the provider is in the classpath.";
+			throw new CacheException( msg, cnfe );
 		}
 	}
 

Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/connection/ConnectionProviderFactory.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/connection/ConnectionProviderFactory.java	2010-04-22 08:29:46 UTC (rev 19279)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/connection/ConnectionProviderFactory.java	2010-04-22 09:40:04 UTC (rev 19280)
@@ -134,7 +134,21 @@
 				throw new HibernateException("Unable to inject objects into the conenction provider", e);
 			}
 		}
-		connections.configure(properties);
+		try {
+			connections.configure( properties );
+		} catch ( Throwable e ) {
+			if ( providerClass != null ) {
+				String msg = "Could not instantiate connection provider: "
+						+ providerClass
+						+ "\nUnsupported connection provider implemention is not included our Product."
+						+ "\nThis error may be caused by the configured connection provider was not found in the classpath."
+						+ "\nPlease check the connection configuration and make sure the provider is in the classpath.";
+				log.error( msg, e );
+				throw new HibernateException( msg );
+			}else{
+				throw new HibernateException( e );
+			}
+		}
 		return connections;
 	}
 



More information about the hibernate-commits mailing list