Buggy code:
public String getIsGuest ( ) { } public String getIsUserActive ( ) { } public String getIsUniversityOnlyUser ( ) { } public String getIsExternalUser ( ) { } public Integer getSpecifiedIdCoreFacility ( ) { } public static SecurityAdvisor create ( Session sess , String uid ) throws InvalidSecurityAdvisorException { } public static SecurityAdvisor create ( Session sess , String uid , Integer idCoreFacility ) throws InvalidSecurityAdvisorException { } private static String getBSTpersonId ( Session sess , String uid ) { } public static SecurityAdvisor createGuest ( ) throws InvalidSecurityAdvisorException { } public boolean hasPermission ( String permission ) { } public boolean canRead ( DetailObject object ) throws UnknownPermissionException { } public boolean canRead ( DetailObject object , int dataProfile ) throws UnknownPermissionException { } public boolean canRead ( Session sess , Class theClass , Integer id , int dataProfile ) throws UnknownPermissionException { } public boolean checkBSTXSecurity ( DetailObject object ) { } private Map < String , boolean [ ] > canReadCCNumbers ( List < String > ccNumbers ) throws SQLException , NamingException { } public boolean canReadAllCCNumbers ( Request req ) { } private boolean canReadAllCCNumbers ( List < String > ccNumbers ) throws SQLException , NamingException { } private Map < String , boolean [ ] > canReadSamples ( List < String > ccNumbers ) { } public StringBuffer buildSampleQuery ( List < String > ccNumbers ) { } public Map < Integer , Integer > getBSTXSecurityIdsToExclude ( Session sess , DictionaryHelper dh , List rows , Integer idRequestIdx , Integer codeRequestCategoryIdx ) throws SQLException , NamingException { } public boolean canArchive ( DetailObject object ) throws UnknownPermissionException { } public boolean canUpdate ( DetailObject object ) throws UnknownPermissionException { } public boolean canUpdate ( Class theClass ) throws UnknownPermissionException { } public boolean canUpdate ( DetailObject object , int dataProfile ) throws UnknownPermissionException { } public boolean canUpdateVisibility ( Integer idLab , Integer idAppUser ) { } public boolean canUploadData ( DetailObject object ) throws UnknownPermissionException { } public boolean canDelete ( DetailObject object ) throws UnknownPermissionException { } public Boolean canDeleteSample ( Request req ) throws UnknownPermissionException { } public void flagPermissions ( DetailObject object ) throws UnknownPermissionException { } private boolean isCollaboratorUploader ( Request req ) { } private boolean isCollaboratorUpdater ( Request req ) { } private boolean isCollaboratorUploader ( Analysis analysis ) { } private boolean isCollaboratorUpdater ( Analysis analysis ) { } public void scrub ( DetailObject object ) throws UnknownPermissionException { } public Set getGlobalPermissions ( ) { } private boolean isActiveUser ( ) { } private void setGlobalPermissions ( ) { } public String getUserFirstName ( ) { } public String getUserLastName ( ) { } public String getUserEmail ( ) { } public Integer getIdAppUser ( ) { } public String getConfirmEmailGuid ( ) { } public String getUID ( ) { } public String getPasswordExpired ( ) { } public String getUserUcscUrl ( ) { } public Set getAllMyGroups ( ) { } public Set getGroupsIAmMemberOrManagerOf ( ) { } private Set filterLabSetByCoreFacility ( Set < Lab > inLabs ) { } public Set getGroupsIAmMemberOf ( ) { } public Set getInstitutionsIAmMemberOf ( ) { } public Set getGroupsICollaborateWith ( ) { } public Set getGroupsIManage ( ) { } public List getGroupsToManage ( ) { } public boolean isCoreFacilityIManage ( Integer idCoreFacility ) { } public boolean isCoreFacilityICanSubmitTo ( Integer idCoreFacility ) { } public boolean isLabICanSubmitTo ( Lab l ) { } public boolean isCoreFacilityForMyLab ( Integer idCoreFacility ) { } public boolean isInstitutionIAmMemberOf ( Integer idInstitution ) { } public boolean isGroupIAmMemberOf ( Integer idLab ) { boolean isMyLab = false ; <START_BUG> if ( ( idLab != null ) && ( ( this . getAppUser ( ) . getLabs ( ) ) != null ) ) { <END_BUG> for ( Iterator i = filterLabSetByCoreFacility ( this . getAppUser ( ) . getLabs ( ) ) . iterator ( ) ; i . hasNext ( ) ; ) { Lab lab = ( ( Lab ) ( i . next ( ) ) ) ; if ( lab . getIdLab ( ) . equals ( idLab ) ) { isMyLab = true ; break ; } } } return isMyLab ; } public boolean isGroupIAmMemberOrManagerOf ( Integer idLab ) { } public boolean isGroupICollaborateWith ( Integer idLab ) { } public boolean isGroupIManage ( Lab theLab ) { } public boolean isGroupIManage ( Integer idLab ) { } public boolean isOwner ( Integer idAppUserOfObject ) { } private boolean isLoggedInUser ( Integer idAppUserOfObject ) { } private void validate ( ) throws InvalidSecurityAdvisorException { } public void registerMethodsToExcludeFromXML ( ) { } public AppUser getAppUser ( ) { } public void setAppUser ( AppUser appUser ) { } public boolean buildSpannedSecurityCriteria ( StringBuffer queryBuf , String inheritedClassShortName , String classShortName , String collabClassShortName , boolean isFirstCriteria , String visibilityField , boolean scopeToGroup , String leftJoinExclusionCriteria , String labCoreFacilitiesName , Boolean hasCoreFacility ) { } public boolean buildSecurityCriteria ( StringBuffer queryBuf , String classShortName , String collabClassShortName , boolean isFirstCriteria , boolean scopeToGroup , boolean hasCoreFacility ) { } public boolean buildSecurityCriteria ( StringBuffer queryBuf , String classShortName , String collabClassShortName , boolean isFirstCriteria , boolean scopeToGroup , boolean hasCoreFacility , boolean checkSubmitter ) { } public boolean buildSecurityCriteria ( StringBuffer queryBuf , String classShortName , String collabClassShortName , boolean isFirstCriteria , boolean scopeToGroup , boolean hasCoreFacility , boolean checkSubmitter , boolean includeVisCrit ) { } private boolean appendAdminMemberCriteria ( StringBuffer queryBuf , String collabClassShortName , String classShortName ) { } private boolean appendSecurityCollaboratorListCriteria ( StringBuffer queryBuf , String collabClassShortName ) { } public boolean addPublicOnlySecurityCriteria ( StringBuffer queryBuf , String classShortName , boolean addWhereOrAnd , boolean hasCoreFacility ) { } private boolean appendSubmitterCriteria ( StringBuffer queryBuf , String classShortName ) { } private boolean appendOwnerCriteria ( StringBuffer queryBuf , String classShortName ) { } private boolean appendOwnerCriteria ( StringBuffer queryBuf , String classShortName , boolean includeVisCriteria ) { }

Fix:
if ( ( ( idLab != null ) && ( ( this . getAppUser ( ) ) != null ) ) && ( ( this . getAppUser ( ) . getLabs ( ) ) != null ) ) {