From: Richard Millet Date: Wed, 8 Oct 2014 17:36:32 +0000 (-0700) Subject: Added a UI error message and a log message when the URL passed in is unreachable... X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=84942e6865224dd5bb16029ead564e79b4762b98;p=tmp%2Fjakarta-migration.git Added a UI error message and a log message when the URL passed in is unreachable for media download. --- 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) {