Skip to content

Fix handling of Java versions like 21.0.10.0.1#967

Merged
cstamas merged 1 commit into
apache:masterfrom
parttimenerd:parttimenerd_java_version_fix
May 14, 2026
Merged

Fix handling of Java versions like 21.0.10.0.1#967
cstamas merged 1 commit into
apache:masterfrom
parttimenerd:parttimenerd_java_version_fix

Conversation

@parttimenerd

Copy link
Copy Markdown
Contributor

The pull request allows the Java version requirement to be satisfied even when the normalized Java version differs, as long as the exact version strings are equal between the expected and the actual versions.

This allows the common CI pattern

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>3.6.2</version>
        <executions>
          <execution>
            <id>enforce-java</id>
            <phase>validate</phase>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireJavaVersion>
                  <version>${java.version}</version>
                </requireJavaVersion>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>

To succeed even when the Java version normalization can't handle the specific version format. This is rather hard to test, but all existing test cases succeed, and the diff is minimal.

@slawekjaranowski slawekjaranowski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, but some of tests for it will be appreciated

We can replace

String javaVersion = SystemUtils.JAVA_VERSION;

by method

getJavaVersion() {
 return SystemUtils.JAVA_VERSION;
}

which can be overridden for test

and can be easy for testing

@cstamas cstamas mentioned this pull request May 14, 2026
@cstamas cstamas merged commit fd4b148 into apache:master May 14, 2026
17 checks passed
@github-actions github-actions Bot added this to the 3.6.3 milestone May 14, 2026
@github-actions

Copy link
Copy Markdown

@cstamas Please assign appropriate label to PR according to the type of change.

@cstamas cstamas added the bug Something isn't working label May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants