Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
Issue #168
  • Loading branch information
rsoika committed Nov 25, 2022
1 parent d229096 commit 50dc683
Showing 1 changed file with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,22 @@ public byte[] loadFileFromArchive(FileData fileData) throws RestAPIException {
} else {
Client rsClient = documentClient.newClient();
String url = archiveServiceEndpoint.get() + "/archive/md5/" + md5;
Response reponse = rsClient.target(url).request(MediaType.APPLICATION_OCTET_STREAM).get();

// InputStream is = reponse.readEntity(InputStream.class);
byte[] fileContent = reponse.readEntity(byte[].class);
if (fileContent != null && fileContent.length > 0) {
if (debug) {
logger.finest("......md5 data object found");
Response response = rsClient.target(url).request(MediaType.APPLICATION_OCTET_STREAM).get();
byte[] fileContent=null;
try {
// InputStream is = reponse.readEntity(InputStream.class);
fileContent = response.readEntity(byte[].class);
if (fileContent != null && fileContent.length > 0) {
if (debug) {
logger.finest("......md5 data object found");
}
}
return fileContent;
} finally {
// explicit close client!
response.close();
rsClient.close();
}
return fileContent;
}
} catch (ProcessingException e) {
String message = null;
Expand Down

0 comments on commit 50dc683

Please # to comment.