Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions tools/workload-dependencies/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ JProperty CreateJdkProperty (XDocument doc)
var v = new Version (JdkVersion ?? "17.0");
var start = new Version (v.Major, v.Minor);
var end = GetMaxJdkVersion (v);
var latestRevision = JdkVersion ?? GetLatestRevision (doc, "jdk");
var latestRevision = GetLatestRevision (doc, "jdk", start, new Version (end));
var contents = new JObject (
new JProperty ("version", $"[{start},{end})"));
if (!string.IsNullOrEmpty (latestRevision))
Expand Down Expand Up @@ -202,9 +202,13 @@ IEnumerable<XElement> GetSupportedElements (XDocument doc, string element)
.OrderByRevision ();
}

string? GetLatestRevision (XDocument doc, string element)
string? GetLatestRevision (XDocument doc, string element, Version minimumVersion, Version maximumVersion)
{
return GetByRevisions (doc, element)
.Where (item => {
var version = new Version (item.Revision);
Comment thread
Redth marked this conversation as resolved.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 ❌ Error handlingOrderByRevision() accepts one-component revisions by appending .0, but this new new Version (item.Revision) parses the original raw value. A supported feed entry such as revision="21" will now throw and abort metadata generation. Preserve the normalized Version in GetByRevisions() and compare that here; please add regression coverage for this accepted input.

Rule: Preserve existing input normalization

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.

I think this it just saying new Version("21") will throw ArgumentException and to check how it's done in other methods in this file.

return version >= minimumVersion && version < maximumVersion;
})
.LastOrDefault ()
.Revision;
}
Expand Down
Loading