private void mandatoryField()

in src/main/java/com/googlesource/gerrit/plugins/pubsub/InitConfig.java [93:106]


  private void mandatoryField(String fieldName, String description, String dv) {
    String providedValue = pluginSection.string(description, fieldName, dv);

    while (Strings.isNullOrEmpty(providedValue) && !ui.isBatch()) {
      ui.message("'%s' is mandatory. Please specify a value.", fieldName);
      providedValue = pluginSection.string(description, fieldName, dv);
    }

    if (Strings.isNullOrEmpty(providedValue) && ui.isBatch()) {
      System.err.printf(
          "FATAL [%s plugin]: Could not set '%s' in batch mode. %s will not work%n",
          pluginName, fieldName, pluginName);
    }
  }