{"record":{"id":"63b8a32dbc11f0a8","repo":"opendataloader-project/opendataloader-pdf","slug":"option-space-ratio-requires-valid-double-value","errorCode":null,"errorMessage":"Option --space-ratio requires valid double value.","messagePattern":"Option --space-ratio requires valid double value\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"java/opendataloader-pdf-core/src/main/java/org/opendataloader/pdf/api/cli/CLIOptions.java","lineNumber":408,"sourceCode":"        if (commandLine.hasOption(CLIOptions.MARKDOWN_PAGE_SEPARATOR_LONG_OPTION)) {\n            config.setMarkdownPageSeparator(commandLine.getOptionValue(CLIOptions.MARKDOWN_PAGE_SEPARATOR_LONG_OPTION));\n        }\n        if (commandLine.hasOption(CLIOptions.TEXT_PAGE_SEPARATOR_LONG_OPTION)) {\n            config.setTextPageSeparator(commandLine.getOptionValue(CLIOptions.TEXT_PAGE_SEPARATOR_LONG_OPTION));\n        }\n        if (commandLine.hasOption(CLIOptions.HTML_PAGE_SEPARATOR_LONG_OPTION)) {\n            config.setHtmlPageSeparator(commandLine.getOptionValue(CLIOptions.HTML_PAGE_SEPARATOR_LONG_OPTION));\n        }\n        if (commandLine.hasOption(CLIOptions.SPACE_RATIO_LONG_OPTION)) {\n            try {\n                double spaceRatio = Double.parseDouble(commandLine.getOptionValue(CLIOptions.SPACE_RATIO_LONG_OPTION));\n                if (!Double.isFinite(spaceRatio) || spaceRatio <= 0) {\n                    throw new IllegalArgumentException(\n                        \"Option --space-ratio requires a finite positive double value.\");\n                }\n                config.setSpaceRatio(spaceRatio);\n            } catch (NumberFormatException e) {\n                throw new IllegalArgumentException(\n                    \"Option --space-ratio requires valid double value.\", e);\n            }\n        }\n        applyContentSafetyOption(config, commandLine);\n        applySanitizeOption(config, commandLine);\n        applyFormatOption(config, commandLine);\n        applyTableMethodOption(config, commandLine);\n        applyImageOptions(config, commandLine);\n        applyPagesOption(config, commandLine);\n        applyHybridOptions(config, commandLine);\n        applyThreadsOption(config, commandLine);\n        config.normalize();\n    }\n\n    private static void applyThreadsOption(Config config, CommandLine commandLine) {\n        if (!commandLine.hasOption(THREADS_LONG_OPTION)) {\n            return;\n        }","sourceCodeStart":390,"sourceCodeEnd":426,"githubUrl":"https://github.com/opendataloader-project/opendataloader-pdf/blob/a7789b8e77dd05e2b8659eb3ea12fc458f80bfb8/java/opendataloader-pdf-core/src/main/java/org/opendataloader/pdf/api/cli/CLIOptions.java#L390-L426","documentation":"While building the Config from CLI args, Double.parseDouble throws NumberFormatException on the --space-ratio value, and it is wrapped in an IllegalArgumentException with this message. This is the 'unparseable' branch, distinct from the out-of-range branch (error [14]). Double.parseDouble uses a dot as the decimal separator regardless of locale.","triggerScenarios":"CLI --space-ratio abc, --space-ratio 0,5 (comma decimal separator common in non-English locales), --space-ratio 1/2.","commonSituations":"Locale mismatch where the user types a comma decimal; non-numeric paste; fraction instead of decimal.","solutions":["Pass a numeric decimal using a dot separator, e.g. 0.5.","If generating the value from a locale-aware source, format with Locale.ROOT and a dot decimal before passing to the CLI."],"exampleFix":"# before: --space-ratio 0,5\n# after:  --space-ratio 0.5","handlingStrategy":"validation","validationCode":"double v;\ntry {\n    v = Double.parseDouble(rawSpaceRatio);\n} catch (NumberFormatException e) {\n    throw new IllegalArgumentException(\"--space-ratio is not a number: \" + rawSpaceRatio, e);\n}\n// ...then also apply the finite-positive check (error [14]).","typeGuard":"static boolean isParsableDouble(String s) {\n    try { Double.parseDouble(s); return true; } catch (NumberFormatException e) { return false; }\n}","tryCatchPattern":"try { /* build config with --space-ratio */ }\ncatch (IllegalArgumentException e) { /* reprompt with a dot-decimal example */ }","preventionTips":["Always use a dot decimal separator; Double.parseDouble ignores locale.","If converting from a locale-aware Number, format with Locale.ROOT and a dot before passing to the CLI."],"tags":["configuration","validation","cli","space-ratio","parsing","locale"],"backgroundTag":null,"analyzedSha":"a7789b8e77dd05e2b8659eb3ea12fc458f80bfb8","analyzedAt":"2026-08-14T05:22:03.953Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}