Commit 0afc634d5b26f979653f35f442c1cc40361d2796
1 parent
294a70fc
No line breaks in description while creating new ticket.
Showing
1 changed file
with
12 additions
and
5 deletions
... | ... | @@ -40,6 +40,7 @@ import javax.xml.bind.JAXBElement; |
40 | 40 | import javax.xml.bind.JAXBException; |
41 | 41 | import javax.xml.namespace.QName; |
42 | 42 | import java.io.IOException; |
43 | +import java.io.UnsupportedEncodingException; | |
43 | 44 | import java.net.URI; |
44 | 45 | import java.net.URISyntaxException; |
45 | 46 | import java.security.KeyManagementException; |
... | ... | @@ -183,14 +184,13 @@ public class YoutrackAPI { |
183 | 184 | { |
184 | 185 | final URI uri; |
185 | 186 | try { |
186 | - uri = new URIBuilder(serviceLocation + "/rest/issue").addParameter("project", project) | |
187 | - .addParameter("summary", summary) | |
188 | - .addParameter("description", description) | |
189 | - .build(); | |
187 | + uri = new URIBuilder(serviceLocation + "/rest/issue").build(); | |
190 | 188 | } catch (URISyntaxException e) { |
191 | 189 | throw new RuntimeException(e); |
192 | 190 | } |
193 | - final HttpResponse response = httpClient.execute(new HttpPut(uri)); | |
191 | + final HttpPut request = createPutRequest(uri, new BasicNameValuePair("project", project), new BasicNameValuePair("summary", summary), | |
192 | + new BasicNameValuePair("description", description)); | |
193 | + final HttpResponse response = httpClient.execute(request); | |
194 | 194 | final StatusLine statusLine = response.getStatusLine(); |
195 | 195 | final HttpEntity entity = response.getEntity(); |
196 | 196 | final String responseText = entity == null ? null : EntityUtils.toString(entity); |
... | ... | @@ -333,6 +333,13 @@ public class YoutrackAPI { |
333 | 333 | } |
334 | 334 | } |
335 | 335 | |
336 | + private HttpPut createPutRequest(URI uri, BasicNameValuePair... nameValuePair) throws UnsupportedEncodingException | |
337 | + { | |
338 | + final HttpPut request = new HttpPut(uri); | |
339 | + request.setEntity(new UrlEncodedFormEntity(Arrays.asList(nameValuePair))); | |
340 | + return request; | |
341 | + } | |
342 | + | |
336 | 343 | private String execute(HttpUriRequest request) throws IOException |
337 | 344 | { |
338 | 345 | final HttpResponse response = httpClient.execute(request); | ... | ... |
Please
register
or
login
to post a comment