apache/maven · error · RuntimeException

Cannot convert to integer: {value}

Error message

Cannot convert to integer: {value}

What it means

Error "Cannot convert to integer: {value}" thrown in apache/maven.

Source

Thrown at impl/maven-impl/src/main/java/org/apache/maven/impl/model/profile/ConditionParser.java:651

     */
    public static int toInt(Object value) {
        if (value instanceof Number number) {
            return number.intValue(); // Converts number to int
        } else if (value instanceof String string) {
            try {
                return Integer.parseInt(string); // Tries to parse string as int
            } catch (NumberFormatException e) {
                // If string is not an int, tries parsing as double and converting to int
                try {
                    return (int) Double.parseDouble((String) value);
                } catch (NumberFormatException e2) {
                    throw new RuntimeException("Cannot convert string to integer: " + value);
                }
            }
        } else if (value instanceof Boolean bool) {
            return bool ? 1 : 0; // True = 1, False = 0
        } else {
            throw new RuntimeException("Cannot convert to integer: " + value);
        }
    }
}

View on GitHub (pinned to e4093d4e12)

When it happens

Trigger: Thrown at impl/maven-impl/src/main/java/org/apache/maven/impl/model/profile/ConditionParser.java:651 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21). Data as JSON: /api/errors/96406c034c3bfb96. Report an issue: GitHub.