{"record":{"id":"fc096a8120bbfbe4","repo":"apache/pulsar","slug":"invalidformatexception-getoriginalmessage-parse","errorCode":null,"errorMessage":"InvalidFormatException.getOriginalMessage() (parse failure of config file)","messagePattern":"InvalidFormatException\\.getOriginalMessage\\(\\) \\(parse failure of config file\\)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/utils/CmdUtils.java","lineNumber":54,"sourceCode":"                                + \"Invalid field '%s' on line: %d column: %d. Valid fields are %s\",\n                        file,\n                        unrecognizedPropertyException.getPath().get(0).getFieldName(),\n                        unrecognizedPropertyException.getLocation().getLineNr(),\n                        unrecognizedPropertyException.getLocation().getColumnNr(),\n                        unrecognizedPropertyException.getKnownPropertyIds());\n                throw new IllegalArgumentException(exceptionMessage);\n            } else if (ex instanceof InvalidFormatException) {\n\n                InvalidFormatException invalidFormatException = (InvalidFormatException) ex;\n                String exceptionMessage = String.format(\"Failed to parse config file %s. %s on line: %d column: %d\",\n                        file,\n                        invalidFormatException.getOriginalMessage(),\n                        invalidFormatException.getLocation().getLineNr(),\n                        invalidFormatException.getLocation().getColumnNr());\n\n                throw new IllegalArgumentException(exceptionMessage);\n            } else {\n                throw new IllegalArgumentException(ex.getMessage());\n            }\n        }\n    }\n\n    public static boolean positiveCheck(String paramName, long value) {\n        if (value <= 0) {\n            throw new IllegalArgumentException(paramName + \" cannot be less than or equal to 0!\");\n        }\n        return true;\n    }\n\n    public static boolean maxValueCheck(String paramName, long value, long maxValue) {\n        if (value > maxValue) {\n            throw new IllegalArgumentException(paramName + \" cannot be greater than \" + maxValue + \"!\");\n        }\n        return true;\n    }\n}","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/utils/CmdUtils.java#L36-L72","documentation":"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.","triggerScenarios":"Thrown at pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/utils/CmdUtils.java:54 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Correct the offending value at the reported line/column","Check quoting of strings that look like other types"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}