Buggy code:
public class PostgresqlItemVersionDao extends PostgresqlDAO implements ItemVersionDAO { private static final Logger logger = Logger . getLogger ( PostgresqlItemVersionDao . class . getName ( ) ) ; public PostgresqlItemVersionDao ( Connection connection ) { } @ Override public ItemMetadata findByItemIdAndVersion ( Long id , Long version ) throws DAOException { Object [ ] values = new Object [ ] { id , version } ; <START_BUG> String query = "SELECT<seq2seq4repair_space>i.id<seq2seq4repair_space>AS<seq2seq4repair_space>item_id,<seq2seq4repair_space>i.parent_id,<seq2seq4repair_space>i.client_parent_file_version,<seq2seq4repair_space>i.filename,<seq2seq4repair_space>i.is_folder,<seq2seq4repair_space>i.mimetype,<seq2seq4repair_space>" + ( ( ( ( "<seq2seq4repair_space>iv.version,<seq2seq4repair_space>iv.device_id,<seq2seq4repair_space>iv.checksum,<seq2seq4repair_space>iv.status,<seq2seq4repair_space>iv.size,<seq2seq4repair_space>iv.modified_at,<seq2seq4repair_space>" + "<seq2seq4repair_space>get_chunks(iv.id)<seq2seq4repair_space>AS<seq2seq4repair_space>chunks<seq2seq4repair_space>" ) + "<seq2seq4repair_space>FROM<seq2seq4repair_space>item_version<seq2seq4repair_space>iv<seq2seq4repair_space>" ) + "<seq2seq4repair_space>INNER<seq2seq4repair_space>JOIN<seq2seq4repair_space>item<seq2seq4repair_space>i<seq2seq4repair_space>ON<seq2seq4repair_space>i.id<seq2seq4repair_space>=<seq2seq4repair_space>iv.item_id<seq2seq4repair_space>" ) + "<seq2seq4repair_space>WHERE<seq2seq4repair_space>iv.item_id<seq2seq4repair_space>=<seq2seq4repair_space>?<seq2seq4repair_space>and<seq2seq4repair_space>iv.version<seq2seq4repair_space>=<seq2seq4repair_space>?" ) ; <END_BUG> ResultSet result = null ; ItemMetadata metadata = null ; try { result = executeQuery ( query , values ) ; if ( result . next ( ) ) { metadata = DAOUtil . getItemMetadataFromResultSet ( result ) ; } else { } } catch ( SQLException e ) { PostgresqlItemVersionDao . logger . error ( e ) ; throw new DAOException ( DAOError . INTERNAL_SERVER_ERROR ) ; } return metadata ; } @ Override public void add ( ItemVersion itemVersion ) throws DAOException { } @ Override public void update ( ItemVersion itemVersion ) throws DAOException { } @ Override public void delete ( ItemVersion itemVersion ) throws DAOException { } @ Override public void insertChunk ( Long itemVersionId , Long chunkId , Integer order ) throws DAOException { } @ Override public void insertChunks ( List < Chunk > chunks , long itemVersionId ) throws DAOException { } @ Override public List < Chunk > findChunks ( Long itemVersionId ) throws DAOException { } }

Fix:
String query = "SELECT<seq2seq4repair_space>i.id<seq2seq4repair_space>AS<seq2seq4repair_space>item_id,<seq2seq4repair_space>i.parent_id,<seq2seq4repair_space>i.client_parent_file_version,<seq2seq4repair_space>i.filename,<seq2seq4repair_space>i.is_folder,<seq2seq4repair_space>i.mimetype,<seq2seq4repair_space>i.workspace_id,<seq2seq4repair_space>" + ( ( ( ( "<seq2seq4repair_space>iv.version,<seq2seq4repair_space>iv.device_id,<seq2seq4repair_space>iv.checksum,<seq2seq4repair_space>iv.status,<seq2seq4repair_space>iv.size,<seq2seq4repair_space>iv.modified_at,<seq2seq4repair_space>" + "<seq2seq4repair_space>get_chunks(iv.id)<seq2seq4repair_space>AS<seq2seq4repair_space>chunks<seq2seq4repair_space>" ) + "<seq2seq4repair_space>FROM<seq2seq4repair_space>item_version<seq2seq4repair_space>iv<seq2seq4repair_space>" ) + "<seq2seq4repair_space>INNER<seq2seq4repair_space>JOIN<seq2seq4repair_space>item<seq2seq4repair_space>i<seq2seq4repair_space>ON<seq2seq4repair_space>i.id<seq2seq4repair_space>=<seq2seq4repair_space>iv.item_id<seq2seq4repair_space>" ) + "<seq2seq4repair_space>WHERE<seq2seq4repair_space>iv.item_id<seq2seq4repair_space>=<seq2seq4repair_space>?<seq2seq4repair_space>and<seq2seq4repair_space>iv.version<seq2seq4repair_space>=<seq2seq4repair_space>?" ) ;