Buggy code:
public class ScarabModule extends BaseScarabModule implements Comparable , Group , Persistent , ModuleEntity { protected static final NumberKey ROOT_ID = new NumberKey ( "0" ) ; private Attribute [ ] activeAttributes ; private Attribute [ ] dedupeAttributes ; private Attribute [ ] quicksearchAttributes ; private Attribute [ ] requiredAttributes ; private List allRModuleAttributes ; private List activeRModuleAttributes ; private Map allRModuleOptionsMap = new HashMap ( ) ; private Map activeRModuleOptionsMap = new HashMap ( ) ; public void setModuleRelatedByParentId ( ModuleEntity v ) throws Exception { } public ModuleEntity getModuleRelatedByParentIdCast ( ) throws Exception { } public Issue getNewIssue ( ScarabUser user ) throws Exception { } public Vector getQueries ( ) throws Exception { } public Vector getIssueTemplates ( ) throws Exception { } public Attribute [ ] getAttributes ( Criteria criteria ) throws Exception { } public Vector getRModuleAttributes ( Criteria crit ) throws Exception { } public Attribute [ ] getDedupeAttributes ( ) throws Exception { } public Attribute [ ] getQuickSearchAttributes ( ) throws Exception { } public Attribute [ ] getRequiredAttributes ( ) throws Exception { } public Attribute [ ] getActiveAttributes ( ) throws Exception { } private void addActiveAndOrderByClause ( Criteria crit ) { } public RModuleAttribute getRModuleAttribute ( Attribute attribute ) throws Exception { } public List getRModuleAttributes ( boolean activeOnly ) throws Exception { } private List getAllRModuleAttributes ( ) throws Exception { } public Attribute [ ] getAllAttributes ( ) throws Exception { } public List getRModuleOptions ( Attribute attribute ) throws Exception { } public List getRModuleOptions ( Attribute attribute , boolean activeOnly ) throws Exception { } private List getAllRModuleOptions ( Attribute attribute ) throws Exception { } public List getAttributeOptions ( Attribute attribute ) throws Exception { } public List getLeafRModuleOptions ( Attribute attribute ) throws Exception { } public List getLeafRModuleOptions ( Attribute attribute , boolean activeOnly ) throws Exception { List rModOpts = getRModuleOptions ( attribute , activeOnly ) ; Map optionsMap = new HashMap ( ( ( int ) ( ( rModOpts . size ( ) ) * 1.5 ) ) ) ; for ( int i = ( rModOpts . size ( ) ) - 1 ; i >= 0 ; i -- ) { RModuleOption rmo = ( ( RModuleOption ) ( rModOpts . get ( i ) ) ) ; optionsMap . put ( rmo . getOptionId ( ) , null ) ; } for ( int i = ( rModOpts . size ( ) ) - 1 ; i >= 0 ; i -- ) { AttributeOption option = ( ( RModuleOption ) ( rModOpts . get ( i ) ) ) . getAttributeOption ( ) ; <START_BUG> List descendants = option . getDescendants ( ) ; <END_BUG> if ( descendants != null ) { for ( int j = ( descendants . size ( ) ) - 1 ; j >= 0 ; j -- ) { AttributeOption descendant = ( ( AttributeOption ) ( descendants . get ( j ) ) ) ; if ( optionsMap . containsKey ( descendant . getOptionId ( ) ) ) { rModOpts . remove ( i ) ; break ; } } } } return rModOpts ; } public List getOptionTree ( Attribute attribute ) throws Exception { } public List getOptionTree ( Attribute attribute , boolean activeOnly ) throws Exception { } public List getUsers ( String permission ) throws Exception { } public List getUsers ( String partialUserName , String permission ) throws Exception { } public boolean allowsMultipleVoting ( ) { } public int getUnusedVoteCount ( ScarabUser user ) { } public List getUsers ( String partialUserName , String [ ] permissions ) throws Exception { } public Vector getUnapprovedQueries ( ) throws Exception { } public Vector getUnapprovedTemplates ( ) throws Exception { } public void save ( ) throws TurbineSecurityException { } public void remove ( ) throws TurbineSecurityException { } public void rename ( String name ) throws TurbineSecurityException { } public void grant ( User user , Role role ) throws TurbineSecurityException { } public void grant ( User user , RoleSet roleSet ) throws TurbineSecurityException { } public void revoke ( User user , Role role ) throws TurbineSecurityException { } public void revoke ( User user , RoleSet roleSet ) throws TurbineSecurityException { } public int compareTo ( Object obj ) { } }

Fix:
List descendants = option . getChildren ( ) ;