public boolean isAllowedTargetBranch ( ) { List < GhprbBranch > whiteListBranches = helper . getWhiteListTargetBranches ( ) ; List < GhprbBranch > blackListBranches = helper . getBlackListTargetBranches ( ) ; String target = getTarget ( ) ; // First check if it matches any whitelist branch. It matches if // the list is empty, or if it matches any branch in the list if ( ! whiteListBranches . isEmpty ( ) ) { if ( ! matchesAnyBranch ( target , whiteListBranches ) ) { LOGGER . log ( Level . FINEST , "PR #{0} target branch: {1} isn''t in our whitelist of target branches: {2}" , new Object [ ] { id , target , Joiner . on ( ' ' ) . skipNulls ( ) . join ( whiteListBranches ) } ) ; return false ; } } // We matched something in the whitelist, now check the blacklist. It must // not match any branch in the blacklist if ( ! blackListBranches . isEmpty ( ) ) { if ( matchesAnyBranch ( target , blackListBranches ) ) { LOGGER . log ( Level . FINEST , "PR #{0} target branch: {1} is in our blacklist of target branches: {2}" , new Object [ ] { id , target , Joiner . on ( ' ' ) . skipNulls ( ) . join ( blackListBranches ) } ) ; return false ; } } return true ; }
but NOT any branches in the blacklist .