Integrated: 8250678: ModuleDescriptor.Version parsing treats empty segments inconsistently
Masanori Yano
myano at openjdk.java.net
Tue Nov 9 14:31:40 UTC 2021
On Fri, 24 Sep 2021 11:28:09 GMT, Masanori Yano <myano at openjdk.org> wrote:
> Could you please review the 8250678 bug fixes?
>
> The `parse` method of ModuleDescriptor.Version class behaves incorrectly when the input string contains consecutive delimiters.
>
> The `parse` method treats strings as three sections, but the parsing method differs between the method for the version sections and the ones for others. In version sections, the `parse` method takes a single character in a loop and determines whether it is a delimiter. In pre and build sections, the parse method takes two characters in a loop and determines whether the second character is the delimiter. Therefore, if the string contains a sequence of delimiters in pre or build section, the `parse` method treats character at the odd-numbered position as a token and the one at even-numbered as a delimiter.
>
> A string containing consecutive delimiters is an incorrect version string, but this behavior does not follow the API specification.
> https://download.java.net/java/early_access/jdk18/docs/api/java.base/java/lang/module/ModuleDescriptor.Version.html
>
> Therefore, I propose to fix the parsing method of pre and build section in the same way as the version.
This pull request has now been integrated.
Changeset: e1985947
Author: Masanori Yano <myano at openjdk.org>
Committer: Alan Bateman <alanb at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/e198594753b0b0653256923586c7f4ec9e3cfac3
Stats: 26 lines in 2 files changed: 11 ins; 14 del; 1 mod
8250678: ModuleDescriptor.Version parsing treats empty segments inconsistently
Reviewed-by: mchung, alanb
-------------
PR: https://git.openjdk.java.net/jdk/pull/5679
More information about the core-libs-dev
mailing list