Program: 101102
Project: 101102
Buggy source:
@Override public MessageInfo buildMessageInfo(NotificationMessage message){
  MessageInfo messageInfo=new MessageInfo();
  messageInfo.setFrom(getFrom(message)).setTo(getTo(message));
  Provider 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());
switch (type) {
case ActivityMentionProvider:
{
      String activityId=message.getOwnerParameter().get(ACTIVITY_ID);
      ExoSocialActivity activity=activityManager.getActivity(activityId);
      Identity identity=identityManager.getOrCreateIdentity(OrganizationIdentityProvider.NAME,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(),Util.getPortalRequestContext().getRemoteUser())).replace("String_Node_Str",LinkProviderUtils.getReplyActivityUrl(activity.getId(),Util.getPortalRequestContext().getRemoteUser())));
      break;
    }
case ActivityCommentProvider:
{
    String activityId=message.getOwnerParameter().get(ACTIVITY_ID);
    ExoSocialActivity activity=activityManager.getActivity(activityId);
    ExoSocialActivity parentActivity=activityManager.getParentActivity(activity);
    Identity identity=identityManager.getOrCreateIdentity(OrganizationIdentityProvider.NAME,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(),Util.getPortalRequestContext().getRemoteUser())).replace("String_Node_Str",LinkProviderUtils.getReplyActivityUrl(activity.getId(),Util.getPortalRequestContext().getRemoteUser())));
    break;
  }
case ActivityPostProvider:
{
  String activityId=message.getOwnerParameter().get(ACTIVITY_ID);
  ExoSocialActivity activity=activityManager.getActivity(activityId);
  Identity identity=identityManager.getOrCreateIdentity(OrganizationIdentityProvider.NAME,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(),Util.getPortalRequestContext().getRemoteUser())).replace("String_Node_Str",LinkProviderUtils.getReplyActivityUrl(activity.getId(),Util.getPortalRequestContext().getRemoteUser())));
  break;
}
case ActivityPostSpaceProvider:
{
String activityId=message.getOwnerParameter().get(ACTIVITY_ID);
ExoSocialActivity activity=activityManager.getActivity(activityId);
Identity identity=identityManager.getOrCreateIdentity(OrganizationIdentityProvider.NAME,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(),Util.getPortalRequestContext().getRemoteUser())).replace("String_Node_Str",LinkProviderUtils.getReplyActivityUrl(activity.getId(),Util.getPortalRequestContext().getRemoteUser())));
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(),getTo(message))).replace("String_Node_Str",LinkProviderUtils.getIgnoreInvitationToJoinSpaceUrl(space.getId(),getTo(message))));
break;
}
case RequestJoinSpace:
{
String spaceId=message.getOwnerParameter().get(SPACE_ID);
Space space=spaceService.getSpaceById(spaceId);
Identity identity=identityManager.getOrCreateIdentity(OrganizationIdentityProvider.NAME,getFrom(message),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,getFrom(message),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(getFrom(message),getTo(message))).replace("String_Node_Str",LinkProviderUtils.getIgnoreInvitationToConnectUrl(getFrom(message),getTo(message))));
break;
}
}
return messageInfo;
}

Fixed version (ground truth):
@Override public MessageInfo buildMessageInfo(NotificationMessage message){
  MessageInfo messageInfo=new MessageInfo();
  messageInfo.setFrom(getFrom(message)).setTo(getTo(message));
  Provider 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());
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(),Util.getPortalRequestContext().getRemoteUser())).replace("String_Node_Str",LinkProviderUtils.getViewFullDiscussionUrl(activity.getId(),Util.getPortalRequestContext().getRemoteUser())));
      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(),Util.getPortalRequestContext().getRemoteUser())).replace("String_Node_Str",LinkProviderUtils.getViewFullDiscussionUrl(activity.getId(),Util.getPortalRequestContext().getRemoteUser())));
    break;
  }
case ActivityLikeProvider:
{
  String activityId=message.getOwnerParameter().get(ACTIVITY_ID);
  ExoSocialActivity activity=activityManager.getActivity(activityId);
  Identity identity=identityManager.getIdentity(getFrom(message),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(),Util.getPortalRequestContext().getRemoteUser())).replace("String_Node_Str",LinkProviderUtils.getViewFullDiscussionUrl(activity.getId(),Util.getPortalRequestContext().getRemoteUser())));
  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(),Util.getPortalRequestContext().getRemoteUser())).replace("String_Node_Str",LinkProviderUtils.getViewFullDiscussionUrl(activity.getId(),Util.getPortalRequestContext().getRemoteUser())));
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(),Util.getPortalRequestContext().getRemoteUser())).replace("String_Node_Str",LinkProviderUtils.getViewFullDiscussionUrl(activity.getId(),Util.getPortalRequestContext().getRemoteUser())));
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(),getTo(message))).replace("String_Node_Str",LinkProviderUtils.getIgnoreInvitationToJoinSpaceUrl(space.getId(),getTo(message))));
break;
}
case RequestJoinSpace:
{
String spaceId=message.getOwnerParameter().get(SPACE_ID);
Space space=spaceService.getSpaceById(spaceId);
Identity identity=identityManager.getOrCreateIdentity(OrganizationIdentityProvider.NAME,getFrom(message),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,getFrom(message),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(getFrom(message),getTo(message))).replace("String_Node_Str",LinkProviderUtils.getIgnoreInvitationToConnectUrl(getFrom(message),getTo(message))));
break;
}
}
return messageInfo;
}