Buggy code:
public class SpringQuery implements SqlQuery { final Logger logger = LoggerFactory . getLogger ( getClass ( ) ) ; JdbcTemplate jdbcTemplate ; String queryString ; List < String > scalars = new ArrayList < String > ( ) ; Map < String , Object > scalarTypes = new HashMap < String , Object > ( ) ; List < String > parameters = new ArrayList < String > ( ) ; Map < String , Object > parameterValues = new HashMap < String , Object > ( ) ; Map < String , Object > parameterTypes = new HashMap < String , Object > ( ) ; Map < String , Object > parameterOutValueTypes = new HashMap < String , Object > ( ) ; Map < String , OutValueSetter > parameterOutValueSetters = new HashMap < String , OutValueSetter > ( ) ; Map < Integer , Integer > parameterOutValuesToPickup = new LinkedHashMap < Integer , Integer > ( ) ; List < String > identities = new ArrayList < String > ( ) ; Map < String , IdentitySetter > identitySetters = new HashMap < String , IdentitySetter > ( ) ; Map < String , Object > identityTypes = new HashMap < String , Object > ( ) ; Integer timeout ; Integer firstResult ; Integer maxResults ; public SpringQuery ( JdbcTemplate jdbcTemplate , String queryString ) { } @ Override public Object getQuery ( ) { } @ Override public SqlQuery setTimeout ( int timeout ) { } @ Override public SqlQuery setFirstResult ( int firstResult ) { } @ Override public SqlQuery setMaxResults ( int maxResults ) { } @ Override public List list ( ) throws SqlProcessorException { } @ Override public Object unique ( ) throws SqlProcessorException { } @ Override public int update ( ) throws SqlProcessorException { } private void doIdentitySelect ( final String identityName ) { } protected int update ( final PreparedStatementCreator psc , final PreparedStatementSetter pss ) throws DataAccessException { } static final Pattern CALL = Pattern . compile ( "\\s*\\{?\\s*(\\?)?\\s*=?\\s*call\\s*(.*?)\\s*}?\\s*" ) ; @ Override public List callList ( ) throws SqlProcessorException { } @ Override public Object callUnique ( ) throws SqlProcessorException { } @ Override public int callUpdate ( ) throws SqlProcessorException { } @ Override public Object callFunction ( ) throws SqlProcessorException { } @ Override public SqlQuery addScalar ( String columnAlias ) { } @ Override public SqlQuery addScalar ( String columnAlias , Object type ) { } @ Override public SqlQuery setParameter ( String name , Object val ) throws SqlProcessorException { } @ Override public SqlQuery setParameter ( String name , Object val , Object type ) throws SqlProcessorException { } @ Override public SqlQuery setParameterList ( String name , Object [ ] vals ) throws SqlProcessorException { } @ Override public SqlQuery setParameterList ( String name , Object [ ] vals , Object type ) throws SqlProcessorException { } protected void setParameters ( PreparedStatement ps , SqlUtils . LimitType limitType , int start ) throws SQLException { int ix = start ; ix = setLimits ( ps , limitType , ix , false ) ; for ( int i = 0 , n = parameters . size ( ) ; i < n ; i ++ ) { String name = parameters . get ( i ) ; Object type = parameterTypes . get ( name ) ; if ( parameterValues . containsKey ( name ) ) { Object value = parameterValues . get ( name ) ; if ( type != null ) { if ( type instanceof JdbcSqlType ) { ( ( JdbcSqlType ) ( type ) ) . set ( ps , ( ix + i ) , value ) ; } else if ( value == null ) { ps . setNull ( ( ix + i ) , ( ( Integer ) ( type ) ) ) ; } else { ps . setObject ( ( ix + i ) , value , ( ( Integer ) ( type ) ) ) ; } } else { ps . setObject ( ( ix + i ) , value ) ; } } if ( parameterOutValueSetters . containsKey ( name ) ) { CallableStatement cs = ( ( CallableStatement ) ( ps ) ) ; if ( type != null ) { if ( type instanceof SqlProviderType ) { cs . registerOutParameter ( ( ix + i ) , ( ( Integer ) ( ( ( SqlProviderType ) ( type ) ) . getProviderSqlNullType ( ) ) ) ) ; } else { cs . registerOutParameter ( ( ix + i ) , ( ( Integer ) ( type ) ) ) ; } } else { throw new SqlProcessorException ( "OUT<seq2seq4repair_space>parameter<seq2seq4repair_space>type<seq2seq4repair_space>for<seq2seq4repair_space>callable<seq2seq4repair_space>statement<seq2seq4repair_space>is<seq2seq4repair_space>null" ) ; } parameterOutValuesToPickup . put ( i , ( ix + i ) ) ; } } <START_BUG> ix = setLimits ( ps , limitType , ix , true ) ; <END_BUG> } protected int setLimits ( PreparedStatement ps , SqlUtils . LimitType limitType , int ix , boolean afterSql ) throws SQLException { } protected Object getParameters ( CallableStatement cs , boolean isFunction ) throws SQLException { } protected List getResults ( ResultSet rs ) throws SQLException { } }

Fix:
ix = setLimits ( ps , limitType , ( ix + ( parameters . size ( ) ) ) , true ) ;