- try {
- if (responseWrapper.isEmpty()) {
- byte[] value = artifactsBusinessLogic
- .downloadResourceInstanceArtifactByUUIDs(componentType, uuid, resourceInstanceName, artifactUUID);
- InputStream is = new ByteArrayInputStream(value);
- Map<String, String> headers = new HashMap<>();
- headers.put(Constants.MD5_HEADER, GeneralUtility.calculateMD5Base64EncodedByByteArray(value));
- responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.OK);
- responseWrapper.setInnerElement(buildOkResponse(responseFormat, is, headers));
- }
+ if (!responseWrapper.isEmpty()) {
+ getComponentsUtils().auditExternalDownloadArtifact(responseFormat, new ResourceCommonInfo(resourceInstanceName, componentTypeValue),
+ new DistributionData(instanceIdHeader, requestURI), requestId, artifactUUID, userId);
+ return responseWrapper.getInnerElement();
+ }
+ byte[] value = artifactsBusinessLogic
+ .downloadResourceInstanceArtifactByUUIDs(componentType, uuid, resourceInstanceName, artifactUUID);
+ try (InputStream is = new ByteArrayInputStream(value)) {
+ Map<String, String> headers = new HashMap<>();
+ headers.put(Constants.MD5_HEADER, GeneralUtility.calculateMD5Base64EncodedByByteArray(value));
+ responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.OK);
+ responseWrapper.setInnerElement(buildOkResponse(responseFormat, is, headers));