apache/pulsar · error · IllegalArgumentException

InvalidFormatException.getOriginalMessage() (parse failure o

Error message

InvalidFormatException.getOriginalMessage() (parse failure of config file)

What it means

CmdUtils.loadConfig InvalidFormatException branch: the config file value's original parse-failure message is extracted and rethrown inside an IllegalArgumentException identifying the offending line and column.

Source

Thrown at pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/utils/CmdUtils.java:54

                                + "Invalid field '%s' on line: %d column: %d. Valid fields are %s",
                        file,
                        unrecognizedPropertyException.getPath().get(0).getFieldName(),
                        unrecognizedPropertyException.getLocation().getLineNr(),
                        unrecognizedPropertyException.getLocation().getColumnNr(),
                        unrecognizedPropertyException.getKnownPropertyIds());
                throw new IllegalArgumentException(exceptionMessage);
            } else if (ex instanceof InvalidFormatException) {

                InvalidFormatException invalidFormatException = (InvalidFormatException) ex;
                String exceptionMessage = String.format("Failed to parse config file %s. %s on line: %d column: %d",
                        file,
                        invalidFormatException.getOriginalMessage(),
                        invalidFormatException.getLocation().getLineNr(),
                        invalidFormatException.getLocation().getColumnNr());

                throw new IllegalArgumentException(exceptionMessage);
            } else {
                throw new IllegalArgumentException(ex.getMessage());
            }
        }
    }

    public static boolean positiveCheck(String paramName, long value) {
        if (value <= 0) {
            throw new IllegalArgumentException(paramName + " cannot be less than or equal to 0!");
        }
        return true;
    }

    public static boolean maxValueCheck(String paramName, long value, long maxValue) {
        if (value > maxValue) {
            throw new IllegalArgumentException(paramName + " cannot be greater than " + maxValue + "!");
        }
        return true;
    }
}

View on GitHub (pinned to 820761864e)

Solutions

  1. Correct the offending value at the reported line/column
  2. Check quoting of strings that look like other types
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/utils/CmdUtils.java:54 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/pulsar@820761864e (2026-09-06). Data as JSON: /api/errors/fc096a8120bbfbe4. Report an issue: GitHub.