Program: 113868
Project: 113868
Buggy source:
public void setACLEntries(StorageManager sMan,FileMetadata file,long parentId,String userId,List<String> groupIds,Map<String,Object> entries,AtomicDBUpdate update) throws MRCException, UserException {
  try {
    if (!sMan.getACL(file.getId()).hasNext()) {
      Map<String,Object> tmp=convertToACL(file.getPerms());
      entries.putAll(tmp);
    }
    for (    Entry<String,Object> entry : entries.entrySet())     sMan.setACLEntry(file.getId(),entry.getKey(),(Short)entry.getValue(),update);
    ACLEntry owner=sMan.getACLEntry(file.getId(),OWNER);
    ACLEntry group=sMan.getACLEntry(file.getId(),MASK);
    if (group == null)     group=sMan.getACLEntry(file.getId(),OWNER_GROUP);
    ACLEntry other=sMan.getACLEntry(file.getId(),OTHER);
    assert(group != null);
    assert(other != null);
    ACLEntry sticky=sMan.getACLEntry(file.getId(),STICKY_BIT);
    file.setPerms((short)((short)((owner.getRights() & PERM_SUID_SGID) > 0 ? POSIX_SUID : 0) | ((group.getRights() & PERM_SUID_SGID) > 0 ? POSIX_SGID : 0) | ((sticky != null && sticky.getRights() == 1) ? POSIX_STICKY : 0)| ((owner.getRights() & PERM_READ) > 0 ? POSIX_OWNER_READ : 0)| ((owner.getRights() & PERM_WRITE) > 0 ? POSIX_OWNER_WRITE : 0)| ((owner.getRights() & PERM_EXECUTE) > 0 ? POSIX_OWNER_EXEC : 0)| ((group.getRights() & PERM_READ) > 0 ? POSIX_GROUP_READ : 0)| ((group.getRights() & PERM_WRITE) > 0 ? POSIX_GROUP_WRITE : 0)| ((group.getRights() & PERM_EXECUTE) > 0 ? POSIX_GROUP_EXEC : 0)| ((other.getRights() & PERM_READ) > 0 ? POSIX_OTHER_READ : 0)| ((other.getRights() & PERM_WRITE) > 0 ? POSIX_OTHER_WRITE : 0)| ((other.getRights() & PERM_EXECUTE) > 0 ? POSIX_OTHER_EXEC : 0)));
    sMan.setMetadata(parentId,file.getFileName(),file,FileMetadata.RC_METADATA,update);
  }
 catch (  Exception exc) {
    throw new MRCException(exc);
  }
}

Fixed version (ground truth):
public void setACLEntries(StorageManager sMan,FileMetadata file,long parentId,String userId,List<String> groupIds,Map<String,Object> entries,AtomicDBUpdate update) throws MRCException, UserException {
  try {
    if (!sMan.getACL(file.getId()).hasNext()) {
      Map<String,Object> tmp=convertToACL(file.getPerms());
      entries.putAll(tmp);
    }
    for (    Entry<String,Object> entry : entries.entrySet())     sMan.setACLEntry(file.getId(),entry.getKey(),(Short)entry.getValue(),update);
    ACLEntry owner=sMan.getACLEntry(file.getId(),OWNER);
    ACLEntry group=sMan.getACLEntry(file.getId(),MASK);
    if (group == null)     group=sMan.getACLEntry(file.getId(),OWNER_GROUP);
    ACLEntry other=sMan.getACLEntry(file.getId(),OTHER);
    assert(group != null);
    assert(other != null);
    ACLEntry sticky=sMan.getACLEntry(file.getId(),STICKY_BIT);
    file.setPerms((short)((short)((owner.getRights() & PERM_SUID_SGID) > 0 ? POSIX_SUID : 0) | ((group.getRights() & PERM_SUID_SGID) > 0 ? POSIX_SGID : 0) | ((sticky != null && sticky.getRights() == 1) ? POSIX_STICKY : 0)| ((owner.getRights() & PERM_READ) > 0 ? POSIX_OWNER_READ : 0)| ((owner.getRights() & PERM_WRITE) > 0 ? POSIX_OWNER_WRITE : 0)| ((owner.getRights() & PERM_EXECUTE) > 0 ? POSIX_OWNER_EXEC : 0)| ((group.getRights() & PERM_READ) > 0 ? POSIX_GROUP_READ : 0)| ((group.getRights() & PERM_WRITE) > 0 ? POSIX_GROUP_WRITE : 0)| ((group.getRights() & PERM_EXECUTE) > 0 ? POSIX_GROUP_EXEC : 0)| ((other.getRights() & PERM_READ) > 0 ? POSIX_OTHER_READ : 0)| ((other.getRights() & PERM_WRITE) > 0 ? POSIX_OTHER_WRITE : 0)| ((other.getRights() & PERM_EXECUTE) > 0 ? POSIX_OTHER_EXEC : 0)));
    sMan.setMetadata(file,FileMetadata.RC_METADATA,update);
  }
 catch (  Exception exc) {
    throw new MRCException(exc);
  }
}