HHH-8741 - More checkstyle cleanups

This commit is contained in:
Steve Ebersole 2013-11-24 15:29:50 -06:00
parent 4c91944fd9
commit 77c85353ab
5 changed files with 88 additions and 84 deletions

View File

@ -25,7 +25,6 @@
package org.hibernate.sql; package org.hibernate.sql;
/** /**
* An old Sybase-style join (before Sybase supported the ANSI style "inner join" etc syntax) * 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. * This is needed for Sybase 11.9.2 and earlier, using the HQL 2.* syntax with Collections.
@ -43,22 +42,27 @@ public class Sybase11JoinFragment extends JoinFragment {
for ( int j = 0; j < fkColumns.length; j++ ) { for ( int j = 0; j < fkColumns.length; j++ ) {
//full joins are not supported.. yet! //full joins are not supported.. yet!
if (joinType==JoinType.FULL_JOIN ) throw new UnsupportedOperationException(); if ( joinType == JoinType.FULL_JOIN ) {
throw new UnsupportedOperationException();
}
afterWhere.append( " and " ) afterWhere.append( " and " )
.append( fkColumns[j] ) .append( fkColumns[j] )
.append( " " ); .append( " " );
if (joinType==JoinType.LEFT_OUTER_JOIN ) afterWhere.append("*"); if ( joinType == JoinType.LEFT_OUTER_JOIN ) {
afterWhere.append( '*' );
}
afterWhere.append( '=' ); afterWhere.append( '=' );
if (joinType==JoinType.RIGHT_OUTER_JOIN ) afterWhere.append("*"); if ( joinType == JoinType.RIGHT_OUTER_JOIN ) {
afterWhere.append( "*" );
}
afterWhere.append( " " ) afterWhere.append( " " )
.append( alias ) .append( alias )
.append( '.' ) .append( '.' )
.append( pkColumns[j] ); .append( pkColumns[j] );
} }
} }
public String toFromFragmentString() { public String toFromFragmentString() {
@ -82,11 +86,11 @@ public class Sybase11JoinFragment extends JoinFragment {
} }
public void addCondition(String alias, String[] columns, String condition) { public void addCondition(String alias, String[] columns, String condition) {
for ( int i=0; i<columns.length; i++ ) { for ( String column : columns ) {
afterWhere.append( " and " ) afterWhere.append( " and " )
.append( alias ) .append( alias )
.append( '.' ) .append( '.' )
.append( columns[i] ) .append( column )
.append( condition ); .append( condition );
} }
} }
@ -113,7 +117,13 @@ public class Sybase11JoinFragment extends JoinFragment {
} }
public void addJoin(String tableName, String alias, String[] fkColumns, String[] pkColumns, JoinType joinType, String on) { public void addJoin(
String tableName,
String alias,
String[] fkColumns,
String[] pkColumns,
JoinType joinType,
String on) {
addJoin( tableName, alias, fkColumns, pkColumns, joinType ); addJoin( tableName, alias, fkColumns, pkColumns, joinType );
addCondition( on ); addCondition( on );
} }

View File

@ -74,21 +74,18 @@ public final class XmlHelper {
* @return The named child. * @return The named child.
* @throws Exception Child was not found or was not unique. * @throws Exception Child was not found or was not unique.
*/ */
public static Element getUniqueChild(Element element, String tagName) public static Element getUniqueChild(Element element, String tagName) throws Exception {
throws Exception {
Iterator goodChildren = getChildrenByTagName( element, tagName ); Iterator goodChildren = getChildrenByTagName( element, tagName );
if ( goodChildren != null && goodChildren.hasNext() ) { if ( goodChildren != null && goodChildren.hasNext() ) {
Element child = (Element) goodChildren.next(); Element child = (Element) goodChildren.next();
if ( goodChildren.hasNext() ) { if ( goodChildren.hasNext() ) {
throw new Exception throw new Exception( "expected only one " + tagName + " tag" );
( "expected only one " + tagName + " tag" );
} }
return child; return child;
} }
else { else {
throw new Exception throw new Exception( "expected one " + tagName + " tag" );
( "expected one " + tagName + " tag" );
} }
} }
@ -101,8 +98,7 @@ public final class XmlHelper {
* @param tagName the name of the desired child * @param tagName the name of the desired child
* @return either the named child or null * @return either the named child or null
*/ */
public static Element getOptionalChild(Element element, String tagName) public static Element getOptionalChild(Element element, String tagName) throws Exception {
throws Exception {
return getOptionalChild( element, tagName, null ); return getOptionalChild( element, tagName, null );
} }
@ -126,8 +122,7 @@ public final class XmlHelper {
if ( goodChildren != null && goodChildren.hasNext() ) { if ( goodChildren != null && goodChildren.hasNext() ) {
Element child = (Element) goodChildren.next(); Element child = (Element) goodChildren.next();
if ( goodChildren.hasNext() ) { if ( goodChildren.hasNext() ) {
throw new Exception throw new Exception( "expected only one " + tagName + " tag" );
( "expected only one " + tagName + " tag" );
} }
return child; return child;
} }
@ -163,8 +158,8 @@ public final class XmlHelper {
NodeList children = element.getChildNodes(); NodeList children = element.getChildNodes();
StringBuilder result = new StringBuilder(""); StringBuilder result = new StringBuilder("");
for ( int i = 0; i < children.getLength() ; i++ ) { for ( int i = 0; i < children.getLength() ; i++ ) {
if ( children.item( i ).getNodeType() == Node.TEXT_NODE || if ( children.item( i ).getNodeType() == Node.TEXT_NODE
children.item( i ).getNodeType() == Node.CDATA_SECTION_NODE ) { || children.item( i ).getNodeType() == Node.CDATA_SECTION_NODE ) {
result.append( children.item( i ).getNodeValue() ); result.append( children.item( i ).getNodeValue() );
} }
// else if ( children.item( i ).getNodeType() == Node.COMMENT_NODE ) { // else if ( children.item( i ).getNodeType() == Node.COMMENT_NODE ) {
@ -210,7 +205,4 @@ public final class XmlHelper {
return false; return false;
} }
} }

View File

@ -119,6 +119,7 @@ import org.hibernate.jpa.criteria.compile.CriteriaCompiler;
import org.hibernate.jpa.criteria.expression.CompoundSelectionImpl; import org.hibernate.jpa.criteria.expression.CompoundSelectionImpl;
import org.hibernate.jpa.internal.EntityManagerFactoryImpl; import org.hibernate.jpa.internal.EntityManagerFactoryImpl;
import org.hibernate.jpa.internal.EntityManagerMessageLogger; import org.hibernate.jpa.internal.EntityManagerMessageLogger;
import org.hibernate.jpa.internal.HEMLogging;
import org.hibernate.jpa.internal.QueryImpl; import org.hibernate.jpa.internal.QueryImpl;
import org.hibernate.jpa.internal.StoredProcedureQueryImpl; import org.hibernate.jpa.internal.StoredProcedureQueryImpl;
import org.hibernate.jpa.internal.TransactionImpl; import org.hibernate.jpa.internal.TransactionImpl;
@ -144,8 +145,7 @@ import org.jboss.logging.Logger;
public abstract class AbstractEntityManagerImpl implements HibernateEntityManagerImplementor, Serializable { public abstract class AbstractEntityManagerImpl implements HibernateEntityManagerImplementor, Serializable {
private static final long serialVersionUID = 78818181L; private static final long serialVersionUID = 78818181L;
private static final EntityManagerMessageLogger LOG = Logger.getMessageLogger(EntityManagerMessageLogger.class, private static final EntityManagerMessageLogger LOG = HEMLogging.messageLogger( AbstractEntityManagerImpl.class );
AbstractEntityManagerImpl.class.getName());
private static final List<String> ENTITY_MANAGER_SPECIFIC_PROPERTIES = new ArrayList<String>(); private static final List<String> ENTITY_MANAGER_SPECIFIC_PROPERTIES = new ArrayList<String>();
@ -1210,7 +1210,8 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage
catch ( MappingException e ) { 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 ); throw convert( e );
} }
} }
@ -1224,7 +1225,8 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage
catch ( MappingException e ) { 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 ); throw convert( e );
} }
} }