Program: 102559
Project: 102559
Buggy source:
/** 
 * Allow an identity to remove his "like" action on an activity.
 * @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.ActivityLike.Delete
 * @authentication
 * @request {code} DELETE: http://cloud-workspaces.com/rest/private/api/social/v1-alpha3/portal/activity/1a2b3c4d5e/like.json {code}
 * @response {code:json} { "liked": false } {code}
 * @return a response object
 */
@DELETE @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) public Response deleteLikeActivityById(@Context UriInfo uriInfo,@PathParam("String_Node_Str") String portalContainerName,@PathParam("String_Node_Str") String activityId,@PathParam("String_Node_Str") String format){
  RestChecker.checkAuthenticatedRequest();
  PortalContainer portalContainer=RestChecker.checkValidPortalContainerName(portalContainerName);
  MediaType mediaType=RestChecker.checkSupportedFormat(format,SUPPORTED_FORMAT);
  Identity authenticatedUserIdentity=Util.getAuthenticatedUserIdentity(portalContainerName);
  ActivityManager activityManager=Util.getActivityManager(portalContainerName);
  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);
    }
  }
  if (!SecurityManager.canCommentToActivity(portalContainer,authenticatedUserIdentity,activity)) {
    throw new WebApplicationException(Response.Status.FORBIDDEN);
  }
  activityManager.deleteLike(activity,authenticatedUserIdentity);
  HashMap resultJson=new HashMap();
  resultJson.put("String_Node_Str",false);
  return Util.getResponse(resultJson,uriInfo,mediaType,Response.Status.OK);
}

Fixed version (ground truth):
/** 
 * Allow an identity to remove his "like" action on an activity.
 * @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.ActivityLike.Delete
 * @authentication
 * @request {code} DELETE: http://cloud-workspaces.com/rest/private/api/social/v1-alpha3/portal/activity/1a2b3c4d5e/like.json {code}
 * @response {code:json} { "liked": false } {code}
 * @return a response object
 */
@DELETE @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) public Response deleteLikeActivityById(@Context UriInfo uriInfo,@PathParam("String_Node_Str") String portalContainerName,@PathParam("String_Node_Str") String activityId,@PathParam("String_Node_Str") String format){
  RestChecker.checkAuthenticatedRequest();
  PortalContainer portalContainer=RestChecker.checkValidPortalContainerName(portalContainerName);
  MediaType mediaType=RestChecker.checkSupportedFormat(format,SUPPORTED_FORMAT);
  Identity authenticatedUserIdentity=Util.getAuthenticatedUserIdentity(portalContainerName);
  ActivityManager activityManager=Util.getActivityManager(portalContainerName);
  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);
    }
  }
  if (!SecurityManager.canCommentToActivity(portalContainer,authenticatedUserIdentity,activity)) {
    throw new WebApplicationException(Response.Status.FORBIDDEN);
  }
  activityManager.deleteLike(activity,authenticatedUserIdentity);
  HashMap resultJson=new HashMap();
  resultJson.put("String_Node_Str",false);
  return Util.getResponse(resultJson,uriInfo,mediaType,Response.Status.OK);
}