Program: 113455
Project: 113455
Buggy source:
@Override public void updateACLEntries(StorageManager sMan,FileMetadata file,long parentId,Map<String,Object> entries,AtomicDBUpdate update) throws MRCException, UserException {
  DatabaseResultSet<ACLEntry> acl=null;
  try {
    Map<String,Object> aclMap=null;
    acl=sMan.getACL(file.getId());
    if (!acl.hasNext())     aclMap=convertToACL(file.getPerms());
 else {
      aclMap=new HashMap<String,Object>();
      while (acl.hasNext()) {
        ACLEntry next=acl.next();
        aclMap.put(next.getEntity(),next.getRights());
      }
    }
    for (    Entry<String,Object> entry : entries.entrySet()) {
      String entity=entry.getKey();
      String rwx=(String)entry.getValue();
      if (rwx != null) {
        int rights=0;
        if (rwx.length() == 1 && rwx.charAt(0) >= '0' && rwx.charAt(0) <= '7')         rights=Integer.parseInt(rwx,8);
 else {
          if (rwx.indexOf('r') != -1)           rights|=PERM_READ;
          if (rwx.indexOf('w') != -1)           rights|=PERM_WRITE;
          if (rwx.indexOf('x') != -1)           rights|=PERM_EXECUTE;
        }
        aclMap.put(entity,rights);
      }
 else       aclMap.put(entity,null);
    }
    for (    Entry<String,Object> entry : aclMap.entrySet()) {
      Number rights=(Number)entry.getValue();
      sMan.setACLEntry(file.getId(),entry.getKey(),rights == null ? null : rights.shortValue(),update);
    }
    int owner=((Number)aclMap.get(OWNER)).intValue();
    Integer group=aclMap.get(MASK) != null ? ((Number)aclMap.get(MASK)).intValue() : null;
    if (group == null)     group=((Number)aclMap.get(OWNER_GROUP)).intValue();
    int other=((Number)aclMap.get(OTHER)).intValue();
    int posixRights=((owner & PERM_SUID_SGID) > 0 ? POSIX_SUID : 0) | ((group & PERM_SUID_SGID) > 0 ? POSIX_SGID : 0) | (file.getPerms() & POSIX_STICKY)| ((owner & PERM_READ) > 0 ? POSIX_OWNER_READ : 0)| ((owner & PERM_WRITE) > 0 ? POSIX_OWNER_WRITE : 0)| ((owner & PERM_EXECUTE) > 0 ? POSIX_OWNER_EXEC : 0)| ((group & PERM_READ) > 0 ? POSIX_GROUP_READ : 0)| ((group & PERM_WRITE) > 0 ? POSIX_GROUP_WRITE : 0)| ((group & PERM_EXECUTE) > 0 ? POSIX_GROUP_EXEC : 0)| ((other & PERM_READ) > 0 ? POSIX_OTHER_READ : 0)| ((other & PERM_WRITE) > 0 ? POSIX_OTHER_WRITE : 0)| ((other & PERM_EXECUTE) > 0 ? POSIX_OTHER_EXEC : 0);
    file.setPerms(posixRights);
    sMan.setMetadata(file,FileMetadata.RC_METADATA,update);
  }
 catch (  Exception exc) {
    throw new MRCException(exc);
  }
 finally {
    if (acl != null)     acl.destroy();
  }
}

Fixed version (ground truth):
@Override public void updateACLEntries(StorageManager sMan,FileMetadata file,long parentId,Map<String,Object> entries,AtomicDBUpdate update) throws MRCException, UserException {
  DatabaseResultSet<ACLEntry> acl=null;
  try {
    Map<String,Object> aclMap=null;
    acl=sMan.getACL(file.getId());
    if (!acl.hasNext())     aclMap=convertToACL(file.getPerms());
 else {
      aclMap=new HashMap<String,Object>();
      while (acl.hasNext()) {
        ACLEntry next=acl.next();
        aclMap.put(next.getEntity(),next.getRights());
      }
    }
    for (    Entry<String,Object> entry : entries.entrySet()) {
      String entity=entry.getKey();
      String rwx=(String)entry.getValue();
      if (rwx != null) {
        int rights=0;
        if (rwx.length() == 1 && rwx.charAt(0) >= '0' && rwx.charAt(0) <= '7') {
          rights=Integer.parseInt(rwx,8);
          int tmp=((rights >> 3) ^ (rights >> 1)) & 1;
          rights=rights ^ ((tmp << 3) | (tmp << 1));
        }
 else {
          if (rwx.indexOf('r') != -1)           rights|=PERM_READ;
          if (rwx.indexOf('w') != -1)           rights|=PERM_WRITE;
          if (rwx.indexOf('x') != -1)           rights|=PERM_EXECUTE;
        }
        aclMap.put(entity,rights);
      }
 else       aclMap.put(entity,null);
    }
    for (    Entry<String,Object> entry : aclMap.entrySet()) {
      Number rights=(Number)entry.getValue();
      sMan.setACLEntry(file.getId(),entry.getKey(),rights == null ? null : rights.shortValue(),update);
    }
    int owner=((Number)aclMap.get(OWNER)).intValue();
    Integer group=aclMap.get(MASK) != null ? ((Number)aclMap.get(MASK)).intValue() : null;
    if (group == null)     group=((Number)aclMap.get(OWNER_GROUP)).intValue();
    int other=((Number)aclMap.get(OTHER)).intValue();
    int posixRights=((owner & PERM_SUID_SGID) > 0 ? POSIX_SUID : 0) | ((group & PERM_SUID_SGID) > 0 ? POSIX_SGID : 0) | (file.getPerms() & POSIX_STICKY)| ((owner & PERM_READ) > 0 ? POSIX_OWNER_READ : 0)| ((owner & PERM_WRITE) > 0 ? POSIX_OWNER_WRITE : 0)| ((owner & PERM_EXECUTE) > 0 ? POSIX_OWNER_EXEC : 0)| ((group & PERM_READ) > 0 ? POSIX_GROUP_READ : 0)| ((group & PERM_WRITE) > 0 ? POSIX_GROUP_WRITE : 0)| ((group & PERM_EXECUTE) > 0 ? POSIX_GROUP_EXEC : 0)| ((other & PERM_READ) > 0 ? POSIX_OTHER_READ : 0)| ((other & PERM_WRITE) > 0 ? POSIX_OTHER_WRITE : 0)| ((other & PERM_EXECUTE) > 0 ? POSIX_OTHER_EXEC : 0);
    file.setPerms(posixRights);
    sMan.setMetadata(file,FileMetadata.RC_METADATA,update);
  }
 catch (  Exception exc) {
    throw new MRCException(exc);
  }
 finally {
    if (acl != null)     acl.destroy();
  }
}