HHH-11651 - Fix checkstyle errors
This commit is contained in:
parent
5566b423e3
commit
7a897d5285
|
@ -71,11 +71,16 @@ public class ConnectionProviderBuilder implements DialectCheck {
|
|||
try {
|
||||
Class dataSourceClass = ReflectHelper.classForName( DATA_SOURCE, ConnectionProviderBuilder.class );
|
||||
DataSource actualDataSource = (DataSource) dataSourceClass.newInstance();
|
||||
ReflectHelper.findSetterMethod( dataSourceClass, "URL", String.class ).invoke( actualDataSource, String.format( URL, dbName ) );
|
||||
ReflectHelper.findSetterMethod( dataSourceClass, "URL", String.class ).invoke(
|
||||
actualDataSource,
|
||||
String.format( URL, dbName )
|
||||
);
|
||||
ReflectHelper.findSetterMethod( dataSourceClass, "user", String.class ).invoke( actualDataSource, USER );
|
||||
ReflectHelper.findSetterMethod( dataSourceClass, "password", String.class ).invoke( actualDataSource, PASS );
|
||||
ReflectHelper.findSetterMethod( dataSourceClass, "password", String.class )
|
||||
.invoke( actualDataSource, PASS );
|
||||
|
||||
final DataSourceInvocationHandler dataSourceInvocationHandler = new DataSourceInvocationHandler( actualDataSource );
|
||||
final DataSourceInvocationHandler dataSourceInvocationHandler = new DataSourceInvocationHandler(
|
||||
actualDataSource );
|
||||
|
||||
DatasourceConnectionProviderImpl connectionProvider = new DatasourceConnectionProviderImpl() {
|
||||
@Override
|
||||
|
@ -85,13 +90,14 @@ public class ConnectionProviderBuilder implements DialectCheck {
|
|||
};
|
||||
|
||||
connectionProvider.configure(
|
||||
Collections.singletonMap( Environment.DATASOURCE,
|
||||
Proxy.newProxyInstance(
|
||||
Thread.currentThread().getContextClassLoader(),
|
||||
new Class[] { DataSource.class },
|
||||
dataSourceInvocationHandler
|
||||
)
|
||||
)
|
||||
Collections.singletonMap(
|
||||
Environment.DATASOURCE,
|
||||
Proxy.newProxyInstance(
|
||||
Thread.currentThread().getContextClassLoader(),
|
||||
new Class[] {DataSource.class},
|
||||
dataSourceInvocationHandler
|
||||
)
|
||||
)
|
||||
);
|
||||
return connectionProvider;
|
||||
}
|
||||
|
|
|
@ -368,13 +368,17 @@ public class TransactionUtil {
|
|||
.openSession();
|
||||
txn = session.getTransaction();
|
||||
txn.begin();
|
||||
function.accept(session);
|
||||
function.accept( session );
|
||||
txn.commit();
|
||||
} catch (Throwable e) {
|
||||
if ( txn != null ) txn.rollback();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
if ( txn != null ) {
|
||||
txn.rollback();
|
||||
}
|
||||
throw e;
|
||||
} finally {
|
||||
if (session != null) {
|
||||
}
|
||||
finally {
|
||||
if ( session != null ) {
|
||||
session.close();
|
||||
}
|
||||
}
|
||||
|
@ -391,8 +395,8 @@ public class TransactionUtil {
|
|||
*/
|
||||
public static <R> R doInHibernate(
|
||||
Supplier<SessionFactory> factorySupplier,
|
||||
String tenant,
|
||||
Function<Session, R> function) {
|
||||
String tenant,
|
||||
Function<Session, R> function) {
|
||||
Session session = null;
|
||||
Transaction txn = null;
|
||||
try {
|
||||
|
@ -402,14 +406,18 @@ public class TransactionUtil {
|
|||
.openSession();
|
||||
txn = session.getTransaction();
|
||||
txn.begin();
|
||||
R returnValue = function.apply(session);
|
||||
R returnValue = function.apply( session );
|
||||
txn.commit();
|
||||
return returnValue;
|
||||
} catch (Throwable e) {
|
||||
if ( txn != null ) txn.rollback();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
if ( txn != null ) {
|
||||
txn.rollback();
|
||||
}
|
||||
throw e;
|
||||
} finally {
|
||||
if (session != null) {
|
||||
}
|
||||
finally {
|
||||
if ( session != null ) {
|
||||
session.close();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue