Program: 188863
Project: 188863
Buggy source:
/** 
 * Uploads avatar (PUT /<channel>/avatar) 
 */
@Put("String_Node_Str") public Representation putWebFormAvatar(Representation entity){
  setServerHeader();
  Request request=getRequest();
  String auth=getQueryValue(Constants.AUTH_QUERY);
  String userId=null;
  String token=null;
  try {
    userId=getUserId(request,auth);
    token=getTransactionId(request,auth);
  }
 catch (  Throwable t) {
    setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
    return new StringRepresentation("String_Node_Str",MediaType.APPLICATION_JSON);
  }
  Representation verifyRequest=verifyRequest(userId,token,request.getResourceRef().getIdentifier());
  if (verifyRequest != null) {
    return verifyRequest;
  }
  MediaDAO mediaDAO=DAOFactory.getInstance().getDAO();
  String entityId=(String)request.getAttributes().get(Constants.ENTITY_ARG);
  String mediaId=(String)request.getAttributes().get(Constants.MEDIA_ARG);
  if (!mediaId.equals(Constants.AVATAR_ARG)) {
    setStatus(Status.CLIENT_ERROR_METHOD_NOT_ALLOWED);
    return new StringRepresentation("String_Node_Str",MediaType.APPLICATION_JSON);
  }
  String result="String_Node_Str";
  try {
    if (MediaType.MULTIPART_FORM_DATA.equals(entity.getMediaType(),true)) {
      result=mediaDAO.insertFormDataMedia(userId,entityId,getRequest(),true);
    }
 else {
      result=mediaDAO.insertWebFormMedia(userId,entityId,new Form(entity),true);
    }
    setStatus(Status.SUCCESS_CREATED);
  }
 catch (  FileUploadException e) {
    setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
  }
catch (  UserNotAllowedException e) {
    setStatus(Status.CLIENT_ERROR_FORBIDDEN);
  }
catch (  Throwable t) {
    return unexpectedError(t);
  }
  return new StringRepresentation(result,MediaType.APPLICATION_JSON);
}

Fixed version (ground truth):
/** 
 * Uploads avatar (PUT /<channel>/avatar) 
 */
@Put("String_Node_Str") public Representation putWebFormAvatar(Representation entity){
  setServerHeader();
  Request request=getRequest();
  String auth=getQueryValue(Constants.AUTH_QUERY);
  String userId=null;
  String token=null;
  try {
    userId=getUserId(request,auth);
    token=getTransactionId(request,auth);
  }
 catch (  Throwable t) {
    setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
    return new StringRepresentation("String_Node_Str",MediaType.APPLICATION_JSON);
  }
  Representation verifyRequest=checkRequest(userId,token,request.getResourceRef().getIdentifier());
  if (verifyRequest != null) {
    return verifyRequest;
  }
  MediaDAO mediaDAO=DAOFactory.getInstance().getDAO();
  String entityId=(String)request.getAttributes().get(Constants.ENTITY_ARG);
  String mediaId=(String)request.getAttributes().get(Constants.MEDIA_ARG);
  if (!mediaId.equals(Constants.AVATAR_ARG)) {
    setStatus(Status.CLIENT_ERROR_METHOD_NOT_ALLOWED);
    return new StringRepresentation("String_Node_Str",MediaType.APPLICATION_JSON);
  }
  String result="String_Node_Str";
  try {
    if (MediaType.MULTIPART_FORM_DATA.equals(entity.getMediaType(),true)) {
      result=mediaDAO.insertFormDataMedia(userId,entityId,getRequest(),true);
    }
 else {
      result=mediaDAO.insertWebFormMedia(userId,entityId,new Form(entity),true);
    }
    setStatus(Status.SUCCESS_CREATED);
  }
 catch (  FileUploadException e) {
    setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
  }
catch (  UserNotAllowedException e) {
    setStatus(Status.CLIENT_ERROR_FORBIDDEN);
  }
catch (  Throwable t) {
    return unexpectedError(t);
  }
  return new StringRepresentation(result,MediaType.APPLICATION_JSON);
}