Program: 102546
Project: 102546
Buggy source:
/** 
 * Comment an existing activity from a specified activity ID. Just returns the created comment.
 * @param uriInfo The uri request uri
 * @param portalName The associated portal container name.
 * @param activityId The specified activity ID.
 * @param format The expected returned format.
 * @param text The content of comment.
 * @return a response object
 */
@GET @Path("String_Node_Str") public Response createCommentActivityById(@Context UriInfo uriInfo,@PathParam("String_Node_Str") String portalName,@PathParam("String_Node_Str") String activityId,@PathParam("String_Node_Str") String format,@QueryParam("String_Node_Str") String text){
  PortalContainer portalContainer=RestChecker.checkValidPortalContainerName(portalName);
  if (text == null || text.trim().equals("String_Node_Str")) {
    throw new WebApplicationException(Response.Status.BAD_REQUEST);
  }
  MediaType mediaType=RestChecker.checkSupportedFormat(format,new String[]{"String_Node_Str"});
  Identity currentIdentity=Util.getIdentityManager(portalName).getOrCreateIdentity(OrganizationIdentityProvider.NAME,Util.getViewerId(uriInfo),false);
  ActivityManager activityManager=Util.getActivityManager(portalName);
  ExoSocialActivity activity=null;
  try {
    activity=activityManager.getActivity(activityId);
  }
 catch (  UndeclaredThrowableException undeclaredThrowableException) {
    if (undeclaredThrowableException.getCause() instanceof ActivityStorageException) {
      throw new WebApplicationException(Response.Status.NOT_FOUND);
    }
 else {
      throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR);
    }
  }
  ExoSocialActivity commentActivity=new ExoSocialActivityImpl();
  commentActivity.setTitle(text);
  commentActivity.setUserId(currentIdentity.getId());
  activityManager.saveComment(activity,commentActivity);
  CommentRestOut commentOut=new CommentRestOut(commentActivity,portalName);
  return Util.getResponse(commentOut,uriInfo,mediaType,Response.Status.OK);
}

Fixed version (ground truth):
/** 
 * Comment an existing activity from a specified activity Id. Just returns the created comment.
 * @param uriInfo The uri request uri
 * @param portalName The associated portal container name.
 * @param activityId The specified activity Id.
 * @param format The expected returned format.
 * @param text The content of comment.
 * @return a response object
 */
@GET @Path("String_Node_Str") public Response createCommentActivityById(@Context UriInfo uriInfo,@PathParam("String_Node_Str") String portalName,@PathParam("String_Node_Str") String activityId,@PathParam("String_Node_Str") String format,@QueryParam("String_Node_Str") String text){
  PortalContainer portalContainer=RestChecker.checkValidPortalContainerName(portalName);
  if (text == null || text.trim().equals("String_Node_Str")) {
    throw new WebApplicationException(Response.Status.BAD_REQUEST);
  }
  MediaType mediaType=RestChecker.checkSupportedFormat(format,new String[]{"String_Node_Str"});
  Identity currentIdentity=Util.getIdentityManager(portalName).getOrCreateIdentity(OrganizationIdentityProvider.NAME,Util.getViewerId(uriInfo),false);
  ActivityManager activityManager=Util.getActivityManager(portalName);
  ExoSocialActivity activity=null;
  try {
    activity=activityManager.getActivity(activityId);
  }
 catch (  UndeclaredThrowableException undeclaredThrowableException) {
    if (undeclaredThrowableException.getCause() instanceof ActivityStorageException) {
      throw new WebApplicationException(Response.Status.NOT_FOUND);
    }
 else {
      throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR);
    }
  }
  ExoSocialActivity commentActivity=new ExoSocialActivityImpl();
  commentActivity.setTitle(text);
  commentActivity.setUserId(currentIdentity.getId());
  activityManager.saveComment(activity,commentActivity);
  CommentRestOut commentOut=new CommentRestOut(commentActivity,portalName);
  return Util.getResponse(commentOut,uriInfo,mediaType,Response.Status.OK);
}