Program: 102742
Project: 102742
Buggy source:
/** 
 * Gets the list of public tags of a given document.
 * @param jcrPath The path of the document, e.g. /portal/collaboration/test/document1, in which "portal" is the repository, "collaboration" is the workspace.
 * @request GET: http://localhost:8080/rest/private/contents/tag/public?jcrPath=/portal/collaboration/test/document1
 * @format XML
 * @response The tag names in XML format.<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <tags> <tag name="gold" /> <tag name="silver" /> </tags>
 * @anchor TagConnector.getPublicTags
 */
@GET @Path("String_Node_Str") public Response getPublicTags(@QueryParam("String_Node_Str") String jcrPath) throws Exception {
  if (jcrPath.contains("String_Node_Str"))   jcrPath=URLDecoder.decode(jcrPath,"String_Node_Str");
  String[] path=jcrPath.split("String_Node_Str");
  String repositoryName=path[1];
  String workspaceName=path[2];
  jcrPath=jcrPath.substring(repositoryName.length() + workspaceName.length() + 2);
  if (jcrPath.charAt(1) == '/')   jcrPath.substring(1);
  try {
    Node content=getContent(workspaceName,jcrPath,null,false);
    List<Node> tags=tagService.getLinkedTagsOfDocumentByScope(NewFolksonomyService.PUBLIC,"String_Node_Str",content,workspaceName);
    Document document=DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
    Element tagsElt=document.createElement("String_Node_Str");
    for (    Node tag : tags) {
      Element element=document.createElement("String_Node_Str");
      element.setAttribute("String_Node_Str",tag.getName());
      tagsElt.appendChild(element);
    }
    document.appendChild(tagsElt);
    DateFormat dateFormat=new SimpleDateFormat(IF_MODIFIED_SINCE_DATE_FORMAT);
    return Response.ok(new DOMSource(document),MediaType.TEXT_XML).header(LAST_MODIFIED_PROPERTY,dateFormat.format(new Date())).build();
  }
 catch (  Exception e) {
    Response.serverError().build();
  }
  DateFormat dateFormat=new SimpleDateFormat(IF_MODIFIED_SINCE_DATE_FORMAT);
  return Response.ok().header(LAST_MODIFIED_PROPERTY,dateFormat.format(new Date())).build();
}

Fixed version (ground truth):
/** 
 * Gets the list of public tags of a given document.
 * @param jcrPath The path of the document, e.g. /portal/collaboration/test/document1, in which "portal" is the repository, "collaboration" is the workspace.
 * @request GET: http://localhost:8080/rest/private/contents/tag/public?jcrPath=/portal/collaboration/test/document1
 * @format XML
 * @response The tag names in XML format.{@code <?xml version="1.0" encoding="UTF-8" standalone="no" ?> <tags> <tag name="gold" /> <tag name="silver" /> </tags>}
 * @anchor TagConnector.getPublicTags
 */
@GET @Path("String_Node_Str") public Response getPublicTags(@QueryParam("String_Node_Str") String jcrPath) throws Exception {
  if (jcrPath.contains("String_Node_Str"))   jcrPath=URLDecoder.decode(jcrPath,"String_Node_Str");
  String[] path=jcrPath.split("String_Node_Str");
  String repositoryName=path[1];
  String workspaceName=path[2];
  jcrPath=jcrPath.substring(repositoryName.length() + workspaceName.length() + 2);
  if (jcrPath.charAt(1) == '/')   jcrPath.substring(1);
  try {
    Node content=getContent(workspaceName,jcrPath,null,false);
    List<Node> tags=tagService.getLinkedTagsOfDocumentByScope(NewFolksonomyService.PUBLIC,"String_Node_Str",content,workspaceName);
    Document document=DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
    Element tagsElt=document.createElement("String_Node_Str");
    for (    Node tag : tags) {
      Element element=document.createElement("String_Node_Str");
      element.setAttribute("String_Node_Str",tag.getName());
      tagsElt.appendChild(element);
    }
    document.appendChild(tagsElt);
    DateFormat dateFormat=new SimpleDateFormat(IF_MODIFIED_SINCE_DATE_FORMAT);
    return Response.ok(new DOMSource(document),MediaType.TEXT_XML).header(LAST_MODIFIED_PROPERTY,dateFormat.format(new Date())).build();
  }
 catch (  Exception e) {
    Response.serverError().build();
  }
  DateFormat dateFormat=new SimpleDateFormat(IF_MODIFIED_SINCE_DATE_FORMAT);
  return Response.ok().header(LAST_MODIFIED_PROPERTY,dateFormat.format(new Date())).build();
}