code: private static void appendTaskStateValues(List<TaskState> taskStates, StringBuffer sb, String key) {
      // Add task failure messages in a group followed by task failure exceptions
      for (TaskState taskState : taskStates) {
        if (taskState.contains(key)) {
          if (sb.length() != 0) {
            sb.append(",");
          }
          sb.append(taskState.getProp(key));
        }
      }
    }
docs: Append values for the given key from all {@link TaskState}s
  @param sb a {@link StringBuffer} to hold the output
  @param key the key of the values to retrieve