Program: 102554
Project: 102554
Buggy source:
/** 
 * Delete an existing comment by its ID.
 * @param uriInfo The uri request uri
 * @param portalContainerName The associated portal container name.
 * @param activityId The specified activity ID.
 * @param format The expected returned format.
 * @anchor SOCref.DevelopersReferences.RestService_APIs_v1alpha3.ActivityResource.Activitycomments.Delete
 * @authenticated
 * @request {code} DELETE: http://cloud-workspaces.com/rest/private/api/social/v1-alpha3/portal/activity/1a2b3c4d5e/comment/123456.json {code}
 * @response {code:json} { "id": "123456" "identityId": "12345abcde", "text": "My comment here!!!", "postedTime": 123456789, "createdAt": "Fri Jun 17 06:42:26 +0000 2011" } {code}
 * @return a response object
 */
@DELETE @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) public Response deleteCommentById(@Context UriInfo uriInfo,@PathParam("String_Node_Str") String portalContainerName,@PathParam("String_Node_Str") String activityId,@PathParam("String_Node_Str") String format,@PathParam("String_Node_Str") String commentId){
  RestChecker.checkAuthenticatedRequest();
  PortalContainer portalContainer=RestChecker.checkValidPortalContainerName(portalContainerName);
  MediaType mediaType=RestChecker.checkSupportedFormat(format,SUPPORTED_FORMAT);
  Identity authenticatedIdentity=Util.getAuthenticatedUserIdentity(portalContainerName);
  ActivityManager activityManager=Util.getActivityManager(portalContainerName);
  ExoSocialActivity commentActivity=null;
  ExoSocialActivity activity=null;
  try {
    activity=activityManager.getActivity(activityId);
    commentActivity=activityManager.getActivity(commentId);
  }
 catch (  UndeclaredThrowableException undeclaredThrowableException) {
    if (undeclaredThrowableException.getCause() instanceof ActivityStorageException) {
      throw new WebApplicationException(Response.Status.NOT_FOUND);
    }
 else {
      throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR);
    }
  }
  if (!commentActivity.isComment()) {
    throw new WebApplicationException(Response.Status.NOT_FOUND);
  }
  if (!SecurityManager.canDeleteActivity(portalContainer,authenticatedIdentity,commentActivity)) {
    throw new WebApplicationException(Response.Status.FORBIDDEN);
  }
  activityManager.deleteComment(activity,commentActivity);
  HashMap<String,Object> resultHashmap=new HashMap<String,Object>();
  resultHashmap.put("String_Node_Str",commentActivity.getId());
  return Util.getResponse(resultHashmap,uriInfo,mediaType,Response.Status.OK);
}

Fixed version (ground truth):
/** 
 * Delete an existing comment by its Id.
 * @param uriInfo The uri request uri
 * @param portalContainerName The associated portal container name.
 * @param activityId The specified activity Id.
 * @param format The expected returned format.
 * @anchor SOCref.DevelopersReferences.RestService_APIs_v1alpha3.ActivityResource.Activitycomments.Delete
 * @authenticated
 * @request {code} DELETE: http://cloud-workspaces.com/rest/private/api/social/v1-alpha3/portal/activity/1a2b3c4d5e/comment/123456.json {code}
 * @response {code:json} { "id": "123456" "identityId": "12345abcde", "text": "My comment here!!!", "postedTime": 123456789, "createdAt": "Fri Jun 17 06:42:26 +0000 2011" } {code}
 * @return a response object
 */
@DELETE @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) public Response deleteCommentById(@Context UriInfo uriInfo,@PathParam("String_Node_Str") String portalContainerName,@PathParam("String_Node_Str") String activityId,@PathParam("String_Node_Str") String format,@PathParam("String_Node_Str") String commentId){
  RestChecker.checkAuthenticatedRequest();
  PortalContainer portalContainer=RestChecker.checkValidPortalContainerName(portalContainerName);
  MediaType mediaType=RestChecker.checkSupportedFormat(format,SUPPORTED_FORMAT);
  Identity authenticatedIdentity=Util.getAuthenticatedUserIdentity(portalContainerName);
  ActivityManager activityManager=Util.getActivityManager(portalContainerName);
  ExoSocialActivity commentActivity=null;
  ExoSocialActivity activity=null;
  try {
    activity=activityManager.getActivity(activityId);
    commentActivity=activityManager.getActivity(commentId);
  }
 catch (  UndeclaredThrowableException undeclaredThrowableException) {
    if (undeclaredThrowableException.getCause() instanceof ActivityStorageException) {
      throw new WebApplicationException(Response.Status.NOT_FOUND);
    }
 else {
      throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR);
    }
  }
  if (!commentActivity.isComment()) {
    throw new WebApplicationException(Response.Status.NOT_FOUND);
  }
  if (!SecurityManager.canDeleteActivity(portalContainer,authenticatedIdentity,commentActivity)) {
    throw new WebApplicationException(Response.Status.FORBIDDEN);
  }
  activityManager.deleteComment(activity,commentActivity);
  HashMap<String,Object> resultHashmap=new HashMap<String,Object>();
  resultHashmap.put("String_Node_Str",commentActivity.getId());
  return Util.getResponse(resultHashmap,uriInfo,mediaType,Response.Status.OK);
}