ret.setCounters(new ThriftGroupList(toThrift(t.getCounters())));
Map<String,ThriftTaskStatus> statusMap = new HashMap<String,ThriftTaskStatus>();
Map<String,List<String>> dataMap = new HashMap<String,List<String>>();
for (TaskStatus ts : sts) {
ThriftTaskAttemptID id = toThrift(ts.getTaskID());
id.taskID.setTaskType(type);
statusMap.put(id.getAsString(), toThrift(ts));
try {
// Atomic copy
String[] strDiags = tracker.getTaskDiagnostics(ts.getTaskID());
// Thrift does not like null values in maps
List<String> diag = (strDiags == null ? new ArrayList<String>() :
Arrays.asList(strDiags));
dataMap.put(id.getAsString(), diag);
} catch (java.io.IOException e) {
// tracker.getTaskDiagnostics is supposed to throw,
// but I can't see where it does (and removing the throws clause
// doesn't cause a compile failure...), so this is probably
// extraneous