Skip to content

Commit e252da2

Browse files
committed
Fixed jenkinsci#398 - Replace literal status codes with constants
1 parent 3dcf840 commit e252da2

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

  • jenkins-client/src/main/java/com/offbytwo/jenkins/model

jenkins-client/src/main/java/com/offbytwo/jenkins/model/Build.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import java.io.IOException;
1010

11+
import org.apache.http.HttpStatus;
1112
import org.apache.http.client.HttpResponseException;
1213

1314
public class Build extends BaseModel {
@@ -122,6 +123,7 @@ public TestReport getTestReport() throws IOException {
122123
* @throws IOException in case of an error.
123124
*/
124125
public TestResult getTestResult() throws IOException {
126+
125127
return client.get(this.getUrl() + "/testReport/?depth=1", TestResult.class);
126128
}
127129

@@ -141,7 +143,7 @@ public String Stop() throws HttpResponseException, IOException {
141143

142144
return client.get(url + "stop");
143145
} catch (HttpResponseException ex) {
144-
if (ex.getStatusCode() == 405) {
146+
if (ex.getStatusCode() == HttpStatus.SC_METHOD_NOT_ALLOWED) {
145147
stopPost();
146148
return "";
147149
}
@@ -164,7 +166,7 @@ public String Stop(boolean crumbFlag) throws HttpResponseException, IOException
164166

165167
return client.get(url + "stop");
166168
} catch (HttpResponseException ex) {
167-
if (ex.getStatusCode() == 405) {
169+
if (ex.getStatusCode() == HttpStatus.SC_METHOD_NOT_ALLOWED) {
168170
stopPost(crumbFlag);
169171
return "";
170172
}

0 commit comments

Comments
 (0)