Skip to content

Commit 1b4a448

Browse files
authored
Fix force creatation of jobs in jenkinsmanager (#10)
- force creation gave an error if it failed removing a job. It should not fail but it should instead create a job. - Add javadoc for baseUrl getter/setter in HttpRequest
1 parent 589b389 commit 1b4a448

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

src/main/java/com/ericsson/eiffelcommons/JenkinsManager.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131

3232
import com.ericsson.eiffelcommons.helpers.MediaType;
3333
import com.ericsson.eiffelcommons.utils.HttpRequest;
34-
import com.ericsson.eiffelcommons.utils.ResponseEntity;
3534
import com.ericsson.eiffelcommons.utils.HttpRequest.HttpMethod;
35+
import com.ericsson.eiffelcommons.utils.ResponseEntity;
3636

3737
public class JenkinsManager {
3838

@@ -137,7 +137,10 @@ public boolean createJob(String jobName, String jobXmlData) throws Exception {
137137
* @throws Exception
138138
*/
139139
public boolean forceCreateJob(String jobName, String jobXmlData) throws Exception {
140-
deleteJob(jobName);
140+
try {
141+
deleteJob(jobName);
142+
} catch(Exception e) {}
143+
141144
return createJob(jobName, jobXmlData);
142145
}
143146

src/main/java/com/ericsson/eiffelcommons/utils/HttpRequest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,22 @@ public HttpRequest(HttpMethod method) {
7777
}
7878
}
7979

80+
/**
81+
* Gets the base url(not including endpoint) for example: http://localhost:8080
82+
* @return String
83+
*/
84+
public String getBaseUrl() {
85+
return baseUrl;
86+
}
87+
88+
/**
89+
* Sets the base url(not including endpoint) for example: http://localhost:8080
90+
* @param baseUrl
91+
*/
92+
public void setBaseUrl(String baseUrl) {
93+
this.baseUrl = baseUrl;
94+
}
95+
8096
/**
8197
* Function that cleans the parameters field.
8298
*/

0 commit comments

Comments
 (0)