{"record":{"id":"63c5cb0abba83a10","repo":"apache/maven","slug":"cannot-convert-string-to-integer-value","errorCode":null,"errorMessage":"Cannot convert string to integer: {value}","messagePattern":"Cannot convert string to integer: (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"impl/maven-impl/src/main/java/org/apache/maven/impl/model/profile/ConditionParser.java","lineNumber":645,"sourceCode":"     * - 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\n     * @throws RuntimeException if the object cannot be converted to an integer\n     */\n    public static int toInt(Object value) {\n        if (value instanceof Number number) {\n            return number.intValue(); // Converts number to int\n        } else if (value instanceof String string) {\n            try {\n                return Integer.parseInt(string); // Tries to parse string as int\n            } catch (NumberFormatException e) {\n                // If string is not an int, tries parsing as double and converting to int\n                try {\n                    return (int) Double.parseDouble((String) value);\n                } catch (NumberFormatException e2) {\n                    throw new RuntimeException(\"Cannot convert string to integer: \" + value);\n                }\n            }\n        } else if (value instanceof Boolean bool) {\n            return bool ? 1 : 0; // True = 1, False = 0\n        } else {\n            throw new RuntimeException(\"Cannot convert to integer: \" + value);\n        }\n    }\n}\n","sourceCodeStart":627,"sourceCodeEnd":655,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-impl/src/main/java/org/apache/maven/impl/model/profile/ConditionParser.java#L627-L655","documentation":"Error \"Cannot convert string to integer: {value}\" thrown in apache/maven.","triggerScenarios":"Thrown at impl/maven-impl/src/main/java/org/apache/maven/impl/model/profile/ConditionParser.java:645 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-22T04:17:13.399Z"}