Program: 39931
Project: 39931
Buggy source:
@Override public String addPmphGroupMemberOnGroup(Long groupId,List<PmphGroupMember> pmphGroupMembers,String sessionId) throws CheckedServiceException {
  String result="String_Node_Str";
  PmphUser pmphUser=SessionUtil.getPmphUserBySessionId(sessionId);
  if (null == pmphUser || null == pmphUser.getId()) {
    throw new CheckedServiceException(CheckedExceptionBusiness.GROUP,CheckedExceptionResult.NULL_PARAM,"String_Node_Str");
  }
  Textbook textbook=new Textbook();
  if (null != pmphGroupMembers.get(0).getTextbookId()) {
    textbook=textbookService.getTextbookById(pmphGroupMembers.get(0).getTextbookId());
  }
  Material material=new Material();
  if (null != pmphGroupMembers.get(0).getMaterialId()) {
    material=materialService.getMaterialById(pmphGroupMembers.get(0).getMaterialId());
  }
  MaterialProjectEditor materialProjectEditor=materialProjectEditorService.getMaterialProjectEditorByMaterialIdAndUserId(material.getId(),pmphUser.getId());
  if (material.getDirector() != pmphUser.getId() || textbook.getPlanningEditor() != pmphUser.getId() || null == materialProjectEditor || !pmphUser.getIsAdmin()) {
    if (null != material.getPlanPermission() || null != material.getProjectPermission()) {
      if (!BinaryUtil.getBit(material.getPlanPermission(),7) || !BinaryUtil.getBit(material.getProjectPermission(),7)) {
        throw new CheckedServiceException(CheckedExceptionBusiness.GROUP,CheckedExceptionResult.ILLEGAL_PARAM,"String_Node_Str");
      }
    }
  }
  if (pmphUser.getIsAdmin() || isFounderOrisAdmin(groupId,sessionId) || material.getDirector() == pmphUser.getId() || textbook.getPlanningEditor() == pmphUser.getId() || pmphUser.getId() == materialProjectEditor.getEditorId()) {
    if (pmphGroupMembers.size() > 0) {
      List<Long> writers=new ArrayList<>();
      List<Long> pmphs=new ArrayList<>();
      for (      PmphGroupMember pmphGroupMember : pmphGroupMembers) {
        PmphGroupMemberVO groupMember=pmphGroupMemberDao.getPmphGroupMemberByMemberId(groupId,pmphGroupMember.getUserId(),pmphGroupMember.getIsWriter());
        if (ObjectUtil.isNull(groupMember)) {
          if (null == pmphGroupMember.getUserId()) {
            throw new CheckedServiceException(CheckedExceptionBusiness.GROUP,CheckedExceptionResult.ILLEGAL_PARAM,"String_Node_Str");
          }
          if (pmphGroupMember.getIsWriter()) {
            WriterUser writerUser=writerUserService.get(pmphGroupMember.getUserId());
            pmphGroupMember.setDisplayName(writerUser.getRealname());
            writers.add(pmphGroupMember.getUserId());
          }
 else {
            PmphUser user=pmphUserService.get(pmphGroupMember.getUserId());
            pmphGroupMember.setDisplayName(user.getRealname());
            pmphs.add(pmphGroupMember.getUserId());
          }
          pmphGroupMember.setGroupId(groupId);
          pmphGroupMemberDao.addPmphGroupMember(pmphGroupMember);
        }
 else {
          if (groupMember.getIsDeleted()) {
            pmphGroupMember.setGroupId(groupId);
            pmphGroupMember.setIsDeleted(false);
            pmphGroupMemberDao.update(pmphGroupMember);
            if (groupMember.getIsWriter()) {
              writers.add(pmphGroupMember.getUserId());
            }
 else {
              pmphs.add(pmphGroupMember.getUserId());
            }
          }
 else {
            throw new CheckedServiceException(CheckedExceptionBusiness.GROUP,CheckedExceptionResult.ILLEGAL_PARAM,"String_Node_Str");
          }
        }
      }
      try {
        if (!writers.isEmpty()) {
          systemMessageService.sendWhenInviteJoinGroup(pmphUser.getRealname(),groupId,writers,(short)2);
        }
        if (!pmphs.isEmpty()) {
          systemMessageService.sendWhenInviteJoinGroup(pmphUser.getRealname(),groupId,pmphs,(short)1);
        }
      }
 catch (      IOException e) {
        throw new CheckedServiceException(CheckedExceptionBusiness.GROUP,CheckedExceptionResult.ILLEGAL_PARAM,"String_Node_Str" + e.getMessage());
      }
      result="String_Node_Str";
    }
 else {
      throw new CheckedServiceException(CheckedExceptionBusiness.GROUP,CheckedExceptionResult.ILLEGAL_PARAM,"String_Node_Str");
    }
  }
 else {
    throw new CheckedServiceException(CheckedExceptionBusiness.GROUP,CheckedExceptionResult.ILLEGAL_PARAM,"String_Node_Str");
  }
  return result;
}

Fixed version (ground truth):
@Override public String addPmphGroupMemberOnGroup(Long groupId,List<PmphGroupMember> pmphGroupMembers,String sessionId) throws CheckedServiceException {
  String result="String_Node_Str";
  PmphUser pmphUser=SessionUtil.getPmphUserBySessionId(sessionId);
  if (null == pmphUser || null == pmphUser.getId()) {
    throw new CheckedServiceException(CheckedExceptionBusiness.GROUP,CheckedExceptionResult.NULL_PARAM,"String_Node_Str");
  }
  Textbook textbook=new Textbook();
  if (null != pmphGroupMembers.get(0).getTextbookId()) {
    textbook=textbookService.getTextbookById(pmphGroupMembers.get(0).getTextbookId());
  }
  Material material=new Material();
  if (null != pmphGroupMembers.get(0).getMaterialId()) {
    material=materialService.getMaterialById(pmphGroupMembers.get(0).getMaterialId());
  }
  MaterialProjectEditor materialProjectEditor=materialProjectEditorService.getMaterialProjectEditorByMaterialIdAndUserId(material.getId(),pmphUser.getId());
  if (!material.getDirector().equals(pmphUser.getId()) && !textbook.getPlanningEditor().equals(pmphUser.getId()) && null == materialProjectEditor && !pmphUser.getIsAdmin()) {
    throw new CheckedServiceException(CheckedExceptionBusiness.GROUP,CheckedExceptionResult.ILLEGAL_PARAM,"String_Node_Str");
  }
  if (null != material.getPlanPermission()) {
    if (!BinaryUtil.getBit(material.getPlanPermission(),7)) {
      throw new CheckedServiceException(CheckedExceptionBusiness.GROUP,CheckedExceptionResult.ILLEGAL_PARAM,"String_Node_Str");
    }
  }
  if (null != material.getProjectPermission()) {
    if (!BinaryUtil.getBit(material.getProjectPermission(),7)) {
      throw new CheckedServiceException(CheckedExceptionBusiness.GROUP,CheckedExceptionResult.ILLEGAL_PARAM,"String_Node_Str");
    }
  }
  if (pmphUser.getIsAdmin() || isFounderOrisAdmin(groupId,sessionId) || material.getDirector() == pmphUser.getId() || textbook.getPlanningEditor() == pmphUser.getId() || pmphUser.getId() == materialProjectEditor.getEditorId()) {
    if (pmphGroupMembers.size() > 0) {
      List<Long> writers=new ArrayList<>();
      List<Long> pmphs=new ArrayList<>();
      for (      PmphGroupMember pmphGroupMember : pmphGroupMembers) {
        PmphGroupMemberVO groupMember=pmphGroupMemberDao.getPmphGroupMemberByMemberId(groupId,pmphGroupMember.getUserId(),pmphGroupMember.getIsWriter());
        if (ObjectUtil.isNull(groupMember)) {
          if (null == pmphGroupMember.getUserId()) {
            throw new CheckedServiceException(CheckedExceptionBusiness.GROUP,CheckedExceptionResult.ILLEGAL_PARAM,"String_Node_Str");
          }
          if (pmphGroupMember.getIsWriter()) {
            WriterUser writerUser=writerUserService.get(pmphGroupMember.getUserId());
            pmphGroupMember.setDisplayName(writerUser.getRealname());
            writers.add(pmphGroupMember.getUserId());
          }
 else {
            PmphUser user=pmphUserService.get(pmphGroupMember.getUserId());
            pmphGroupMember.setDisplayName(user.getRealname());
            pmphs.add(pmphGroupMember.getUserId());
          }
          pmphGroupMember.setGroupId(groupId);
          pmphGroupMemberDao.addPmphGroupMember(pmphGroupMember);
        }
 else {
          if (groupMember.getIsDeleted()) {
            pmphGroupMember.setGroupId(groupId);
            pmphGroupMember.setIsDeleted(false);
            pmphGroupMemberDao.update(pmphGroupMember);
            if (groupMember.getIsWriter()) {
              writers.add(pmphGroupMember.getUserId());
            }
 else {
              pmphs.add(pmphGroupMember.getUserId());
            }
          }
 else {
            throw new CheckedServiceException(CheckedExceptionBusiness.GROUP,CheckedExceptionResult.ILLEGAL_PARAM,"String_Node_Str");
          }
        }
      }
      try {
        if (!writers.isEmpty()) {
          systemMessageService.sendWhenInviteJoinGroup(pmphUser.getRealname(),groupId,writers,(short)2);
        }
        if (!pmphs.isEmpty()) {
          systemMessageService.sendWhenInviteJoinGroup(pmphUser.getRealname(),groupId,pmphs,(short)1);
        }
      }
 catch (      IOException e) {
        throw new CheckedServiceException(CheckedExceptionBusiness.GROUP,CheckedExceptionResult.ILLEGAL_PARAM,"String_Node_Str" + e.getMessage());
      }
      result="String_Node_Str";
    }
 else {
      throw new CheckedServiceException(CheckedExceptionBusiness.GROUP,CheckedExceptionResult.ILLEGAL_PARAM,"String_Node_Str");
    }
  }
 else {
    throw new CheckedServiceException(CheckedExceptionBusiness.GROUP,CheckedExceptionResult.ILLEGAL_PARAM,"String_Node_Str");
  }
  return result;
}