Skip to content

fix(maven): don't crash the version check on non-UTF-8 mvn output - #981

Open
nursnaaz wants to merge 1 commit into
aws:developfrom
nursnaaz:fix/maven-validator-decode
Open

nursnaaz wants to merge 1 commit into
aws:developfrom
nursnaaz:fix/maven-validator-decode

Conversation

@nursnaaz

Copy link
Copy Markdown

Issue #, if available: None filed. Follows #548 and #554.

Description of changes

MavenValidator._get_jvm_string decodes each line of mvn -version with line.decode(), which is strict UTF-8. Maven prints a Maven home: line before the Java version line. On Windows with a non-UTF-8 locale and a non-ASCII user path (for example C:\Users\José), that line raises UnicodeDecodeError and the build crashes before it starts.

#554 fixed this for gradle_validator.py and maven.py by using aws_lambda_builders.utils.decode. This change does the same in maven_validator.py, which was missed.

Description of how you validated changes

New unit test test_does_not_fail_on_non_utf8_output feeds a cp1252-encoded Maven home line before the Java version line. It fails on develop with UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 and passes with this change. All 1078 unit tests pass. ruff check and black --check are clean. I did not run it on Windows or run the full make pr.

Checklist

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@nursnaaz
nursnaaz requested a review from a team as a code owner November 21, 2026 16:51
@github-actions github-actions Bot added pr/external stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. area/workflow/java_maven labels Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/workflow/java_maven pr/external stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant