From 84942e6865224dd5bb16029ead564e79b4762b98 Mon Sep 17 00:00:00 2001 From: Richard Millet Date: Wed, 8 Oct 2014 10:36:32 -0700 Subject: [PATCH] Added a UI error message and a log message when the URL passed in is unreachable for media download. --- .../collectionspace/services/common/blob/BlobInput.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/services/common/src/main/java/org/collectionspace/services/common/blob/BlobInput.java b/services/common/src/main/java/org/collectionspace/services/common/blob/BlobInput.java index ca7807313..817bc756d 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/blob/BlobInput.java +++ b/services/common/src/main/java/org/collectionspace/services/common/blob/BlobInput.java @@ -20,6 +20,7 @@ import org.apache.commons.io.FileUtils; public class BlobInput { private final Logger logger = LoggerFactory.getLogger(BlobInput.class); private final static String FILE_ACCESS_ERROR = "The following file is either missing or cannot be read: "; + private final static String URL_DOWNLOAD_FAILED = "Could not download file from the following URL: "; private String blobCsid = null; private File blobFile = null; @@ -198,7 +199,11 @@ public class BlobInput { int status = fetchedFile.getStatus(); if (status == Download.COMPLETE) { theBlobFile = fetchedFile.getFile(); - } //FIXME: REM - We should throw an exception here if we couldn't download the file. + } else { + String msg = URL_DOWNLOAD_FAILED + theBlobUri; + logger.error(msg); + throw new DocumentException(msg); + } } else if (blobUrl.getProtocol().equalsIgnoreCase("file")) { theBlobFile = FileUtils.toFile(blobUrl); if (theBlobFile.exists() == false || theBlobFile.canRead() == false) { -- 2.47.3