From 02845bc1bf6195572bedbd38dfc1082c592d567b Mon Sep 17 00:00:00 2001 From: Vishal Chaudhary Date: Thu, 12 Oct 2023 15:57:48 +0530 Subject: [PATCH] ASPL-532 Better message to be conveyed in Jenkins console when traffic file > 200Mb is uploaded --- .../com/hcl/appscan/sdk/scan/ASEScanServiceProvider.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/hcl/appscan/sdk/scan/ASEScanServiceProvider.java b/src/main/java/com/hcl/appscan/sdk/scan/ASEScanServiceProvider.java index 10382936..f6e8ba2a 100644 --- a/src/main/java/com/hcl/appscan/sdk/scan/ASEScanServiceProvider.java +++ b/src/main/java/com/hcl/appscan/sdk/scan/ASEScanServiceProvider.java @@ -244,9 +244,14 @@ private Boolean updateTrafficJob(File file, String jobId, String action) { HttpResponse response = client.postMultipart(request_url, request_headers, parts); int status = response.getResponseCode(); if (status != HttpsURLConnection.HTTP_OK) { - return false; + JSONObject json = (JSONObject) response.getResponseBodyAsJSON(); + if(json != null && json.has("errorMessage")){ + String errorResponse = json.getString("errorMessage"); + m_progress.setStatus(new Message(Message.ERROR, errorResponse)); + } + return false; } - } catch(IOException e) { + } catch(IOException | JSONException e) { m_progress.setStatus(new Message(Message.ERROR, Messages.getMessage(ERROR_UPDATE_JOB, e.getLocalizedMessage()))); return false; }