Buggy code:
public class DBBasedBuilderState implements IResourceDescriptions , IResourceDescriptionsExtension { private static final Logger LOGGER = Logger . getLogger ( DBBasedBuilderState . class ) ; private static final String SCHEMA = "org//eclipse//xtext//builder//builderState//db//default-schema.sql" ; private static final QualifiedName EMPTY_NAME = QualifiedName . create ( ) ; private final ConnectionWrapper conn ; private boolean initialized ; private boolean inTransaction ; private String resMapTable = "RES_MAP" ; private final BiMap < URI , Integer > resourceIdMap ; private Set < URI > stashedResources = Sets . newHashSet ( ) ; private final DBEPackageRegistry packageRegistry ; private final IQualifiedNameConverter nameConverter = new IQualifiedNameConverter . DefaultImpl ( ) ; public DBBasedBuilderState ( final Connection conn ) { } public DBBasedBuilderState ( final ConnectionWrapper conn ) { } protected DBBasedBuilderState ( final ConnectionWrapper conn , BiMap < URI , Integer > resourceIdMap , DBEPackageRegistry packageRegistry ) { } public DBBasedBuilderState copy ( ) { } private synchronized void ensureInitialized ( ) { } private void initializeSchema ( final Connection connection ) throws SQLException { } private void reloadCaches ( ) { } private void clearCaches ( ) { } public void open ( ) { } public synchronized void close ( final boolean compact ) { } public void clear ( ) { } public void importData ( final Iterable < IResourceDescription > resourceDescriptions ) { } private void resetOldResourceMap ( ) { } private void insertResources ( final Iterable < IResourceDescription > resourceDescriptions , final boolean external ) { } private Integer insertExternalResource ( final URI uri ) { } public Iterable < SelectableDBBasedResourceDescription > loadResources ( final Set < URI > uris ) { final List < Integer > ids = Lists . newArrayListWithCapacity ( uris . size ( ) ) ; for ( URI uri : uris ) { ids . add ( resourceIdMap . get ( uri ) ) ; } final Object [ ] idArray = ids . toArray ( new Object [ ids . size ( ) ] ) ; final Map < Integer , SelectableDBBasedResourceDescription > result = Maps . newLinkedHashMap ( ) ; PreparedStatement resStmt = null ; PreparedStatement objStmt = null ; try { <START_BUG> resStmt = conn . prepare ( ( ( "SELECT<seq2seq4repair_space>M.ID<seq2seq4repair_space>FROM<seq2seq4repair_space>" + ( resMapTable ) ) + "<seq2seq4repair_space>M<seq2seq4repair_space>INNER<seq2seq4repair_space>JOIN<seq2seq4repair_space>TABLE(ID<seq2seq4repair_space>INT=?)<seq2seq4repair_space>I<seq2seq4repair_space>ON<seq2seq4repair_space>M.RES_ID<seq2seq4repair_space>=<seq2seq4repair_space>I.ID" ) ) ; <END_BUG> resStmt . setObject ( 1 , idArray ) ; resStmt . execute ( ) ; ResultSet rs = resStmt . getResultSet ( ) ; while ( rs . next ( ) ) { int resId = rs . getInt ( 1 ) ; result . put ( resId , new SelectableDBBasedResourceDescription ( this , getResourceURI ( resId ) ) ) ; } DBBasedBuilderState . IEObjectDescriptionIterable objects = new DBBasedBuilderState . IEObjectDescriptionIterable ( ) { @ Override protected PreparedStatement createPreparedStatement ( ) throws SQLException { PreparedStatement stmt = conn . prepare ( "SELECT<seq2seq4repair_space>O.RES_ID,<seq2seq4repair_space>O.FRAG,<seq2seq4repair_space>O.NAME,<seq2seq4repair_space>O.ECLASS_ID,<seq2seq4repair_space>O.USER_DATA<seq2seq4repair_space>FROM<seq2seq4repair_space>OBJ<seq2seq4repair_space>O<seq2seq4repair_space>INNER<seq2seq4repair_space>JOIN<seq2seq4repair_space>TABLE(ID<seq2seq4repair_space>INT=?)<seq2seq4repair_space>I<seq2seq4repair_space>ON<seq2seq4repair_space>O.RES_ID<seq2seq4repair_space>=<seq2seq4repair_space>I.ID" ) ; stmt . setObject ( 1 , idArray ) ; return stmt ; } } ; objStmt = objects . createPreparedStatement ( ) ; objStmt . execute ( ) ; rs = objStmt . getResultSet ( ) ; while ( rs . next ( ) ) { IEObjectDescription obj = objects . computeNext ( rs ) ; result . get ( rs . getInt ( 1 ) ) . getExportedObjects ( ) . add ( obj ) ; } } catch ( SQLException e ) { throw new DBException ( e ) ; } finally { conn . close ( resStmt ) ; conn . close ( objStmt ) ; } return result . values ( ) ; } public void loadAllQualifiedNames ( final Map < QualifiedName , Collection < URI > > destination ) { } public void updateResources ( final Iterable < IResourceDescription > resourceDescriptions ) { } public void deleteResources ( final Iterable < URI > uris ) { } private void deleteResourceDescriptions ( final Iterable < URI > uris ) { } public boolean isEmpty ( ) { } public Iterable < IResourceDescription > getAllResourceDescriptions ( ) { } public IResourceDescription getResourceDescription ( final URI normalizedURI ) { } public Iterable < IEObjectDescription > getExportedObjects ( ) { } public Iterable < IEObjectDescription > getExportedObjects ( final URI resource ) { } public Iterable < IEObjectDescription > getExportedObjects ( final EClass type , final QualifiedName name , final boolean ignoreCase ) { } public Iterable < IEObjectDescription > getExportedObjects ( final URI uri , final EClass type , final QualifiedName name , final boolean ignoreCase ) { } public Iterable < IEObjectDescription > getExportedObjectsByType ( final EClass type ) { } public Iterable < IEObjectDescription > getExportedObjectsByType ( final URI uri , final EClass type ) { } private Object [ ] getUserData ( final Object obj ) { } public Iterable < IEObjectDescription > getExportedObjectsByObject ( final EObject object ) { } public Iterable < QualifiedName > getImportedNames ( final URI uri ) { } public Iterable < IReferenceDescription > getReferenceDescriptions ( final URI resource ) { } public Iterable < IResourceDescription > findAllReferencingResources ( final Iterable < IResourceDescription > targetResources , final ReferenceMatchPolicy matchPolicy ) { } public Iterable < IResourceDescription > findObjectReferencingResources ( final Iterable < IEObjectDescription > targetObjects , final ReferenceMatchPolicy matchPolicy ) { } public Iterable < IReferenceDescription > findReferencesToObjects ( final Iterable < URI > targetObjects ) { } private QualifiedName createQualifiedNameFromString ( final String dotted ) { } private String convertQualifiedNameToString ( final QualifiedName qn ) { } public void beginChanges ( ) { } public void commitChanges ( ) { } public void rollbackChanges ( ) { } public Set < URI > getAllURIs ( ) { } private URI getResourceURI ( final int id ) { } private abstract class ClosingResultSetIterable < T > extends ResultSetIterable < T > { @ Override protected void closeStatement ( final PreparedStatement stmt ) { } } private abstract class IEObjectDescriptionIterable extends DBBasedBuilderState . ClosingResultSetIterable < IEObjectDescription > { @ Override protected IEObjectDescription computeNext ( final ResultSet resultSet ) throws SQLException { } } }

Fix:
resStmt = conn . prepare ( ( ( "SELECT<seq2seq4repair_space>M.RES_ID<seq2seq4repair_space>FROM<seq2seq4repair_space>" + ( resMapTable ) ) + "<seq2seq4repair_space>M<seq2seq4repair_space>INNER<seq2seq4repair_space>JOIN<seq2seq4repair_space>TABLE(ID<seq2seq4repair_space>INT=?)<seq2seq4repair_space>I<seq2seq4repair_space>ON<seq2seq4repair_space>M.RES_ID<seq2seq4repair_space>=<seq2seq4repair_space>I.ID" ) ) ;