code: public boolean execute() throws IOException {
      if (stopOnError) {
        for (int i = 0; i < actions.length; i++) {
          if (!actions[i].execute()) {
            return false;
          }
        }
  
        return true;
      } else {
        boolean status = true;
        IOException exception = null;
  
        for (int i = 0; i < actions.length; i++) {
          try {
            status &= actions[i].execute();
          } catch (IOException ex) {
            status = false;
  
            if (exception == null) {
              exception = ex;
            }
          }
        }
  
        if (exception != null) {
          throw exception;
        }
  
        return status;
      }
    }
docs: Execute sequence of actions.
  @return true if all actions were successful.
  @throws IOException on IO error.