protected boolean isFailureOrRecovery(AbstractBuild<?, ?> build) {
    if (build.getResult() == Result.FAILURE
        || build.getResult() == Result.UNSTABLE) {
      return true;
    } else if (build.getResult() == Result.SUCCESS) {
      AbstractBuild<?, ?> previousBuild = build.getPreviousBuild();
      if (previousBuild != null && previousBuild.getResult() != Result.SUCCESS) {
        return true;
      } else {
        return false;
      }
    } else {
      return false;
    }
  }