Program: 102484
Project: 102484
Buggy source:
@Override public MessageInfo buildMessageInfo(NotificationMessage message){
  MessageInfo messageInfo=new MessageInfo();
  messageInfo.setFrom(getFrom(message)).setTo(getTo(message));
  ProviderData provider=providerService.getProvider(message.getProviderType());
  String language=getLanguage(message);
  String body=getTemplate(provider,language);
  String subject=getSubject(provider,language);
  PROVIDER_TYPE type=PROVIDER_TYPE.valueOf(message.getProviderType());
  try {
switch (type) {
case ActivityMentionProvider:
{
        String activityId=message.getOwnerParameter().get(ACTIVITY_ID);
        ExoSocialActivity activity=activityManager.getActivity(activityId);
        Identity identity=identityManager.getIdentity(activity.getPosterId(),true);
        messageInfo.setSubject(subject.replace("String_Node_Str",identity.getProfile().getFullName())).setBody(body.replace("String_Node_Str",identity.getProfile().getFullName()).replace("String_Node_Str",activity.getTitle()).replace("String_Node_Str",LinkProviderUtils.getReplyActivityUrl(activity.getId(),message.getSendToUserIds().get(0))).replace("String_Node_Str",LinkProviderUtils.getViewFullDiscussionUrl(activity.getId(),message.getSendToUserIds().get(0))));
        break;
      }
case ActivityCommentProvider:
{
      String activityId=message.getOwnerParameter().get(ACTIVITY_ID);
      ExoSocialActivity activity=activityManager.getActivity(activityId);
      ExoSocialActivity parentActivity=activityManager.getParentActivity(activity);
      Identity identity=identityManager.getIdentity(activity.getPosterId(),true);
      messageInfo.setSubject(subject.replace("String_Node_Str",identity.getProfile().getFullName())).setBody(body.replace("String_Node_Str",identity.getProfile().getFullName()).replace("String_Node_Str",activity.getTitle()).replace("String_Node_Str",parentActivity.getTitle()).replace("String_Node_Str",LinkProviderUtils.getReplyActivityUrl(activity.getId(),message.getSendToUserIds().get(0))).replace("String_Node_Str",LinkProviderUtils.getViewFullDiscussionUrl(activity.getId(),message.getSendToUserIds().get(0))));
      break;
    }
case ActivityLikeProvider:
{
    String activityId=message.getOwnerParameter().get(ACTIVITY_ID);
    ExoSocialActivity activity=activityManager.getActivity(activityId);
    Identity identity=identityManager.getIdentity(message.getFrom(),true);
    messageInfo.setSubject(subject.replace("String_Node_Str",identity.getProfile().getFullName())).setBody(body.replace("String_Node_Str",identity.getProfile().getFullName()).replace("String_Node_Str",activity.getTitle()).replace("String_Node_Str",LinkProviderUtils.getReplyActivityUrl(activity.getId(),message.getSendToUserIds().get(0))).replace("String_Node_Str",LinkProviderUtils.getViewFullDiscussionUrl(activity.getId(),message.getSendToUserIds().get(0))));
    break;
  }
case ActivityPostProvider:
{
  String activityId=message.getOwnerParameter().get(ACTIVITY_ID);
  ExoSocialActivity activity=activityManager.getActivity(activityId);
  Identity identity=identityManager.getIdentity(activity.getPosterId(),true);
  messageInfo.setSubject(subject.replace("String_Node_Str",identity.getProfile().getFullName())).setBody(body.replace("String_Node_Str",identity.getProfile().getFullName()).replace("String_Node_Str",activity.getTitle()).replace("String_Node_Str",LinkProviderUtils.getReplyActivityUrl(activity.getId(),message.getSendToUserIds().get(0))).replace("String_Node_Str",LinkProviderUtils.getViewFullDiscussionUrl(activity.getId(),message.getSendToUserIds().get(0))));
  break;
}
case ActivityPostSpaceProvider:
{
String activityId=message.getOwnerParameter().get(ACTIVITY_ID);
ExoSocialActivity activity=activityManager.getActivity(activityId);
Identity identity=identityManager.getIdentity(activity.getPosterId(),true);
Identity spaceIdentity=identityManager.getOrCreateIdentity(SpaceIdentityProvider.NAME,activity.getStreamOwner(),true);
messageInfo.setSubject(subject.replace("String_Node_Str",identity.getProfile().getFullName()).replace("String_Node_Str",spaceIdentity.getProfile().getFullName())).setBody(body.replace("String_Node_Str",identity.getProfile().getFullName()).replace("String_Node_Str",activity.getTitle()).replace("String_Node_Str",spaceIdentity.getProfile().getFullName()).replace("String_Node_Str",LinkProviderUtils.getReplyActivityUrl(activity.getId(),message.getSendToUserIds().get(0))).replace("String_Node_Str",LinkProviderUtils.getViewFullDiscussionUrl(activity.getId(),message.getSendToUserIds().get(0))));
break;
}
case InvitedJoinSpace:
{
String spaceId=message.getOwnerParameter().get(SPACE_ID);
Space space=spaceService.getSpaceById(spaceId);
messageInfo.setSubject(subject.replace("String_Node_Str",space.getPrettyName())).setBody(body.replace("String_Node_Str",space.getPrettyName()).replace("String_Node_Str",space.getAvatarUrl()).replace("String_Node_Str",LinkProviderUtils.getAcceptInvitationToJoinSpaceUrl(space.getId(),message.getSendToUserIds().get(0))).replace("String_Node_Str",LinkProviderUtils.getIgnoreInvitationToJoinSpaceUrl(space.getId(),message.getSendToUserIds().get(0))));
break;
}
case RequestJoinSpace:
{
String spaceId=message.getOwnerParameter().get(SPACE_ID);
Space space=spaceService.getSpaceById(spaceId);
Identity identity=identityManager.getOrCreateIdentity(OrganizationIdentityProvider.NAME,message.getFrom(),true);
Profile userProfile=identity.getProfile();
messageInfo.setSubject(subject.replace("String_Node_Str",space.getPrettyName()).replace("String_Node_Str",userProfile.getFullName())).setBody(body.replace("String_Node_Str",space.getPrettyName()).replace("String_Node_Str",userProfile.getFullName()).replace("String_Node_Str",userProfile.getAvatarUrl()).replace("String_Node_Str",LinkProviderUtils.getValidateRequestToJoinSpaceUrl(space.getId(),identity.getRemoteId())));
break;
}
case NewUserJoinSocialIntranet:
{
break;
}
case ReceiceConnectionRequest:
{
Identity identity=identityManager.getOrCreateIdentity(OrganizationIdentityProvider.NAME,message.getFrom(),true);
Profile userProfile=identity.getProfile();
messageInfo.setSubject(subject.replace("String_Node_Str",userProfile.getFullName())).setBody(body.replace("String_Node_Str",userProfile.getFullName()).replace("String_Node_Str",userProfile.getAvatarUrl()).replace("String_Node_Str",LinkProviderUtils.getConfirmInvitationToConnectUrl(message.getFrom(),message.getSendToUserIds().get(0))).replace("String_Node_Str",LinkProviderUtils.getIgnoreInvitationToConnectUrl(message.getFrom(),message.getSendToUserIds().get(0))));
break;
}
}
}
 catch (Exception e) {
LOG.error("String_Node_Str" + provider.getType(),e);
return null;
}
return messageInfo;
}

Fixed version (ground truth):
@Override public MessageInfo buildMessageInfo(NotificationMessage message){
  MessageInfo messageInfo=new MessageInfo();
  messageInfo.setFrom(getFrom(message)).setTo(getTo(message));
  ProviderData provider=providerService.getProvider(message.getProviderType());
  String language=getLanguage(message);
  String body=getTemplate(provider,language);
  String subject=getSubject(provider,language);
  PROVIDER_TYPE type=PROVIDER_TYPE.valueOf(message.getProviderType());
  try {
switch (type) {
case ActivityMentionProvider:
{
        String activityId=message.getOwnerParameter().get(ACTIVITY_ID);
        ExoSocialActivity activity=activityManager.getActivity(activityId);
        Identity identity=identityManager.getIdentity(activity.getPosterId(),true);
        messageInfo.setSubject(subject.replace("String_Node_Str",identity.getProfile().getFullName())).setBody(body.replace("String_Node_Str",identity.getProfile().getFullName()).replace("String_Node_Str",activity.getTitle()).replace("String_Node_Str",LinkProviderUtils.getReplyActivityUrl(activity.getId(),message.getSendToUserIds().get(0))).replace("String_Node_Str",LinkProviderUtils.getViewFullDiscussionUrl(activity.getId(),message.getSendToUserIds().get(0))));
        break;
      }
case ActivityCommentProvider:
{
      String activityId=message.getOwnerParameter().get(ACTIVITY_ID);
      ExoSocialActivity activity=activityManager.getActivity(activityId);
      ExoSocialActivity parentActivity=activityManager.getParentActivity(activity);
      Identity identity=identityManager.getIdentity(activity.getPosterId(),true);
      messageInfo.setSubject(subject.replace("String_Node_Str",identity.getProfile().getFullName())).setBody(body.replace("String_Node_Str",identity.getProfile().getFullName()).replace("String_Node_Str",activity.getTitle()).replace("String_Node_Str",parentActivity.getTitle()).replace("String_Node_Str",LinkProviderUtils.getReplyActivityUrl(activity.getId(),message.getSendToUserIds().get(0))).replace("String_Node_Str",LinkProviderUtils.getViewFullDiscussionUrl(activity.getId(),message.getSendToUserIds().get(0))));
      break;
    }
case ActivityLikeProvider:
{
    String activityId=message.getOwnerParameter().get(ACTIVITY_ID);
    ExoSocialActivity activity=activityManager.getActivity(activityId);
    Identity identity=identityManager.getIdentity(message.getFrom(),true);
    messageInfo.setSubject(subject.replace("String_Node_Str",identity.getProfile().getFullName())).setBody(body.replace("String_Node_Str",identity.getProfile().getFullName()).replace("String_Node_Str",activity.getTitle()).replace("String_Node_Str",LinkProviderUtils.getReplyActivityUrl(activity.getId(),message.getSendToUserIds().get(0))).replace("String_Node_Str",LinkProviderUtils.getViewFullDiscussionUrl(activity.getId(),message.getSendToUserIds().get(0))));
    break;
  }
case ActivityPostProvider:
{
  String activityId=message.getOwnerParameter().get(ACTIVITY_ID);
  ExoSocialActivity activity=activityManager.getActivity(activityId);
  Identity identity=identityManager.getIdentity(activity.getPosterId(),true);
  messageInfo.setSubject(subject.replace("String_Node_Str",identity.getProfile().getFullName())).setBody(body.replace("String_Node_Str",identity.getProfile().getFullName()).replace("String_Node_Str",activity.getTitle()).replace("String_Node_Str",LinkProviderUtils.getReplyActivityUrl(activity.getId(),message.getSendToUserIds().get(0))).replace("String_Node_Str",LinkProviderUtils.getViewFullDiscussionUrl(activity.getId(),message.getSendToUserIds().get(0))));
  break;
}
case ActivityPostSpaceProvider:
{
String activityId=message.getOwnerParameter().get(ACTIVITY_ID);
ExoSocialActivity activity=activityManager.getActivity(activityId);
Identity identity=identityManager.getIdentity(activity.getPosterId(),true);
Identity spaceIdentity=identityManager.getOrCreateIdentity(SpaceIdentityProvider.NAME,activity.getStreamOwner(),true);
messageInfo.setSubject(subject.replace("String_Node_Str",identity.getProfile().getFullName()).replace("String_Node_Str",spaceIdentity.getProfile().getFullName())).setBody(body.replace("String_Node_Str",identity.getProfile().getFullName()).replace("String_Node_Str",activity.getTitle()).replace("String_Node_Str",spaceIdentity.getProfile().getFullName()).replace("String_Node_Str",LinkProviderUtils.getReplyActivityUrl(activity.getId(),message.getSendToUserIds().get(0))).replace("String_Node_Str",LinkProviderUtils.getViewFullDiscussionUrl(activity.getId(),message.getSendToUserIds().get(0))));
break;
}
case InvitedJoinSpace:
{
String spaceId=message.getOwnerParameter().get(SPACE_ID);
Space space=spaceService.getSpaceById(spaceId);
messageInfo.setSubject(subject.replace("String_Node_Str",space.getPrettyName())).setBody(body.replace("String_Node_Str",space.getPrettyName()).replace("String_Node_Str",LinkProviderUtils.getSpaceAvatarUrl(space)).replace("String_Node_Str",LinkProviderUtils.getAcceptInvitationToJoinSpaceUrl(space.getId(),message.getSendToUserIds().get(0))).replace("String_Node_Str",LinkProviderUtils.getIgnoreInvitationToJoinSpaceUrl(space.getId(),message.getSendToUserIds().get(0))));
break;
}
case RequestJoinSpace:
{
String spaceId=message.getOwnerParameter().get(SPACE_ID);
Space space=spaceService.getSpaceById(spaceId);
Identity identity=identityManager.getOrCreateIdentity(OrganizationIdentityProvider.NAME,message.getFrom(),true);
Profile userProfile=identity.getProfile();
messageInfo.setSubject(subject.replace("String_Node_Str",space.getPrettyName()).replace("String_Node_Str",userProfile.getFullName())).setBody(body.replace("String_Node_Str",space.getPrettyName()).replace("String_Node_Str",userProfile.getFullName()).replace("String_Node_Str",LinkProviderUtils.getUserAvatarUrl(userProfile)).replace("String_Node_Str",LinkProviderUtils.getValidateRequestToJoinSpaceUrl(space.getId(),identity.getRemoteId())));
break;
}
case NewUserJoinSocialIntranet:
{
break;
}
case ReceiceConnectionRequest:
{
Identity identity=identityManager.getOrCreateIdentity(OrganizationIdentityProvider.NAME,message.getFrom(),true);
Profile userProfile=identity.getProfile();
messageInfo.setSubject(subject.replace("String_Node_Str",userProfile.getFullName())).setBody(body.replace("String_Node_Str",userProfile.getFullName()).replace("String_Node_Str",LinkProviderUtils.getUserAvatarUrl(userProfile)).replace("String_Node_Str",LinkProviderUtils.getConfirmInvitationToConnectUrl(message.getFrom(),message.getSendToUserIds().get(0))).replace("String_Node_Str",LinkProviderUtils.getIgnoreInvitationToConnectUrl(message.getFrom(),message.getSendToUserIds().get(0))));
break;
}
}
}
 catch (Exception e) {
LOG.error("String_Node_Str" + provider.getType(),e);
return null;
}
return messageInfo;
}