Program: 15667
Project: 15667
Buggy source:
/** 
 * Returns all articles in a category.
 * @param id Category ID
 * @param unread Returns only unread articles
 * @param limit Page limit
 * @param offset Page offset
 * @return Response
 * @throws JSONException
 */
@GET @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) public Response get(@PathParam("String_Node_Str") String id,@QueryParam("String_Node_Str") boolean unread,@QueryParam("String_Node_Str") Integer limit,@QueryParam("String_Node_Str") Integer offset) throws JSONException {
  if (!authenticate()) {
    throw new ForbiddenClientException();
  }
  CategoryDao categoryDao=new CategoryDao();
  Category category=null;
  try {
    category=categoryDao.getCategory(id,principal.getId());
  }
 catch (  NoResultException e) {
    throw new ClientException("String_Node_Str",MessageFormat.format("String_Node_Str",id));
  }
  UserArticleCriteria userArticleCriteria=new UserArticleCriteria();
  userArticleCriteria.setUnread(unread);
  userArticleCriteria.setUserId(principal.getId());
  userArticleCriteria.setSubscribed(true);
  if (category.getParentId() != null) {
    userArticleCriteria.setCategoryId(id);
  }
  UserArticleDao userArticleDao=new UserArticleDao();
  PaginatedList<UserArticleDto> paginatedList=PaginatedLists.create(limit,offset);
  userArticleDao.findByCriteria(userArticleCriteria,paginatedList);
  JSONObject response=new JSONObject();
  List<JSONObject> articles=new ArrayList<JSONObject>();
  for (  UserArticleDto userArticle : paginatedList.getResultList()) {
    articles.add(ArticleAssembler.asJson(userArticle));
  }
  response.put("String_Node_Str",paginatedList.getResultCount());
  response.put("String_Node_Str",articles);
  return Response.ok().entity(response).build();
}

Fixed version (ground truth):
/** 
 * Returns all articles in a category.
 * @param id Category ID
 * @param unread Returns only unread articles
 * @param limit Page limit
 * @param offset Page offset
 * @return Response
 * @throws JSONException
 */
@GET @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) public Response get(@PathParam("String_Node_Str") String id,@QueryParam("String_Node_Str") boolean unread,@QueryParam("String_Node_Str") Integer limit,@QueryParam("String_Node_Str") Integer offset) throws JSONException {
  if (!authenticate()) {
    throw new ForbiddenClientException();
  }
  CategoryDao categoryDao=new CategoryDao();
  Category category=null;
  try {
    category=categoryDao.getCategory(id,principal.getId());
  }
 catch (  NoResultException e) {
    throw new ClientException("String_Node_Str",MessageFormat.format("String_Node_Str",id));
  }
  UserArticleCriteria userArticleCriteria=new UserArticleCriteria();
  userArticleCriteria.setUnread(unread);
  userArticleCriteria.setUserId(principal.getId());
  userArticleCriteria.setVisible(true);
  if (category.getParentId() != null) {
    userArticleCriteria.setCategoryId(id);
  }
  UserArticleDao userArticleDao=new UserArticleDao();
  PaginatedList<UserArticleDto> paginatedList=PaginatedLists.create(limit,offset);
  userArticleDao.findByCriteria(userArticleCriteria,paginatedList);
  JSONObject response=new JSONObject();
  List<JSONObject> articles=new ArrayList<JSONObject>();
  for (  UserArticleDto userArticle : paginatedList.getResultList()) {
    articles.add(ArticleAssembler.asJson(userArticle));
  }
  response.put("String_Node_Str",paginatedList.getResultCount());
  response.put("String_Node_Str",articles);
  return Response.ok().entity(response).build();
}