jenkinsci / jenkinsci/java-client-api

I encountered a ClientProtocolException problem

Open
#458 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
913
Forks
466
PR merge metrics
No merged PRs in 30d

Description

I encountered a ClientProtocolException problem when I called the build.Stop() method with Jenkins server version 2.32.2;
`public String Stop() throws HttpResponseException, IOException {`
` try { `
`return client.get(url + "stop");`
`} catch (IOException ex) {`
`if (((HttpResponseException) ex).getStatusCode() == 405) {`
`stopPost();`
`return ""; `
` } `
`}`
` return "";`
`}`

This version of the stop API should be Post on http://url/job/testJob/1/stop, but is actually call the Get http://url/job/testJob/1/stop/api/json, resulting in Jenkins CircularRedirectException from server

>

>

Contributor guide

Open the contributing guide

Research direction

Start by inspecting the Stop() and stopPost() methods and how client.get constructs the request URL. Reproduce the call against Jenkins 2.32.2 and verify that stopping a build uses the POST endpoint rather than requesting /stop/api/json with GET. Done means the stop operation completes without the redirect or ClientProtocolException.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.