Polishing in VersionRequestCondition
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details

See gh-35237
This commit is contained in:
rstoyanchev 2025-07-28 09:06:19 +01:00
parent 2238121350
commit 2c32c770d5
2 changed files with 6 additions and 4 deletions

View File

@ -128,9 +128,10 @@ public final class VersionRequestCondition extends AbstractRequestCondition<Vers
return (-1 * compareVersions(this.version, otherVersion));
}
else {
// Prefer mapping without version for unversioned request
// Prefer mappings with a version unless the request is without a version
int result = this.version != null ? -1 : 1;
Comparable<?> version = exchange.getAttribute(HandlerMapping.API_VERSION_ATTRIBUTE);
return (version != null ? (this.version != null ? -1 : 1) : (this.version != null ? 1 : -1));
return (version == null ? -1 * result : result);
}
}

View File

@ -127,9 +127,10 @@ public final class VersionRequestCondition extends AbstractRequestCondition<Vers
return (-1 * compareVersions(this.version, otherVersion));
}
else {
// Prefer mapping without version for unversioned request
// Prefer mappings with a version unless the request is without a version
int result = this.version != null ? -1 : 1;
Comparable<?> version = (Comparable<?>) request.getAttribute(HandlerMapping.API_VERSION_ATTRIBUTE);
return (version != null ? (this.version != null ? -1 : 1) : (this.version != null ? 1 : -1));
return (version == null ? -1 * result : result);
}
}