|
3 | 3 | import java.io.Serializable;
|
4 | 4 | import java.io.UnsupportedEncodingException;
|
5 | 5 | import java.net.URISyntaxException;
|
| 6 | +import java.net.URLEncoder; |
| 7 | +import java.nio.charset.StandardCharsets; |
6 | 8 | import java.util.ArrayList;
|
7 | 9 | import java.util.Collections;
|
8 | 10 | import java.util.List;
|
9 | 11 | import java.util.Set;
|
10 | 12 |
|
11 |
| -import org.apache.commons.httpclient.URIException; |
12 |
| -import org.apache.commons.httpclient.util.URIUtil; |
13 | 13 | import org.apache.http.HttpStatus;
|
14 | 14 | import org.apache.http.client.utils.URIBuilder;
|
15 | 15 | import org.apache.http.entity.ContentType;
|
@@ -144,15 +144,8 @@ public long createChallenge(final Project project, final Challenge challenge)
|
144 | 144 | {
|
145 | 145 | final JsonObject challengeJson = challenge.toJson(challenge.getName());
|
146 | 146 | final String type = challengeJson.has(Survey.KEY_ANSWERS) ? KEY_SURVEY : KEY_CHALLENGE;
|
147 |
| - String encodedChallengeQuery = challenge.getName(); |
148 |
| - try |
149 |
| - { |
150 |
| - encodedChallengeQuery = URIUtil.encodeQuery(challenge.getName()); |
151 |
| - } |
152 |
| - catch (final URIException error) |
153 |
| - { |
154 |
| - logger.info("Unable to encode Challenge name {}.", challenge.getName()); |
155 |
| - } |
| 147 | + final String encodedChallengeQuery = URLEncoder |
| 148 | + .encode(challenge.getName(), StandardCharsets.UTF_8).replace("+", "%20"); |
156 | 149 | return create(
|
157 | 150 | String.format("/api/v2/project/%d/challenge/%s", project.getId(),
|
158 | 151 | encodedChallengeQuery),
|
|
0 commit comments