Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UriComponentsBuilder.cloneBuilder() cause sharing query parameters between builders #25423

Closed
Potat0x opened this issue Jul 19, 2020 · 0 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Milestone

Comments

@Potat0x
Copy link

Potat0x commented Jul 19, 2020

Affects: 5.2.7.RELEASE

public static void main(String[] args) {
    UriComponentsBuilder b1 = UriComponentsBuilder.fromUriString("example.com");
    b1.queryParam("param", "x");
    UriComponentsBuilder b2 = b1.cloneBuilder();

    System.out.println("b1: " + b1.build().toUriString());
    System.out.println("b2: " + b2.build().toUriString());
    b1.queryParam("param", "y");
    System.out.println("b1: " + b1.build().toUriString());
    System.out.println("b2: " + b2.build().toUriString());
}

actual output:

b1: example.com?param=x
b2: example.com?param=x
b1: example.com?param=x&param=y
b2: example.com?param=x&param=y

expected output:

b1: example.com?param=x
b2: example.com?param=x
b1: example.com?param=x&param=y
b2: example.com?param=x

queryparams_bug

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jul 19, 2020
@jhoeller jhoeller self-assigned this Jul 20, 2020
@jhoeller jhoeller added in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jul 20, 2020
@jhoeller jhoeller added this to the 5.2.8 milestone Jul 20, 2020
@jhoeller jhoeller added the for: backport-to-5.1.x Marks an issue as a candidate for backport to 5.1.x label Jul 20, 2020
@spring-projects-issues spring-projects-issues added status: backported An issue that has been backported to maintenance branches and removed for: backport-to-5.1.x Marks an issue as a candidate for backport to 5.1.x labels Jul 20, 2020
FelixFly pushed a commit to FelixFly/spring-framework that referenced this issue Aug 16, 2020
zx20110729 pushed a commit to zx20110729/spring-framework that referenced this issue Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants