Skip to content

Commit

Permalink
Fixed #398 - Replace literal status codes with constants
Browse files Browse the repository at this point in the history
  • Loading branch information
khmarbaise committed Apr 1, 2019
1 parent 3dcf840 commit e252da2
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import java.io.IOException;

import org.apache.http.HttpStatus;
import org.apache.http.client.HttpResponseException;

public class Build extends BaseModel {
Expand Down Expand Up @@ -122,6 +123,7 @@ public TestReport getTestReport() throws IOException {
* @throws IOException in case of an error.
*/
public TestResult getTestResult() throws IOException {

return client.get(this.getUrl() + "/testReport/?depth=1", TestResult.class);
}

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

return client.get(url + "stop");
} catch (HttpResponseException ex) {
if (ex.getStatusCode() == 405) {
if (ex.getStatusCode() == HttpStatus.SC_METHOD_NOT_ALLOWED) {
stopPost();
return "";
}
Expand All @@ -164,7 +166,7 @@ public String Stop(boolean crumbFlag) throws HttpResponseException, IOException

return client.get(url + "stop");
} catch (HttpResponseException ex) {
if (ex.getStatusCode() == 405) {
if (ex.getStatusCode() == HttpStatus.SC_METHOD_NOT_ALLOWED) {
stopPost(crumbFlag);
return "";
}
Expand Down

0 comments on commit e252da2

Please sign in to comment.