HHH-9498 Using C3P0 connection pool but not setting hibernate.connection.isolation results in a NumberFormatException

This commit is contained in:
Sanne Grinovero 2014-11-15 19:04:17 +00:00
parent b938fa2f93
commit 439ec92627
2 changed files with 13 additions and 1 deletions

View File

@ -38,6 +38,7 @@ import org.hibernate.boot.registry.classloading.spi.ClassLoadingException;
import org.hibernate.cfg.Environment;
import org.hibernate.engine.jdbc.connections.internal.ConnectionProviderInitiator;
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.service.UnknownUnwrapTypeException;
import org.hibernate.service.spi.Configurable;
@ -214,7 +215,7 @@ public class C3P0ConnectionProvider
}
final String i = (String) props.get( Environment.ISOLATION );
if ( i == null ) {
if ( StringHelper.isEmpty( i ) ) {
isolation = null;
}
else {

View File

@ -24,14 +24,17 @@
package org.hibernate.test.c3p0;
import java.lang.management.ManagementFactory;
import java.util.Properties;
import java.util.Set;
import javax.management.MBeanServer;
import javax.management.ObjectName;
import org.hibernate.c3p0.internal.C3P0ConnectionProvider;
import org.hibernate.cfg.Environment;
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.testing.TestForIssue;
import org.junit.Test;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
@ -89,4 +92,12 @@ public class C3P0ConnectionProviderTest extends BaseCoreFunctionalTestCase {
assertTrue( "PooledDataSource BMean not found, please verify version of c3p0", mbeanfound );
}
@Test @TestForIssue(jiraKey="HHH-9498")
public void testIsolationPropertyCouldBeEmpty() {
Properties configuration = new Properties();
configuration.setProperty( Environment.ISOLATION, "" );
C3P0ConnectionProvider provider = new C3P0ConnectionProvider();
provider.configure( configuration );
}
}