Buggy code:
public class IssueSearch extends Issue { public static final String ASC = "asc" ; public static final String DESC = "desc" ; private static final NumberKey ALL_TEXT = new NumberKey ( "0" ) ; private static final String PARENT_ID ; private static final String CHILD_ID ; private static final String AV_ISSUE_ID ; private static final String AV_OPTION_ID ; private static final String AV_USER_ID ; private static final DateFormat DATETIME_FORMATTER ; private static final DateFormat DATE_FORMATTER ; private String searchWords ; private NumberKey [ ] textScope ; private String minId ; private String maxId ; private String minDate ; private String maxDate ; private int minVotes ; private String [ ] createdBy ; private NumberKey stateChangeAttributeId ; private NumberKey stateChangeFromOptionId ; private NumberKey stateChangeToOptionId ; private String stateChangeFromDate ; private String stateChangeToDate ; private NumberKey initialSortAttributeId ; private String initialSortPolarity ; private int resultsPerPage ; public IssueSearch ( Issue issue ) throws Exception { } public IssueSearch ( ModuleEntity module , IssueType issueType ) throws Exception { } public String getSearchWords ( ) { } public void setSearchWords ( String v ) { } public NumberKey [ ] getTextScope ( ) throws Exception { } private void setTextScopeToAll ( ) throws Exception { } public void setTextScope ( NumberKey [ ] v ) { } public String getMinId ( ) { } public void setMinId ( String v ) { } public String getMaxId ( ) { } public void setMaxId ( String v ) { } public String getMinDate ( ) { } public void setMinDate ( String v ) { } public String getMaxDate ( ) { } public void setMaxDate ( String v ) { } public int getMinVotes ( ) { } public void setMinVotes ( int v ) { } public String [ ] getCreatedByUserNames ( ) { } public void setCreatedByUserNames ( String [ ] v ) { } public int getResultsPerPage ( ) { } public void setResultsPerPage ( int v ) { } public NumberKey getStateChangeAttributeId ( ) { } public void setStateChangeAttributeId ( NumberKey v ) { } public NumberKey getStateChangeFromOptionId ( ) { } public void setStateChangeFromOptionId ( NumberKey v ) { } public NumberKey getStateChangeToOptionId ( ) { } public void setStateChangeToOptionId ( NumberKey v ) { } public String getStateChangeFromDate ( ) { } public void setStateChangeFromDate ( String v ) { } public String getStateChangeToDate ( ) { } public void setStateChangeToDate ( String v ) { } public NumberKey getInitialSortAttributeId ( ) { } public void setInitialSortAttributeId ( NumberKey v ) { } public String getInitialSortPolarity ( ) { } public void setInitialSortPolarity ( String v ) { } public NumberKey getALL_TEXT ( ) { } public List getQuickSearchTextAttributeValues ( ) throws Exception { } public List getTextAttributeValues ( ) throws Exception { } private List getTextAttributeValues ( boolean quickSearchOnly ) throws Exception { } public List getQuickSearchOptionAttributeValues ( ) throws Exception { } public List getOptionAttributeValues ( ) throws Exception { } private List getOptionAttributeValues ( boolean quickSearchOnly ) throws Exception { } private void removeUnsetValues ( List attValues ) { } private void addMinimumVotes ( Criteria crit ) throws ScarabException { } private void addIssueIdRange ( Criteria crit ) throws Exception , ScarabException { } private void setDefaults ( FederatedId minFid , FederatedId maxFid ) throws Exception { } private void addCreatedDateRange ( Criteria crit ) throws ScarabException { } private Date parseDate ( String dateString , boolean addTwentyFourHours ) { } private void addDateRange ( String column , Date minUtilDate , Date maxUtilDate , Criteria crit ) throws ScarabException { } private void addSelectedAttributes ( Criteria crit , List attValues ) throws Exception { } private Criterion buildOptionCriterion ( AttributeValue aval ) throws Exception { } private Criterion buildUserCriterion ( AttributeValue aval ) throws Exception { } private void addCreatedByUserIds ( Criteria crit ) throws Exception { } private NumberKey [ ] addTextMatches ( Criteria crit , List attValues ) throws Exception { NumberKey [ ] matchingIssueIds = null ; SearchIndex searchIndex = SearchFactory . getInstance ( ) ; if ( ( ( getSearchWords ( ) ) != null ) && ( ( getSearchWords ( ) . length ( ) ) != 0 ) ) { searchIndex . addQuery ( getTextScope ( ) , getSearchWords ( ) ) ; matchingIssueIds = searchIndex . getRelatedIssues ( ) ; if ( ( matchingIssueIds . length ) != 0 ) { crit . addIn ( ISSUE_ID , matchingIssueIds ) ; } } else { boolean atLeastOne = false ; for ( int i = 0 ; i < ( attValues . size ( ) ) ; i ++ ) { AttributeValue aval = ( ( AttributeValue ) ( attValues . get ( i ) ) ) ; if ( ( ( aval instanceof StringAttribute ) && ( ( aval . getValue ( ) ) != null ) ) && ( ( aval . getValue ( ) . length ( ) ) != 0 ) ) { atLeastOne = true ; NumberKey [ ] id = new NumberKey [ ] { aval . getAttributeId ( ) } ; searchIndex . addQuery ( id , aval . getValue ( ) ) ; } } if ( atLeastOne ) { matchingIssueIds = searchIndex . getRelatedIssues ( ) ; if ( ( matchingIssueIds . length ) != 0 ) { <START_BUG> crit . addIn ( AttributeValuePeer . ISSUE_ID , matchingIssueIds ) ; <END_BUG> } } } return matchingIssueIds ; } private void addStateChangeQuery ( Criteria crit ) throws Exception { } private void addInitialSortCriteria ( Criteria crit ) throws Exception { } public List getMatchingIssues ( ) throws Exception { } public List getMatchingIssues ( int limitResults ) throws Exception { } private List sortByUniqueId ( Criteria crit ) throws Exception { } private List sortIssues ( Criteria crit ) throws Exception { } }

Fix:
crit . addIn ( ISSUE_ID , matchingIssueIds ) ;