Buggy code:
public class LdapIntegration { private static final String UL_STUDENT_ACTIVE_ATTRIBUTE = "ULStudentActive" ; private static final String UL_ROLE_ATTRIBUTE = "ULRole" ; private static final String UL_INTERNAL_EMAIL_ADDR_ATTRIBUTE = "ULInternalEmailAddr" ; private static final String UL_EXTERNAL_EMAIL_ADDR_ATTRIBUTE = "ULExternalEmailAddr" ; private static final String INTERNET_EMAIL_ADDRESS = "InternetEmailAddress" ; private static final String UL_POSTAL_CODE_ATTRIBUTE = "ULPostalCode" ; private static final String UL_POSTAL_ADDR_ATTRIBUTE = "ULPostalAddr" ; private static final String UL_BIRTH_DATE_ATTRIBUTE = "ULBirthDate" ; private static final String UL_TEACHER_ACTIVE_ATTRIBUTE = "ULTeacherActive" ; private static final String UL_EMPLOYEE_ACTIVE_ATTRIBUTE = "ULEmployeeActive" ; private static final String UL_BI_ATTRIBUTE = "ULBI" ; private static final String CO_ATTRIBUTE = "co" ; private static final String UL_SEX_ATTRIBUTE = "ULSex" ; private static final String LAST_NAME_ATTRIBUTE = "sn" ; private static final String GIVEN_NAME_ATTRIBUTE = "givenName" ; private static final String FULL_NAME_ATTRIBUTE = "FullName" ; private static final String UL_FENIXUSER = "ULFenixUser" ; private static final String USER_PASSWORD = "userPassword" ; private static final String UL_STUDENT_CODE = "ULStudentCode" ; private static final String UL_COURSES = "ULCourses" ; private static String [ ] OBJECT_CLASSES_TO_ADD = new String [ ] { "person" , "ULAuxUser" , "ULFenixUser" } ; private static String [ ] OBJECT_CLASSES_TO_ADD_TEMP_USER = new String [ ] { "person" , "ULFenixUser" } ; private static String getSchoolCode ( ) { } private static String getObjectCommonName ( String username , LdapServerIntegrationConfiguration configuration ) { } private static String getPersonCommonName ( Person person , LdapServerIntegrationConfiguration configuration ) { } public static String generateLdapPassword ( String password , String salt ) { } private static AttributesMap collectAttributeMap ( Student student ) { } private static AttributesMap collectAttributeMap ( Person person ) { } private static boolean isStudent ( Person person ) { boolean hasActiveRegistrationsWithEnrolments = false ; Student student = person . getStudent ( ) ; ExecutionYear currentExecutionYear = ExecutionYear . readCurrentExecutionYear ( ) ; if ( student != null ) { <START_BUG> hasActiveRegistrationsWithEnrolments = student . getActiveRegistrations ( ) . stream ( ) . filter ( ( registration ) -> ! ( registration . getEnrolments ( currentExecutionYear ) . isEmpty ( ) ) ) . collect ( Collectors . toList ( ) ) . isEmpty ( ) ; <END_BUG> } boolean isFirstYearFirstTime = person . getCandidaciesSet ( ) . stream ( ) . filter ( ( candidacy ) -> candidacy instanceof StudentCandidacy ) . map ( StudentCandidacy . class :: cast ) . anyMatch ( ( studentCandidacy ) -> ( ( studentCandidacy . isActive ( ) ) && ( ( studentCandidacy . getEntryPhase ( ) ) != null ) ) && ( ( studentCandidacy . getExecutionYear ( ) ) == currentExecutionYear ) ) ; boolean isOtherKindOfCandidate = person . getCandidaciesSet ( ) . stream ( ) . filter ( ( candidacy ) -> candidacy instanceof StudentCandidacy ) . map ( StudentCandidacy . class :: cast ) . anyMatch ( ( candidacy ) -> ( ( ( candidacy . getRegistration ( ) ) != null ) && ( candidacy . getRegistration ( ) . isActive ( ) ) ) && ( ( candidacy . getExecutionYear ( ) ) == currentExecutionYear ) ) ; return ( hasActiveRegistrationsWithEnrolments || isFirstYearFirstTime ) || isOtherKindOfCandidate ; } private static boolean isTeacher ( Person person ) { } private static boolean isEmployee ( Person person ) { } public static LdapServerIntegrationConfiguration getDefaultConfiguration ( ) { } public static boolean deleteUser ( User user ) { } public static boolean deleteUser ( String username ) { } public static boolean deleteUser ( String username , String password , LdapServerIntegrationConfiguration configuration ) { } public static boolean createUser ( String username , String password , String salt ) { } private static Map < String , String [ ] > retrieveSyncInfo ( AttributesMap collectedMap , String [ ] fields , String username , LdapServerIntegrationConfiguration defaultConfiguration ) { } public static Map < String , String [ ] > retrieveSyncInformation ( Student student ) { } public static Map < String , String [ ] > retrieveSyncInformation ( Student student , LdapServerIntegrationConfiguration defaultConfiguration ) { } public static Map < String , String [ ] > retrieveSyncInformation ( Person person ) { } public static Map < String , String [ ] > retrieveSyncInformation ( Person person , LdapServerIntegrationConfiguration defaultConfiguration ) { } private static StringBuilder concatenateValues ( List < String > list ) { } public static boolean createUser ( String username , String password , LdapServerIntegrationConfiguration configuration ) { } public static boolean deleteUser ( String username , LdapServerIntegrationConfiguration configuration ) { } public static boolean isUserAvailableInLdap ( User user ) { } public static boolean isPersonAvailableInLdap ( Person person ) { } private static boolean isUserAvailableInLdap ( User user , LdapServerIntegrationConfiguration defaultConfiguration ) { } public static boolean updateStudentStatus ( Student student ) { } public static boolean updateStudentStatus ( Student student , LdapServerIntegrationConfiguration configuration ) { } public static boolean createPersonInLdap ( Person person ) { } public static boolean createPersonInLdap ( Person person , LdapServerIntegrationConfiguration configuration ) { } public static boolean updatePersonInLdap ( Person person ) { } public static boolean updatePersonInLdap ( Person person , LdapServerIntegrationConfiguration configuration ) { } public static boolean updatePersonUsingLdap ( Person person ) { } public static boolean updatePersonUsingLdap ( Person person , LdapServerIntegrationConfiguration configuration ) { } @ Atomic private static void updatePerson ( Person person , String instituionalEmail , String personalEmail , String birthDate , String documentID , String sex , String givenNames , String surnames ) { } }

Fix:
hasActiveRegistrationsWithEnrolments = ! ( student . getActiveRegistrations ( ) . stream ( ) . filter ( ( registration ) -> ! ( registration . getEnrolments ( currentExecutionYear ) . isEmpty ( ) ) ) . collect ( Collectors . toList ( ) ) . isEmpty ( ) ) ;