diff --git a/spring-web/src/main/java/org/springframework/web/util/HierarchicalUriComponents.java b/spring-web/src/main/java/org/springframework/web/util/HierarchicalUriComponents.java index 55b980f827..0912430d07 100644 --- a/spring-web/src/main/java/org/springframework/web/util/HierarchicalUriComponents.java +++ b/spring-web/src/main/java/org/springframework/web/util/HierarchicalUriComponents.java @@ -554,7 +554,7 @@ final class HierarchicalUriComponents extends UriComponents { QUERY_PARAM { @Override public boolean isAllowed(int c) { - if ('=' == c || '+' == c || '&' == c) { + if ('=' == c || '&' == c) { return false; } else { diff --git a/spring-web/src/test/java/org/springframework/web/util/UriComponentsBuilderTests.java b/spring-web/src/test/java/org/springframework/web/util/UriComponentsBuilderTests.java index 5c6731df1e..8322d5132b 100644 --- a/spring-web/src/test/java/org/springframework/web/util/UriComponentsBuilderTests.java +++ b/spring-web/src/test/java/org/springframework/web/util/UriComponentsBuilderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -189,6 +189,14 @@ public class UriComponentsBuilderTests { assertEquals("1USD=?EUR", result.getQueryParams().getFirst("q")); } + @Test // SPR-14828 + public void fromUriStringQueryParamEncodedAndContainingPlus() throws Exception { + String httpUrl = "http://localhost:8080/test/print?value=%EA%B0%80+%EB%82%98"; + URI uri = UriComponentsBuilder.fromHttpUrl(httpUrl).build(true).toUri(); + + assertEquals(httpUrl, uri.toString()); + } + @Test // SPR-10779 public void fromHttpUrlStringCaseInsesitiveScheme() { assertEquals("http", UriComponentsBuilder.fromHttpUrl("HTTP://www.google.com").build().getScheme());