]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
Added a UI error message and a log message when the URL passed in is unreachable...
authorRichard Millet <remillet@berkeley.edu>
Wed, 8 Oct 2014 17:36:32 +0000 (10:36 -0700)
committerRichard Millet <remillet@berkeley.edu>
Wed, 8 Oct 2014 17:36:32 +0000 (10:36 -0700)
services/common/src/main/java/org/collectionspace/services/common/blob/BlobInput.java

index ca7807313d7e53685812be710bae1a6f29f78f99..817bc756ddd9c2562e0cd31150726f3456959e4f 100644 (file)
@@ -20,6 +20,7 @@ import org.apache.commons.io.FileUtils;
 public class BlobInput {\r
        private final Logger logger = LoggerFactory.getLogger(BlobInput.class);\r
        private final static String FILE_ACCESS_ERROR = "The following file is either missing or cannot be read: ";\r
+       private final static String URL_DOWNLOAD_FAILED = "Could not download file from the following URL: ";\r
        \r
        private String blobCsid = null;\r
        private File blobFile = null;\r
@@ -198,7 +199,11 @@ public class BlobInput {
                        int status = fetchedFile.getStatus();\r
                        if (status == Download.COMPLETE) {\r
                                theBlobFile = fetchedFile.getFile();\r
-                       } //FIXME: REM - We should throw an exception here if we couldn't download the file.\r
+                       } else {\r
+                               String msg = URL_DOWNLOAD_FAILED + theBlobUri;\r
+                               logger.error(msg);\r
+                               throw new DocumentException(msg);\r
+                       }\r
                } else if (blobUrl.getProtocol().equalsIgnoreCase("file")) {\r
                        theBlobFile = FileUtils.toFile(blobUrl);\r
                        if (theBlobFile.exists() == false || theBlobFile.canRead() == false) {\r