Program: 25402
Project: 25402
Buggy source:
@Override public QueryStatus getStatus(QueryHandle handle) throws GrillException {
  LOG.info("String_Node_Str" + handle);
  OperationHandle hiveHandle=getHiveHandle(handle);
  ByteArrayInputStream in=null;
  boolean hasResult=false;
  try {
    OperationStatus opStatus=getClient().getOperationStatus(hiveHandle);
    QueryStatus.Status stat=null;
switch (opStatus.getState()) {
case CANCELED:
      stat=Status.CANCELED;
    break;
case CLOSED:
  stat=Status.CLOSED;
break;
case ERROR:
stat=Status.FAILED;
break;
case FINISHED:
stat=Status.SUCCESSFUL;
hasResult=true;
break;
case INITIALIZED:
stat=Status.RUNNING;
break;
case RUNNING:
stat=Status.RUNNING;
break;
case PENDING:
stat=Status.LAUNCHED;
break;
case UNKNOWN:
stat=Status.UNKNOWN;
break;
}
float progress=0f;
String jsonTaskStatus=opStatus.getTaskStatus();
String msg="String_Node_Str";
if (StringUtils.isNotBlank(jsonTaskStatus)) {
ObjectMapper mapper=new ObjectMapper();
in=new ByteArrayInputStream(jsonTaskStatus.getBytes("String_Node_Str"));
List<TaskStatus> taskStatuses=mapper.readValue(in,new TypeReference<List<TaskStatus>>(){
}
);
int completedTasks=0;
StringBuilder message=new StringBuilder();
for (TaskStatus taskStat : taskStatuses) {
String state=taskStat.getTaskState();
if ("String_Node_Str".equalsIgnoreCase(state)) {
completedTasks++;
}
message.append(taskStat.getExternalHandle()).append("String_Node_Str").append(state).append("String_Node_Str");
}
progress=taskStatuses.size() == 0 ? 0 : (float)completedTasks / taskStatuses.size();
msg=message.toString();
}
 else {
LOG.warn("String_Node_Str");
}
return new QueryStatus(progress,stat,msg,false,ctx.hiveHandle.getHandleIdentifier().toString());
}
 catch (Exception e) {
throw new GrillException("String_Node_Str",e);
}
 finally {
if (in != null) {
try {
in.close();
}
 catch (IOException e) {
e.printStackTrace();
}
}
}
}

Fixed version (ground truth):
@Override public QueryStatus getStatus(QueryHandle handle) throws GrillException {
  LOG.info("String_Node_Str" + handle);
  OperationHandle hiveHandle=getHiveHandle(handle);
  ByteArrayInputStream in=null;
  boolean hasResult=false;
  try {
    OperationStatus opStatus=getClient().getOperationStatus(hiveHandle);
    QueryStatus.Status stat=null;
switch (opStatus.getState()) {
case CANCELED:
      stat=Status.CANCELED;
    break;
case CLOSED:
  stat=Status.CLOSED;
break;
case ERROR:
stat=Status.FAILED;
break;
case FINISHED:
stat=Status.SUCCESSFUL;
hasResult=true;
break;
case INITIALIZED:
stat=Status.RUNNING;
break;
case RUNNING:
stat=Status.RUNNING;
break;
case PENDING:
stat=Status.LAUNCHED;
break;
case UNKNOWN:
stat=Status.UNKNOWN;
break;
}
float progress=0f;
String jsonTaskStatus=opStatus.getTaskStatus();
String msg="String_Node_Str";
if (StringUtils.isNotBlank(jsonTaskStatus)) {
ObjectMapper mapper=new ObjectMapper();
in=new ByteArrayInputStream(jsonTaskStatus.getBytes("String_Node_Str"));
List<TaskStatus> taskStatuses=mapper.readValue(in,new TypeReference<List<TaskStatus>>(){
}
);
int completedTasks=0;
StringBuilder message=new StringBuilder();
for (TaskStatus taskStat : taskStatuses) {
String state=taskStat.getTaskState();
if ("String_Node_Str".equalsIgnoreCase(state)) {
completedTasks++;
}
message.append(taskStat.getExternalHandle()).append("String_Node_Str").append(state).append("String_Node_Str");
}
progress=taskStatuses.size() == 0 ? 0 : (float)completedTasks / taskStatuses.size();
msg=message.toString();
}
 else {
LOG.warn("String_Node_Str");
}
return new QueryStatus(progress,stat,msg,false,hiveHandle.getHandleIdentifier().toString());
}
 catch (Exception e) {
throw new GrillException("String_Node_Str",e);
}
 finally {
if (in != null) {
try {
in.close();
}
 catch (IOException e) {
e.printStackTrace();
}
}
}
}