Program: 7136
Project: 7136
Buggy source:
protected List<QueryResult> fetchNextResults(OperationHandle operationHandle,int size) throws HiveSQLException, ExploreException, HandleNotFoundException {
  startAndWait();
  try {
    if (operationHandle.hasResultSet()) {
      Object rowSet=getCliService().fetchResults(operationHandle,FetchOrientation.FETCH_NEXT,size);
      ImmutableList.Builder<QueryResult> rowsBuilder=ImmutableList.builder();
      if (rowSet instanceof Iterable) {
        for (        Object[] row : (Iterable<Object[]>)rowSet) {
          List<Object> cols=Lists.newArrayList();
          for (int i=0; i < row.length; i++) {
            cols.add(row[i]);
          }
          rowsBuilder.add(new QueryResult(cols));
        }
      }
 else {
        Class rowSetClass=Class.forName("String_Node_Str");
        Method toTRowSetMethod=rowSetClass.getMethod("String_Node_Str");
        TRowSet tRowSet=(TRowSet)toTRowSetMethod.invoke(rowSet);
        for (        TRow tRow : tRowSet.getRows()) {
          List<Object> cols=Lists.newArrayList();
          for (          TColumnValue tColumnValue : tRow.getColVals()) {
            cols.add(tColumnToObject(tColumnValue));
          }
          rowsBuilder.add(new QueryResult(cols));
        }
      }
      return rowsBuilder.build();
    }
 else {
      return Collections.emptyList();
    }
  }
 catch (  ClassNotFoundException e) {
    throw Throwables.propagate(e);
  }
catch (  NoSuchMethodException e) {
    throw Throwables.propagate(e);
  }
catch (  InvocationTargetException e) {
    throw Throwables.propagate(e);
  }
catch (  IllegalAccessException e) {
    throw Throwables.propagate(e);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") protected List<QueryResult> fetchNextResults(QueryHandle handle,int size) throws HiveSQLException, ExploreException, HandleNotFoundException {
  startAndWait();
  Lock nextLock=getOperationInfo(handle).getNextLock();
  nextLock.lock();
  try {
    LOG.trace("String_Node_Str",handle);
    OperationHandle operationHandle=getOperationHandle(handle);
    if (operationHandle.hasResultSet()) {
      Object rowSet=getCliService().fetchResults(operationHandle,FetchOrientation.FETCH_NEXT,size);
      ImmutableList.Builder<QueryResult> rowsBuilder=ImmutableList.builder();
      if (rowSet instanceof Iterable) {
        for (        Object[] row : (Iterable<Object[]>)rowSet) {
          List<Object> cols=Lists.newArrayList();
          for (int i=0; i < row.length; i++) {
            cols.add(row[i]);
          }
          rowsBuilder.add(new QueryResult(cols));
        }
      }
 else {
        Class rowSetClass=Class.forName("String_Node_Str");
        Method toTRowSetMethod=rowSetClass.getMethod("String_Node_Str");
        TRowSet tRowSet=(TRowSet)toTRowSetMethod.invoke(rowSet);
        for (        TRow tRow : tRowSet.getRows()) {
          List<Object> cols=Lists.newArrayList();
          for (          TColumnValue tColumnValue : tRow.getColVals()) {
            cols.add(tColumnToObject(tColumnValue));
          }
          rowsBuilder.add(new QueryResult(cols));
        }
      }
      return rowsBuilder.build();
    }
 else {
      return Collections.emptyList();
    }
  }
 catch (  ClassNotFoundException e) {
    throw Throwables.propagate(e);
  }
catch (  NoSuchMethodException e) {
    throw Throwables.propagate(e);
  }
catch (  InvocationTargetException e) {
    throw Throwables.propagate(e);
  }
catch (  IllegalAccessException e) {
    throw Throwables.propagate(e);
  }
 finally {
    nextLock.unlock();
  }
}