Skip to content

Commit

Permalink
Update CloudScanServiceProvider.java
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalhcl-5960 committed Dec 16, 2024
1 parent c7fa232 commit ad434e9
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public String rescan(String scanId, Map<String, String> params) {
updateParams.put("Name", params.remove(CoreConstants.SCAN_NAME));
updateParams.put("EnableMailNotifications", params.remove(CoreConstants.EMAIL_NOTIFICATION));
updateParams.put("FullyAutomatic", params.remove("FullyAutomatic"));
updateScanData(updateParams, scanId, m_authProvider, m_progress);
updateScanData(updateParams, scanId);

String progressMessage = Messages.getMessage(RESCAN_SUCCESS);
String overviewMessage = Messages.getMessage(RESCAN_OVERVIEW);
Expand Down Expand Up @@ -325,24 +325,24 @@ public JSONArray getBaseScanDetails(String scanId) {
return null;
}

public void updateScanData(Map<String, String> params, String scanId, IAuthenticationProvider provider, IProgress progress) {
if (provider.isTokenExpired()) {
public void updateScanData(Map<String, String> params, String scanId) {
if (loginExpired()) {
return;
}

String request_url = provider.getServer() + String.format(API_SCANNER,scanId);
Map<String, String> request_headers = provider.getAuthorizationHeader(true);
String request_url = m_authProvider.getServer() + String.format(API_SCANNER,scanId);
Map<String, String> request_headers = m_authProvider.getAuthorizationHeader(true);
request_headers.put("accept", "application/json");
request_headers.put("Content-Type", "application/json");

HttpClient client = new HttpClient(provider.getProxy(), provider.getacceptInvalidCerts());
HttpClient client = new HttpClient(m_authProvider.getProxy(), m_authProvider.getacceptInvalidCerts());
try {
HttpResponse response = client.put(request_url, request_headers, params);
if (response.getResponseCode() == HttpsURLConnection.HTTP_NO_CONTENT) {
progress.setStatus(new Message(Message.INFO, Messages.getMessage(UPDATE_JOB)));
m_progress.setStatus(new Message(Message.INFO, Messages.getMessage(UPDATE_JOB)));
}
} catch (IOException | JSONException e) {
progress.setStatus(new Message(Message.ERROR, Messages.getMessage(ERROR_UPDATE_JOB, e.getLocalizedMessage())));
m_progress.setStatus(new Message(Message.ERROR, Messages.getMessage(ERROR_UPDATE_JOB, e.getLocalizedMessage())));
}
}
}

0 comments on commit ad434e9

Please sign in to comment.