Buggy code:
@ Repository public class DomainSearchByNsIpStrategy extends AbstractDomainSearchStrategy { protected static final Logger LOGGER = LoggerFactory . getLogger ( DomainSearchByNsIpStrategy . class ) ; @ Override public boolean support ( QueryParam queryParam ) { } @ Override public Long searchCount ( QueryParam queryParam , JdbcTemplate jdbcTemplate ) { } @ Override public List < Domain > search ( QueryParam queryParam , JdbcTemplate jdbcTemplate ) { DomainSearchParam domainQueryParam = ( ( DomainSearchParam ) ( queryParam ) ) ; List < Domain > result = null ; final PageBean page = domainQueryParam . getPageBean ( ) ; int startPage = ( page . getCurrentPage ( ) ) - 1 ; startPage = ( startPage >= 0 ) ? startPage : 0 ; final long startRow = startPage * ( page . getMaxRecords ( ) ) ; String ipPrefix = domainQueryParam . getQ ( ) ; IpVersion ipVersion = IpUtil . getIpVersionOfIp ( ipPrefix ) ; final byte [ ] ipBytes = IpUtil . ipToByteArray ( ipPrefix , ipVersion ) ; DomainQueryDaoImpl domainDao = new DomainQueryDaoImpl ( ) ; <START_BUG> final String sql = "SELECT<seq2seq4repair_space>distinct<seq2seq4repair_space>domain.*,status.*<seq2seq4repair_space>FROM<seq2seq4repair_space>RDAP_DOMAIN<seq2seq4repair_space>domain<seq2seq4repair_space>" + ( ( ( ( "<seq2seq4repair_space>INNER<seq2seq4repair_space>JOIN<seq2seq4repair_space>REL_DOMAIN_NAMESERVER<seq2seq4repair_space>rel<seq2seq4repair_space>" + "<seq2seq4repair_space>ON<seq2seq4repair_space>domain.DOMAIN_ID<seq2seq4repair_space>=<seq2seq4repair_space>rel.DOMAIN_ID<seq2seq4repair_space>" ) + "<seq2seq4repair_space>INNER<seq2seq4repair_space>JOIN<seq2seq4repair_space>RDAP_NAMESERVER_IP<seq2seq4repair_space>nsip<seq2seq4repair_space>" ) + "<seq2seq4repair_space>ON<seq2seq4repair_space>rel.NAMESERVER_ID<seq2seq4repair_space>=<seq2seq4repair_space>nsip.NAMESERVER_ID<seq2seq4repair_space>" ) + "<seq2seq4repair_space>where<seq2seq4repair_space>nsip.IP<seq2seq4repair_space>=<seq2seq4repair_space>?<seq2seq4repair_space>order<seq2seq4repair_space>by<seq2seq4repair_space>domain.LDH_NAME<seq2seq4repair_space>limit<seq2seq4repair_space>?,?" ) ; <END_BUG> result = jdbcTemplate . query ( new PreparedStatementCreator ( ) { public PreparedStatement createPreparedStatement ( Connection connection ) throws SQLException { PreparedStatement ps = connection . prepareStatement ( sql ) ; ps . setBytes ( 1 , ipBytes ) ; ps . setLong ( 2 , startRow ) ; ps . setLong ( 3 , page . getMaxRecords ( ) ) ; return ps ; } } , domainDao . new DomainWithStatusResultSetExtractor ( ) ) ; for ( Domain domain : result ) { domainDao . queryDomainStatus ( domain , jdbcTemplate ) ; } return result ; } }

Fix:
final String sql = "SELECT<seq2seq4repair_space>distinct<seq2seq4repair_space>domain.*<seq2seq4repair_space>FROM<seq2seq4repair_space>RDAP_DOMAIN<seq2seq4repair_space>domain<seq2seq4repair_space>" + ( ( ( ( "<seq2seq4repair_space>INNER<seq2seq4repair_space>JOIN<seq2seq4repair_space>REL_DOMAIN_NAMESERVER<seq2seq4repair_space>rel<seq2seq4repair_space>" + "<seq2seq4repair_space>ON<seq2seq4repair_space>domain.DOMAIN_ID<seq2seq4repair_space>=<seq2seq4repair_space>rel.DOMAIN_ID<seq2seq4repair_space>" ) + "<seq2seq4repair_space>INNER<seq2seq4repair_space>JOIN<seq2seq4repair_space>RDAP_NAMESERVER_IP<seq2seq4repair_space>nsip<seq2seq4repair_space>" ) + "<seq2seq4repair_space>ON<seq2seq4repair_space>rel.NAMESERVER_ID<seq2seq4repair_space>=<seq2seq4repair_space>nsip.NAMESERVER_ID<seq2seq4repair_space>" ) + "<seq2seq4repair_space>where<seq2seq4repair_space>nsip.IP<seq2seq4repair_space>=<seq2seq4repair_space>?<seq2seq4repair_space>order<seq2seq4repair_space>by<seq2seq4repair_space>domain.LDH_NAME<seq2seq4repair_space>limit<seq2seq4repair_space>?,?" ) ;