Program: 102553
Project: 102553
Buggy source:
/** 
 * Allow an authenticated identity to do the "like" action on an existing 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.Post
 * @authentication
 * @request {code} POST: http://cloud-workspaces.com/rest/private/api/social/v1-alpha3/portal/activity/1a2b3c4d5e/like.json {code}
 * @response {code:json} { "liked": true } {code}
 * @return a response object
 */
@POST @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) public Response createLikeActivityById(@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.saveLike(activity,authenticatedUserIdentity);
  HashMap resultJson=new HashMap();
  resultJson.put("String_Node_Str",true);
  return Util.getResponse(resultJson,uriInfo,mediaType,Response.Status.OK);
}

Fixed version (ground truth):
/** 
 * Allow an authenticated identity to do the "like" action on an existing 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.Post
 * @authentication
 * @request {code} POST: http://cloud-workspaces.com/rest/private/api/social/v1-alpha3/portal/activity/1a2b3c4d5e/like.json {code}
 * @response {code:json} { "liked": true } {code}
 * @return a response object
 */
@POST @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) public Response createLikeActivityById(@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.saveLike(activity,authenticatedUserIdentity);
  HashMap resultJson=new HashMap();
  resultJson.put("String_Node_Str",true);
  return Util.getResponse(resultJson,uriInfo,mediaType,Response.Status.OK);
}