Buggy code:
public static boolean isUserMember ( String userId , ObjectStorageProperties . S3_GROUP group ) { } public static class OwnerIdPair { private String bucketOwner ; private String objectOwner ; public OwnerIdPair ( String bucketOwnerCanonicalId , String objectOwnerCanonicalId ) { } public String getBucketOwnerCanonicalId ( ) { } public String getObjectOwnerCanonicalId ( ) { } } protected enum PrivateOnlyGrantBuilder implements Function < AclUtils . OwnerIdPair , List < Grant > > { INSTANCE ; @ Override public List < Grant > apply ( AclUtils . OwnerIdPair ownerIds ) { } } protected enum AuthenticatedReadGrantBuilder implements Function < AclUtils . OwnerIdPair , List < Grant > > { INSTANCE ; @ Override public List < Grant > apply ( AclUtils . OwnerIdPair ownerIds ) { } } protected enum PublicReadGrantBuilder implements Function < AclUtils . OwnerIdPair , List < Grant > > { INSTANCE ; @ Override public List < Grant > apply ( AclUtils . OwnerIdPair ownerIds ) { } } protected enum PublicReadWriteGrantBuilder implements Function < AclUtils . OwnerIdPair , List < Grant > > { INSTANCE ; @ Override public List < Grant > apply ( AclUtils . OwnerIdPair ownerIds ) { } } protected enum AwsExecReadGrantBuilder implements Function < AclUtils . OwnerIdPair , List < Grant > > { INSTANCE ; @ Override public List < Grant > apply ( AclUtils . OwnerIdPair ownerIds ) { } } protected enum Ec2BundleReadGrantBuilder implements Function < AclUtils . OwnerIdPair , List < Grant > > { INSTANCE ; @ Override public List < Grant > apply ( AclUtils . OwnerIdPair ownerIds ) { } } protected enum BucketOwnerFullControlGrantBuilder implements Function < AclUtils . OwnerIdPair , List < Grant > > { INSTANCE ; @ Override public List < Grant > apply ( AclUtils . OwnerIdPair ownerIds ) { } } protected enum BucketOwnerReadGrantBuilder implements Function < AclUtils . OwnerIdPair , List < Grant > > { INSTANCE ; @ Override public List < Grant > apply ( AclUtils . OwnerIdPair ownerIds ) { } } protected enum LogDeliveryWriteGrantBuilder implements Function < AclUtils . OwnerIdPair , List < Grant > > { INSTANCE ; @ Override public List < Grant > apply ( AclUtils . OwnerIdPair ownerIds ) { } } public static S3_GROUP getGroupFromUri ( String uri ) throws NoSuchElementException { } public static AccessControlList expandCannedAcl ( @ Nonnull AccessControlList msgAcl , @ Nullable final String bucketOwnerCanonicalId , @ Nullable final String objectOwnerCanonicalId ) throws EucalyptusCloudException { } public static CanonicalUser buildCanonicalUser ( Account accnt ) { } public static AccessControlPolicy processNewResourcePolicy ( @ Nonnull User requestUser , @ Nullable AccessControlPolicy policy , @ Nullable String bucketOwnerCanonicalId ) throws Exception { } public static AccessControlList scrubAcl ( AccessControlList acl ) { AccessControlList scrubbed = new AccessControlList ( ) ; if ( ( ( acl == null ) || ( ( acl . getGrants ( ) ) == null ) ) || ( ( acl . getGrants ( ) . size ( ) ) == 0 ) ) { return scrubbed ; } String canonicalId = null ; Grantee grantee ; CanonicalUser canonicalUser ; Group group ; String email ; for ( Grant g : acl . getGrants ( ) ) { grantee = g . getGrantee ( ) ; if ( grantee == null ) { continue ; } else { canonicalUser = grantee . getCanonicalUser ( ) ; group = grantee . getGroup ( ) ; email = grantee . getEmailAddress ( ) ; } canonicalId = ( canonicalUser == null ) ? null : AclUtils . resolveCanonicalId ( canonicalUser . getID ( ) ) ; if ( canonicalId == null ) { try { User user = Accounts . lookupUserByEmailAddress ( email ) ; if ( ( ( user != null ) && ( user . isAccountAdmin ( ) ) ) && ( ( user . getAccount ( ) ) != null ) ) { canonicalId = user . getAccount ( ) . getCanonicalId ( ) ; } } catch ( AuthException authEx ) { } } if ( ( ( canonicalId == null ) && ( group != null ) ) && ( ! ( Strings . isNullOrEmpty ( group . getUri ( ) ) ) ) ) { ObjectStorageProperties . S3_GROUP foundGroup = AclUtils . getGroupFromUri ( group . getUri ( ) ) ; if ( foundGroup == null ) { throw new NoSuchElementException ( ( ( "URI:<seq2seq4repair_space>" + ( group . getUri ( ) ) ) + "<seq2seq4repair_space>not<seq2seq4repair_space>found<seq2seq4repair_space>in<seq2seq4repair_space>group<seq2seq4repair_space>map" ) ) ; } canonicalId = group . getUri ( ) ; } <START_BUG> if ( ( email != null ) && ( ! ( "" . equals ( email ) ) ) ) { <END_BUG> UnresolvableGrantByEmailAddressException ugbeae = new UnresolvableGrantByEmailAddressException ( ) ; ugbeae . setEmailAddress ( email ) ; throw new RuntimeException ( ugbeae ) ; } else if ( canonicalId == null ) { InvalidArgumentException iae = new InvalidArgumentException ( ) ; iae . setMessage ( "Invalid<seq2seq4repair_space>id" ) ; iae . setArgumentName ( "CanonicalUser//ID" ) ; iae . setArgumentValue ( canonicalUser . getID ( ) ) ; throw new RuntimeException ( iae ) ; } else { if ( ( grantee . getCanonicalUser ( ) ) == null ) { grantee . setCanonicalUser ( new CanonicalUser ( canonicalId , "" ) ) ; } else { grantee . getCanonicalUser ( ) . setID ( canonicalId ) ; } } } return acl ; } private static interface CanonicalIdChecker { String check ( String id ) { } } private static List < AclUtils . CanonicalIdChecker > canonicalIdCheckers = Lists . newArrayList ( new AclUtils . CanonicalIdChecker ( ) { @ Override public String check ( String id ) { } } , new AclUtils . CanonicalIdChecker ( ) { @ Override public String check ( String id ) { } } , new AclUtils . CanonicalIdChecker ( ) { @ Override public String check ( String id ) { } } ) ; public static String resolveCanonicalId ( final String inputCanonicalId ) { } }

Fix:
if ( ( ( email != null ) && ( ! ( "" . equals ( email ) ) ) ) && ( canonicalId == null ) ) {