Skip to content

Commit

Permalink
Merge pull request #29 from diging/develop
Browse files Browse the repository at this point in the history
exception handling
  • Loading branch information
jdamerow authored Jun 29, 2020
2 parents dca9a2d + 2bf0cd6 commit 37da8b1
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,18 +127,24 @@ public void extractImages(IImageExtractionRequest request) throws CepheusExtract
ImageType.valueOf(type));
String fileName = request.getFilename() + "." + i + "." + format;
Page pageImage = saveImage(request.getRequestId(), request.getDocumentId(), image, fileName);

requestPage.setDownloadUrl(restEndpoint + DownloadFileController.GET_FILE_URL
.replace(DownloadFileController.REQUEST_ID_PLACEHOLDER, request.getRequestId())
.replace(DownloadFileController.DOCUMENT_ID_PLACEHOLDER, request.getDocumentId())
.replace(DownloadFileController.FILENAME_PLACEHOLDER, pageImage.filename));

requestPage.setDownloadUrl(
restEndpoint + DownloadFileController.GET_FILE_URL
.replace(
DownloadFileController.REQUEST_ID_PLACEHOLDER,
request.getRequestId())
.replace(
DownloadFileController.DOCUMENT_ID_PLACEHOLDER,
request.getDocumentId())
.replace(DownloadFileController.FILENAME_PLACEHOLDER,
pageImage.filename));
requestPage.setPathToFile(pageImage.path);
requestPage.setFilename(pageImage.filename);
requestPage.setContentType(pageImage.contentType);
requestPage.setSize(pageImage.size);
requestPage.setStatus(PageStatus.COMPLETE);

} catch (IllegalArgumentException | IOException e) {
} catch (IllegalArgumentException | IOException | NegativeArraySizeException e) {
messageHandler.handleMessage("Could not render image.", e, MessageType.ERROR);
requestPage.setStatus(PageStatus.FAILED);
requestPage.setErrorMsg(e.getMessage());
Expand Down

0 comments on commit 37da8b1

Please sign in to comment.