Skip to content

Commit d99bedd

Browse files
committed
#36 Rename factory method for RestTemplate
In most languages it is a convention that getter/setter are side effect free and do nothing more than get or set a value. So I renamed this method to reflect that it is a factory method. Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
1 parent e2b12e2 commit d99bedd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/io/securecodebox/persistence/defectdojo/service/ImportScanService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ private HttpHeaders getDefectDojoAuthorizationHeaders() {
5555
return headers;
5656
}
5757

58-
protected RestTemplate getRestTemplate() {
58+
protected RestTemplate createRestTemplate() {
5959
if (System.getProperty("http.proxyUser") != null && System.getProperty("http.proxyPassword") != null) {
6060
// Configuring Proxy Authentication explicitly as it isn't done by default for spring rest templates :(
6161
CredentialsProvider credsProvider = new BasicCredentialsProvider();
@@ -84,7 +84,7 @@ protected RestTemplate getRestTemplate() {
8484
* Before version 1.5.4. testName (in DefectDojo _test_type_) must be defectDojoScanName, afterwards, you can have somethings else
8585
*/
8686
protected ImportScanResponse createFindings(ScanFile scanFile, String endpoint, long lead, String currentDate, ScanType scanType, long testType, MultiValueMap<String, Object> options) {
87-
var restTemplate = this.getRestTemplate();
87+
var restTemplate = this.createRestTemplate();
8888
HttpHeaders headers = getDefectDojoAuthorizationHeaders();
8989
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
9090
restTemplate.setMessageConverters(List.of(
@@ -124,7 +124,7 @@ public String getFilename() {
124124
throw new DefectDojoPersistenceException("Failed to attach findings to engagement.");
125125
}
126126
}
127-
127+
128128
public ImportScanResponse importScan(ScanFile scanFile, long engagementId, long lead, String currentDate, ScanType scanType, long testType) {
129129
var additionalValues = new LinkedMultiValueMap<String, Object>();
130130
additionalValues.add("engagement", Long.toString(engagementId));

0 commit comments

Comments
 (0)