From 77c85353ab3f50634143bdab5204b5cde4cf67ab Mon Sep 17 00:00:00 2001 From: Steve Ebersole Date: Sun, 24 Nov 2013 15:29:50 -0600 Subject: [PATCH] HHH-8741 - More checkstyle cleanups --- .../criteria/CriteriaQueryTranslator.java | 4 +- .../custom/sql/SQLQueryReturnProcessor.java | 10 +-- .../hibernate/sql/Sybase11JoinFragment.java | 74 +++++++++++-------- .../jpa/internal/util/XmlHelper.java | 22 ++---- .../jpa/spi/AbstractEntityManagerImpl.java | 62 ++++++++-------- 5 files changed, 88 insertions(+), 84 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/loader/criteria/CriteriaQueryTranslator.java b/hibernate-core/src/main/java/org/hibernate/loader/criteria/CriteriaQueryTranslator.java index 313198a4a7..164d2934fb 100755 --- a/hibernate-core/src/main/java/org/hibernate/loader/criteria/CriteriaQueryTranslator.java +++ b/hibernate-core/src/main/java/org/hibernate/loader/criteria/CriteriaQueryTranslator.java @@ -220,9 +220,9 @@ public class CriteriaQueryTranslator implements CriteriaQuery { // initialize the rootProvider first CriteriaInfoProvider rootProvider = new EntityCriteriaInfoProvider(( Queryable ) sessionFactory.getEntityPersister( rootEntityName ) ); criteriaInfoMap.put( rootCriteria, rootProvider); - nameCriteriaInfoMap.put ( rootProvider.getName(), rootProvider ); + nameCriteriaInfoMap.put( rootProvider.getName(), rootProvider ); - for(final String key : associationPathCriteriaMap.keySet() ){ + for ( final String key : associationPathCriteriaMap.keySet() ) { Criteria value = associationPathCriteriaMap.get( key ); CriteriaInfoProvider info = getPathInfo( key ); criteriaInfoMap.put( value, info ); diff --git a/hibernate-core/src/main/java/org/hibernate/loader/custom/sql/SQLQueryReturnProcessor.java b/hibernate-core/src/main/java/org/hibernate/loader/custom/sql/SQLQueryReturnProcessor.java index 815255e211..5c41a0b5e6 100644 --- a/hibernate-core/src/main/java/org/hibernate/loader/custom/sql/SQLQueryReturnProcessor.java +++ b/hibernate-core/src/main/java/org/hibernate/loader/custom/sql/SQLQueryReturnProcessor.java @@ -119,23 +119,23 @@ public class SQLQueryReturnProcessor { public class ResultAliasContext { public SQLLoadable getEntityPersister(String alias) { - return ( SQLLoadable ) alias2Persister.get( alias ); + return (SQLLoadable) alias2Persister.get( alias ); } public SQLLoadableCollection getCollectionPersister(String alias) { - return ( SQLLoadableCollection ) alias2CollectionPersister.get( alias ); + return (SQLLoadableCollection) alias2CollectionPersister.get( alias ); } public String getEntitySuffix(String alias) { - return ( String ) alias2Suffix.get( alias ); + return (String) alias2Suffix.get( alias ); } public String getCollectionSuffix(String alias) { - return ( String ) alias2CollectionSuffix.get ( alias ); + return (String) alias2CollectionSuffix.get( alias ); } public String getOwnerAlias(String alias) { - return ( String ) alias2OwnerAlias.get( alias ); + return (String) alias2OwnerAlias.get( alias ); } public Map getPropertyResultsMap(String alias) { diff --git a/hibernate-core/src/main/java/org/hibernate/sql/Sybase11JoinFragment.java b/hibernate-core/src/main/java/org/hibernate/sql/Sybase11JoinFragment.java index a4d2186ad0..4949e5eee7 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/Sybase11JoinFragment.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/Sybase11JoinFragment.java @@ -25,7 +25,6 @@ package org.hibernate.sql; - /** * An old Sybase-style join (before Sybase supported the ANSI style "inner join" etc syntax) * This is needed for Sybase 11.9.2 and earlier, using the HQL 2.* syntax with Collections. @@ -39,26 +38,31 @@ public class Sybase11JoinFragment extends JoinFragment { public void addJoin(String tableName, String alias, String[] fkColumns, String[] pkColumns, JoinType joinType) { - addCrossJoin(tableName, alias); + addCrossJoin( tableName, alias ); - for ( int j=0; j ENTITY_MANAGER_SPECIFIC_PROPERTIES = new ArrayList(); @@ -234,7 +234,7 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage } Object queryTimeout; if ( (queryTimeout = getProperties().get(QueryHints.SPEC_HINT_TIMEOUT)) != null ) { - query.setHint ( QueryHints.SPEC_HINT_TIMEOUT, queryTimeout ); + query.setHint( QueryHints.SPEC_HINT_TIMEOUT, queryTimeout ); } Object lockTimeout; if( (lockTimeout = getProperties().get( AvailableSettings.LOCK_TIMEOUT ))!=null){ @@ -1138,21 +1138,21 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage throw new IllegalArgumentException( e.getMessage(), e ); } catch ( MappingException e ) { - throw convert ( new IllegalArgumentException( e.getMessage(), e ) ); + throw convert( new IllegalArgumentException( e.getMessage(), e ) ); } catch ( TypeMismatchException e ) { - throw convert ( new IllegalArgumentException( e.getMessage(), e ) ); + throw convert( new IllegalArgumentException( e.getMessage(), e ) ); } catch ( ClassCastException e ) { - throw convert ( new IllegalArgumentException( e.getMessage(), e ) ); + throw convert( new IllegalArgumentException( e.getMessage(), e ) ); } catch ( RuntimeException e ) { throw convert( e, lockOptions ); } finally { session.setCacheMode( previousCacheMode ); - ((SessionImplementor)session).getLoadQueryInfluencers().setFetchGraph( null ); - ((SessionImplementor)session).getLoadQueryInfluencers().setLoadGraph( null ); + ( (SessionImplementor) session ).getLoadQueryInfluencers().setFetchGraph( null ); + ( (SessionImplementor) session ).getLoadQueryInfluencers().setLoadGraph( null ); } } @@ -1190,7 +1190,7 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage internalGetSession().persist( entity ); } catch ( MappingException e ) { - throw convert ( new IllegalArgumentException( e.getMessage() ) ) ; + throw convert( new IllegalArgumentException( e.getMessage() ) ) ; } catch ( RuntimeException e ) { throw convert( e ); @@ -1205,12 +1205,13 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage return ( A ) internalGetSession().merge( entity ); } catch ( ObjectDeletedException sse ) { - throw convert ( new IllegalArgumentException( sse ) ); + throw convert( new IllegalArgumentException( sse ) ); } catch ( MappingException e ) { - throw convert ( new IllegalArgumentException( e.getMessage(), e ) ); + throw convert( new IllegalArgumentException( e.getMessage(), e ) ); } - catch ( RuntimeException e ) { //including HibernateException + catch ( RuntimeException e ) { + //including HibernateException throw convert( e ); } } @@ -1222,9 +1223,10 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage internalGetSession().delete( entity ); } catch ( MappingException e ) { - throw convert ( new IllegalArgumentException( e.getMessage(), e ) ); + throw convert( new IllegalArgumentException( e.getMessage(), e ) ); } - catch ( RuntimeException e ) { //including HibernateException + catch ( RuntimeException e ) { + //including HibernateException throw convert( e ); } } @@ -1269,10 +1271,10 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage session.refresh( entity ); } } - catch ( MappingException e ) { - throw convert ( new IllegalArgumentException( e.getMessage(), e ) ); + catch (MappingException e) { + throw convert( new IllegalArgumentException( e.getMessage(), e ) ); } - catch ( RuntimeException e ) { + catch (RuntimeException e) { throw convert( e, lockOptions ); } finally { @@ -1288,14 +1290,14 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage if ( entity != null && !( entity instanceof HibernateProxy ) && internalGetSession().getSessionFactory().getClassMetadata( entity.getClass() ) == null ) { - throw convert ( new IllegalArgumentException( "Not an entity:" + entity.getClass() ) ); + throw convert( new IllegalArgumentException( "Not an entity:" + entity.getClass() ) ); } return internalGetSession().contains( entity ); } - catch ( MappingException e ) { + catch (MappingException e) { throw new IllegalArgumentException( e.getMessage(), e ); } - catch ( RuntimeException e ) { + catch (RuntimeException e) { throw convert( e ); } } @@ -1309,7 +1311,7 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage } if ( !contains( entity ) ) { - throw convert (new IllegalArgumentException( "entity not in the persistence context" ) ); + throw convert( new IllegalArgumentException( "entity not in the persistence context" ) ); } return getLockModeType( internalGetSession().getCurrentLockMode( entity ) ); @@ -1425,7 +1427,7 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage try { internalGetSession().clear(); } - catch ( RuntimeException e ) { + catch (RuntimeException e) { throw convert( e ); } } @@ -1436,7 +1438,7 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage try { internalGetSession().evict( entity ); } - catch ( RuntimeException e ) { + catch (RuntimeException e) { throw convert( e ); } } @@ -1481,7 +1483,7 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage lockOptions = getLockRequest( lockModeType, properties ); internalGetSession().buildLockRequest( lockOptions ).lock( entity ); } - catch ( RuntimeException e ) { + catch (RuntimeException e) { throw convert( e, lockOptions ); } } @@ -1551,7 +1553,7 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage transactionManager.setRollbackOnly(); } } - catch ( SystemException e ) { + catch (SystemException e) { throw new PersistenceException( "Unable to set the JTA transaction as RollbackOnly", e ); } } @@ -1626,7 +1628,7 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage callbackCoordinator.setExceptionMapper( new CallbackExceptionMapperImpl() ); callbackCoordinator.setAfterCompletionAction( new AfterCompletionActionImpl( session, transactionType ) ); } - catch ( HibernateException he ) { + catch (HibernateException he) { throw convert( he ); } } @@ -1687,7 +1689,7 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage public RuntimeException convert(RuntimeException e) { RuntimeException result = e; if ( e instanceof HibernateException ) { - result = convert( ( HibernateException ) e ); + result = convert( (HibernateException) e ); } else { markForRollbackOnly(); @@ -1698,7 +1700,7 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage public RuntimeException convert(RuntimeException e, LockOptions lockOptions) { RuntimeException result = e; if ( e instanceof HibernateException ) { - result = convert( ( HibernateException ) e , lockOptions ); + result = convert( (HibernateException) e , lockOptions ); } else { markForRollbackOnly(); @@ -1709,7 +1711,7 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage @Override public RuntimeException convert(HibernateException e, LockOptions lockOptions) { if ( e instanceof StaleStateException ) { - PersistenceException converted = wrapStaleStateException( ( StaleStateException ) e ); + PersistenceException converted = wrapStaleStateException( (StaleStateException) e ); handlePersistenceException( converted ); return converted; } @@ -1729,7 +1731,7 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage return converted; } else if ( e instanceof org.hibernate.QueryTimeoutException ) { - QueryTimeoutException converted = new QueryTimeoutException(e.getMessage(), e); + QueryTimeoutException converted = new QueryTimeoutException( e.getMessage(), e ); handlePersistenceException( converted ); return converted; }