Program: 102539
Project: 102539
Buggy source:
/** 
 * Get the activity stream feed of the authenticated user identity who makes this request.
 * @param uriInfo             The uri info
 * @param portalContainerName The portal container name
 * @param format              The response format type, for example: json, xml...
 * @param limit               Specify the number of activities to retrieve. It must be less than or equal to 100.The value you pass as limit is a maximum number of activities to be returned. The actual number of activities you receive maybe less than limit. If no specified, 100 will be the default value.
 * @param sinceId             Return the activities having the created timestamps greater thanthe specified sinceId's created timestamp
 * @param maxId               Return the activities having the created timestamp less than the specified maxId's createdtimestamp. Note that sinceId and maxId must not be defined in one request, if they are, the sinceId query param is chosen.
 * @param numberOfComments    Specify the latest number of comments to be displayed along with each activity.By default, numberOfComments=0. If numberOfComments is a positive number, this number is considered as a limit number that must be equal or less than 100. If the actual number of comments is less than the provided positive number, the number of actual comments must be returned. If the total number of comments is more than 100, it's recommended to use: "activity/:activityId/comments.format" instead
 * @param numberOfLikes       Specify the latest number of detailed likes to be returned along with this activity.By default, numberOfLikes=0. If numberOfLikes is a positive number, this number is considered as a limit number that must be equal or less than 100. If the actual number of likes is less than the provided positive number, the number of actual likes must be returned. If the total number of likes is more than 100, it's recommended to use: "activity/:activityId/likes.format" instead.
 * @anchor SOCref.DevRef.V1alpha3.ActivityStreamResource.Feed.Getlastest
 * @authenticated
 * @request {code} GET: http://cloud-workspaces.com/rest/private/api/social/v1-alpha3/socialdemo/activity_stream/feed.json?limit=30&since_id=12345&number_of_comments=5&number_of_likes=5 {code}
 * @response {code:json} { "activities":[ { "id":"1a2b3c4d5e6f7g8h9j", "title":"Hello World!!!", "appId":"", "type":"DEFAULT_ACTIVITY", "postedTime":123456789, "createdAt":"Fri Jun 17 06:42:26 +0000 2011", "priority":0.5, "templateParams":{ }, "titleId":"", "body": "", "identityId":"123456789abcdefghi", "liked":true, "likedByIdentities":[ { "id":"123456313efghi", "providerId":"organization", "remoteId":"demo", "profile":{ "fullName":"Demo GTN", "avatarUrl":"http://localhost:8080/profile/u/demo/avatar.jpg?u=12345" } } ], "totalNumberOfLikes":20, "posterIdentity":{ "id":"123456313efghi", "providerId":"organization", "remoteId":"demo", "profile":{ "fullName":"Demo GTN", "avatarUrl":"http://localhost:8080/profile/u/demo/avatar.jpg?u=12345" } }, "comments":[ { } ], "totalNumberOfComments":1234, "activityStream":{ "type":"user", "prettyId":"root", "fullName": "Root Root", "faviconUrl":"http://demo3.exoplatform.org/favicons/exo-default.jpg", "title":"Activity Stream of Root Root", "permaLink":"http://localhost:8080/profile/root" } }, { "id":"1a210983123f7g8h9j", "title":"Hello World 1!!!", "appId":"", "type":"DEFAULT_ACTIVITY", "postedTime":123456789, "createdAt":"Fri Jun 19 06:42:26 +0000 2011", "priority":0.5, "templateParams":{ }, "titleId":"", "body": "", "identityId":"123456789abcdefghi", "liked":true, "likedByIdentities":[ { "id":"123456313efghi", "providerId":"organization", "remoteId":"demo", "profile":{ "fullName":"Demo GTN", "avatarUrl":"http://localhost:8080/profile/u/demo/avatar.jpg?u=12345" } } ], "totalNumberOfLikes":20, "posterIdentity":{ "id":"123456313efghi", "providerId":"organization", "remoteId":"demo", "profile":{ "fullName":"Demo GTN", "avatarUrl":"http://localhost:8080/profile/u/demo/avatar.jpg?u=12345" } }, "comments":[ { } ], "totalNumberOfComments":1234, "activityStream":{ "type":"user", "prettyId":"root", "fullName": "Root Root", "faviconUrl":"http://demo3.exoplatform.org/favicons/exo-default.jpg", "title":"Activity Stream of Root Root", "permaLink":"http://localhost:8080/profile/root" } } ] } {code}
 * @return the response
 */
@GET @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) public Response getActivityFeedOfAuthenticated(@Context UriInfo uriInfo,@PathParam("String_Node_Str") String portalContainerName,@PathParam("String_Node_Str") String format,@QueryParam("String_Node_Str") int limit,@QueryParam("String_Node_Str") String sinceId,@QueryParam("String_Node_Str") String maxId,@QueryParam("String_Node_Str") int numberOfComments,@QueryParam("String_Node_Str") int numberOfLikes){
  checkAuthenticatedRequest();
  checkValidPortalContainerName(portalContainerName);
  MediaType mediaType=checkSupportedFormat(format,SUPPORTED_FORMATS);
  Identity sourceIdentity=Util.getAuthenticatedUserIdentity(portalContainerName);
  int maxLimit=limit <= 0 ? MAX_LIMIT : Math.min(limit,MAX_LIMIT);
  ActivityManager activityManager=Util.getActivityManager(portalContainerName);
  ExoSocialActivity newerActivity=null;
  ExoSocialActivity olderActivity=null;
  try {
    if (sinceId != null && !sinceId.trim().equals("String_Node_Str")) {
      newerActivity=activityManager.getActivity(sinceId);
    }
 else     if (maxId != null && !maxId.trim().equals("String_Node_Str")) {
      olderActivity=activityManager.getActivity(maxId);
    }
  }
 catch (  UndeclaredThrowableException e) {
    if (e.getCause() instanceof ActivityStorageException) {
      throw new WebApplicationException(Response.Status.NOT_FOUND);
    }
 else {
      throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR);
    }
  }
  RealtimeListAccess<ExoSocialActivity> listAccess=null;
  List<ExoSocialActivity> activities=null;
  try {
    listAccess=activityManager.getActivityFeedWithListAccess(sourceIdentity);
    if (newerActivity != null) {
      activities=listAccess.loadNewer(newerActivity,maxLimit);
    }
 else     if (olderActivity != null) {
      activities=listAccess.loadOlder(olderActivity,maxLimit);
    }
 else {
      activities=listAccess.loadAsList(0,maxLimit);
    }
  }
 catch (  Exception e) {
    throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR);
  }
  ActivityRestListOut activityRestListOut=new ActivityRestListOut(activities,numberOfComments,numberOfLikes,portalContainerName);
  return Util.getResponse(activityRestListOut,uriInfo,mediaType,Response.Status.OK);
}

Fixed version (ground truth):
/** 
 * Get the activity stream feed of the authenticated user identity who makes this request.
 * @param uriInfo             The URI information.
 * @param portalContainerName The portal container name.
 * @param format              The response format type, for example: JSON, or XML.
 * @param limit               Specify the number of activities to retrieve. It must be less than or equal to 100.The value you pass as limit is a maximum number of activities to be returned. The actual number of activities you receive maybe less than limit. If no specified, 100 will be the default value.
 * @param sinceId             Return the activities having the created timestamps greater thanthe specified sinceId's created timestamp.
 * @param maxId               Return the activities having the created timestamp less than the specified maxId's createdtimestamp. Note that sinceId and maxId must not be defined in one request, if they are, the sinceId query param is chosen.
 * @param numberOfComments    Specify the latest number of comments to be displayed along with each activity.By default, numberOfComments=0. If numberOfComments is a positive number, this number is considered as a limit number that must be equal or less than 100. If the actual number of comments is less than the provided positive number, the number of actual comments must be returned. If the total number of comments is more than 100, it's recommended to use: "activity/:activityId/comments.format" instead.
 * @param numberOfLikes       Specify the latest number of detailed likes to be returned along with this activity.By default, numberOfLikes=0. If numberOfLikes is a positive number, this number is considered as a limit number that must be equal or less than 100. If the actual number of likes is less than the provided positive number, the number of actual likes must be returned. If the total number of likes is more than 100, it's recommended to use: "activity/:activityId/likes.format" instead.
 * @anchor SOCref.DevRef.V1alpha3.ActivityStreamResource.Feed.Getlastest
 * @authenticated
 * @request {code} GET: http://cloud-workspaces.com/rest/private/api/social/v1-alpha3/socialdemo/activity_stream/feed.json?limit=30&since_id=12345&number_of_comments=5&number_of_likes=5 {code}
 * @response {code:json} { "activities":[ { "id":"1a2b3c4d5e6f7g8h9j", "title":"Hello World!!!", "appId":"", "type":"DEFAULT_ACTIVITY", "postedTime":123456789, "createdAt":"Fri Jun 17 06:42:26 +0000 2011", "priority":0.5, "templateParams":{ }, "titleId":"", "body": "", "identityId":"123456789abcdefghi", "liked":true, "likedByIdentities":[ { "id":"123456313efghi", "providerId":"organization", "remoteId":"demo", "profile":{ "fullName":"Demo GTN", "avatarUrl":"http://localhost:8080/profile/u/demo/avatar.jpg?u=12345" } } ], "totalNumberOfLikes":20, "posterIdentity":{ "id":"123456313efghi", "providerId":"organization", "remoteId":"demo", "profile":{ "fullName":"Demo GTN", "avatarUrl":"http://localhost:8080/profile/u/demo/avatar.jpg?u=12345" } }, "comments":[ { } ], "totalNumberOfComments":1234, "activityStream":{ "type":"user", "prettyId":"root", "fullName": "Root Root", "faviconUrl":"http://demo3.exoplatform.org/favicons/exo-default.jpg", "title":"Activity Stream of Root Root", "permaLink":"http://localhost:8080/profile/root" } }, { "id":"1a210983123f7g8h9j", "title":"Hello World 1!!!", "appId":"", "type":"DEFAULT_ACTIVITY", "postedTime":123456789, "createdAt":"Fri Jun 19 06:42:26 +0000 2011", "priority":0.5, "templateParams":{ }, "titleId":"", "body": "", "identityId":"123456789abcdefghi", "liked":true, "likedByIdentities":[ { "id":"123456313efghi", "providerId":"organization", "remoteId":"demo", "profile":{ "fullName":"Demo GTN", "avatarUrl":"http://localhost:8080/profile/u/demo/avatar.jpg?u=12345" } } ], "totalNumberOfLikes":20, "posterIdentity":{ "id":"123456313efghi", "providerId":"organization", "remoteId":"demo", "profile":{ "fullName":"Demo GTN", "avatarUrl":"http://localhost:8080/profile/u/demo/avatar.jpg?u=12345" } }, "comments":[ { } ], "totalNumberOfComments":1234, "activityStream":{ "type":"user", "prettyId":"root", "fullName": "Root Root", "faviconUrl":"http://demo3.exoplatform.org/favicons/exo-default.jpg", "title":"Activity Stream of Root Root", "permaLink":"http://localhost:8080/profile/root" } } ] } {code}
 * @return the response
 */
@GET @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) public Response getActivityFeedOfAuthenticated(@Context UriInfo uriInfo,@PathParam("String_Node_Str") String portalContainerName,@PathParam("String_Node_Str") String format,@QueryParam("String_Node_Str") int limit,@QueryParam("String_Node_Str") String sinceId,@QueryParam("String_Node_Str") String maxId,@QueryParam("String_Node_Str") int numberOfComments,@QueryParam("String_Node_Str") int numberOfLikes){
  checkAuthenticatedRequest();
  checkValidPortalContainerName(portalContainerName);
  MediaType mediaType=checkSupportedFormat(format,SUPPORTED_FORMATS);
  Identity sourceIdentity=Util.getAuthenticatedUserIdentity(portalContainerName);
  int maxLimit=limit <= 0 ? MAX_LIMIT : Math.min(limit,MAX_LIMIT);
  ActivityManager activityManager=Util.getActivityManager(portalContainerName);
  ExoSocialActivity newerActivity=null;
  ExoSocialActivity olderActivity=null;
  try {
    if (sinceId != null && !sinceId.trim().equals("String_Node_Str")) {
      newerActivity=activityManager.getActivity(sinceId);
    }
 else     if (maxId != null && !maxId.trim().equals("String_Node_Str")) {
      olderActivity=activityManager.getActivity(maxId);
    }
  }
 catch (  UndeclaredThrowableException e) {
    if (e.getCause() instanceof ActivityStorageException) {
      throw new WebApplicationException(Response.Status.NOT_FOUND);
    }
 else {
      throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR);
    }
  }
  RealtimeListAccess<ExoSocialActivity> listAccess=null;
  List<ExoSocialActivity> activities=null;
  try {
    listAccess=activityManager.getActivityFeedWithListAccess(sourceIdentity);
    if (newerActivity != null) {
      activities=listAccess.loadNewer(newerActivity,maxLimit);
    }
 else     if (olderActivity != null) {
      activities=listAccess.loadOlder(olderActivity,maxLimit);
    }
 else {
      activities=listAccess.loadAsList(0,maxLimit);
    }
  }
 catch (  Exception e) {
    throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR);
  }
  ActivityRestListOut activityRestListOut=new ActivityRestListOut(activities,numberOfComments,numberOfLikes,portalContainerName);
  return Util.getResponse(activityRestListOut,uriInfo,mediaType,Response.Status.OK);
}