Buggy code:
public class Issue extends BaseIssue implements Persistent { Issue ( ) { } protected Issue ( ModuleEntity module , IssueType issueType ) throws Exception { } public static Issue getNewInstance ( ModuleEntity module , IssueType issueType ) throws Exception { } public String getUniqueId ( ) throws Exception { } public String getFederatedId ( ) throws Exception { } public void setFederatedId ( String id ) { } public static class FederatedId { String domainId ; String prefix ; int count ; public FederatedId ( String id ) { } public FederatedId ( String domain , String prefix , int count ) { } public void setUniqueId ( String id ) { } public String getDomain ( ) { } public String getPrefix ( ) { } public int getCount ( ) { } public void setDomain ( String domainId ) { } public void setPrefix ( String prefix ) { } public void setCount ( int count ) { } } public void addComment ( Attachment attachment ) throws Exception { } public void setModule ( ModuleEntity me ) throws Exception { } public ModuleEntity getModule ( ) throws Exception { } public static Issue getIssueById ( String id ) { } public static Issue getIssueById ( Issue . FederatedId fid ) { } public SequencedHashtable getModuleAttributeValuesMap ( ) throws Exception { } public AttributeValue getAttributeValue ( Attribute attribute ) throws Exception { } public AttributeValue [ ] getOrderedAttributeValues ( ) throws Exception { } private AttributeValue [ ] orderAttributeValues ( Map values , Attribute [ ] attributes ) throws Exception { } public HashMap getAttributeValuesMap ( ) throws Exception { } public HashMap getAllAttributeValuesMap ( ) throws Exception { } public boolean containsMinimumAttributeValues ( ) throws Exception { } public List getEligibleAssignees ( ) throws Exception { } public List getAssigneeAttributeValues ( ) throws Exception { } public List getAssociatedUsers ( ) throws Exception { } public Date getCreatedDate ( ) throws Exception { } public ScarabUser getCreatedBy ( ) throws Exception { } public ScarabUser getModifiedBy ( ) throws Exception { } public boolean isCommentsLong ( ) throws Exception { } private int getCommentsLimit ( ) throws Exception { } public List getComments ( boolean full ) throws Exception { } public List getUrls ( ) throws Exception { } private int getHistoryLimit ( ) throws Exception { } public boolean isHistoryLong ( ) throws Exception { } public boolean isHistoryLong ( int limit ) throws Exception { } public List getActivity ( ) throws Exception { } public List getActivity ( int limit ) throws Exception { } public List getActivity ( boolean fullHistory ) throws Exception { } private List getActivity ( boolean fullHistory , int limit ) throws Exception { } public List getChildren ( ) throws Exception { } public List getParents ( ) throws Exception { } public List getAllDependencyTypes ( ) throws Exception { } public Depend getDependency ( Issue childIssue ) throws Exception { } public void save ( DBConnection dbCon ) throws Exception { } private int getNextIssueId ( Connection con ) throws Exception { int id = - 1 ; String key = getIdTableKey ( ) ; DatabaseMap dbMap = IssuePeer . getTableMap ( ) . getDatabaseMap ( ) ; <START_BUG> IDBroker idbroker = null ; <END_BUG> try { id = idbroker . getIdAsInt ( con , key ) ; } catch ( Exception e ) { synchronized ( idbroker ) { try { id = idbroker . getIdAsInt ( con , key ) ; } catch ( Exception idRetrievalErr ) { try { saveIdTableKey ( dbMap . getName ( ) ) ; id = idbroker . getIdAsInt ( con , key ) ; } catch ( Exception throwOriginal ) { throw e ; } } } } return id ; } private String getIdTableKey ( ) throws Exception { } private void saveIdTableKey ( String dbName ) throws Exception { } public static List searchKeywords ( String [ ] keywords , boolean useAnd ) throws Exception { } public List getTemplateTypes ( ) throws Exception { } public IssueTemplateInfo getTemplateInfo ( ) throws Exception { } public Date getClosedDate ( ) throws Exception { } public void addVote ( ScarabUser user ) throws Exception , ScarabException { } public List getMatchingAttributeValuesList ( String moduleId ) throws Exception { } public List getMatchingAttributeValuesList ( NumberKey moduleId ) throws Exception { } public List getOrphanAttributeValuesList ( String moduleId ) throws Exception { } public List getOrphanAttributeValuesList ( NumberKey moduleId ) throws Exception { } public void assignUsers ( List newAssignees , String attachmentText , ScarabUser assigner ) throws Exception { } public void approve ( ScarabUser user , boolean approved ) throws Exception , ScarabException { } public void delete ( ScarabUser user ) throws Exception , ScarabException { } public boolean hasEnterPermission ( ScarabUser user , ModuleEntity module ) throws Exception { } public boolean hasEditPermission ( ScarabUser user , ModuleEntity module ) throws Exception { } }

Fix:
IDBroker idbroker = dbMap . getIDBroker ( ) ;