Program: 188859
Project: 188859
Buggy source:
/** 
 * Gets media's information list (GET /<channel>) 
 */
@Get public Representation getMediasInfo(){
  setServerHeader();
  Request request=getRequest();
  String userId=null;
  String token=null;
  String entityId=(String)request.getAttributes().get(Constants.ENTITY_ARG);
  boolean isChannelPublic=XMPPToolBox.getInstance().getPubSubClient().isChannelPublic(entityId);
  if (!isChannelPublic) {
    String auth=getQueryValue(Constants.AUTH_QUERY);
    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;
    }
  }
  Integer max=null;
  String after=null;
  try {
    String queryValue=getQueryValue(Constants.MAX_QUERY);
    if (queryValue != null) {
      max=Integer.valueOf(queryValue);
    }
    after=getQueryValue(Constants.AFTER_QUERY);
  }
 catch (  Throwable t) {
    setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
    return new StringRepresentation("String_Node_Str",MediaType.APPLICATION_JSON);
  }
  MediaDAO mediaDAO=DAOFactory.getInstance().getDAO();
  try {
    return new StringRepresentation(mediaDAO.getMediasInfo(userId,entityId,max,after),MediaType.APPLICATION_JSON);
  }
 catch (  MetadataSourceException e) {
    setStatus(Status.SERVER_ERROR_INTERNAL);
  }
catch (  UserNotAllowedException e) {
    setStatus(Status.CLIENT_ERROR_FORBIDDEN);
  }
catch (  Throwable t) {
    return unexpectedError(t);
  }
  return new EmptyRepresentation();
}

Fixed version (ground truth):
/** 
 * Gets media's information list (GET /<channel>) 
 */
@Get public Representation getMediasInfo(){
  setServerHeader();
  Request request=getRequest();
  String userId=null;
  String token=null;
  String entityId=(String)request.getAttributes().get(Constants.ENTITY_ARG);
  boolean isChannelPublic=XMPPToolBox.getInstance().getPubSubClient().isChannelPublic(entityId);
  if (!isChannelPublic) {
    String auth=getQueryValue(Constants.AUTH_QUERY);
    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;
    }
  }
  Integer max=null;
  String after=null;
  try {
    String queryValue=getQueryValue(Constants.MAX_QUERY);
    if (queryValue != null) {
      max=Integer.valueOf(queryValue);
    }
    after=getQueryValue(Constants.AFTER_QUERY);
  }
 catch (  Throwable t) {
    setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
    return new StringRepresentation("String_Node_Str",MediaType.APPLICATION_JSON);
  }
  MediaDAO mediaDAO=DAOFactory.getInstance().getDAO();
  try {
    return new StringRepresentation(mediaDAO.getMediasInfo(userId,entityId,max,after),MediaType.APPLICATION_JSON);
  }
 catch (  MetadataSourceException e) {
    setStatus(Status.SERVER_ERROR_INTERNAL);
  }
catch (  UserNotAllowedException e) {
    setStatus(Status.CLIENT_ERROR_FORBIDDEN);
  }
catch (  Throwable t) {
    return unexpectedError(t);
  }
  return new EmptyRepresentation();
}