{"record":{"id":"ddac83fc4249a69e","repo":"apache/maven","slug":"cannot-convert-string-to-number-value","errorCode":null,"errorMessage":"Cannot convert string to number: {value}","messagePattern":"Cannot convert string to number: (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"impl/maven-impl/src/main/java/org/apache/maven/impl/model/profile/ConditionParser.java","lineNumber":613,"sourceCode":"     * Converts an object to a double value.\n     * If the object is:\n     * - a {@code Number}, returns its double value.\n     * - a {@code String}, tries to parse it as a double.\n     * - a {@code Boolean}, returns {@code 1.0} for {@code true}, {@code 0.0} for {@code false}.\n     * If the object cannot be converted, a {@code RuntimeException} is thrown.\n     *\n     * @param value the object to convert to a double\n     * @return the double representation of the object\n     * @throws RuntimeException if the object cannot be converted to a double\n     */\n    public static double toDouble(Object value) {\n        if (value instanceof Number number) {\n            return number.doubleValue(); // Converts number to double\n        } else if (value instanceof String string) {\n            try {\n                return Double.parseDouble(string); // Tries to parse string as double\n            } catch (NumberFormatException e) {\n                throw new RuntimeException(\"Cannot convert string to number: \" + value);\n            }\n        } else if (value instanceof Boolean bool) {\n            return bool ? 1.0 : 0.0; // True = 1.0, False = 0.0\n        } else {\n            throw new RuntimeException(\"Cannot convert to number: \" + value);\n        }\n    }\n\n    /**\n     * Converts an object to an integer value.\n     * If the object is:\n     * - a {@code Number}, returns its integer value.\n     * - a {@code String}, tries to parse it as an integer, or as a double then converted to an integer.\n     * - a {@code Boolean}, returns {@code 1} for {@code true}, {@code 0} for {@code false}.\n     * If the object cannot be converted, a {@code RuntimeException} is thrown.\n     *\n     * @param value the object to convert to an integer\n     * @return the integer representation of the object","sourceCodeStart":595,"sourceCodeEnd":631,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-impl/src/main/java/org/apache/maven/impl/model/profile/ConditionParser.java#L595-L631","documentation":"Error \"Cannot convert string to number: {value}\" thrown in apache/maven.","triggerScenarios":"Thrown at impl/maven-impl/src/main/java/org/apache/maven/impl/model/profile/ConditionParser.java:613 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}