← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21981: File store. Catching and logging HttpResponseException on startup. If filestore is enabled and ne...

 

------------------------------------------------------------
revno: 21981
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2016-02-16 16:30:36 -0500
message:
  File store. Catching and logging HttpResponseException on startup. If filestore is enabled and network not available, dhis would not start.
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/fileresource/JCloudsFileResourceContentStore.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/fileresource/JCloudsFileResourceContentStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/fileresource/JCloudsFileResourceContentStore.java	2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/fileresource/JCloudsFileResourceContentStore.java	2016-02-16 21:30:36 +0000
@@ -48,6 +48,7 @@
 import org.jclouds.domain.Location;
 import org.jclouds.filesystem.reference.FilesystemConstants;
 import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponseException;
 import org.joda.time.Minutes;
 
 import java.io.File;
@@ -168,10 +169,18 @@
         Optional<? extends Location> configuredLocation = blobStore.listAssignableLocations()
             .stream().filter( l -> l.getId().equals( location ) ).findFirst();
 
-        blobStore.createContainerInLocation( configuredLocation.isPresent() ? configuredLocation.get() : null, container );
+        try
+        {
+            blobStore.createContainerInLocation( configuredLocation.isPresent() ? configuredLocation.get() : null, container );
 
-        log.info( "File store configured with provider '" + provider + "' and container '" + container + "'. " +
-            ( configuredLocation.isPresent() ? "Provider location: " + configuredLocation.get().getId() : StringUtils.EMPTY ) );
+            log.info( "File store configured with provider '" + provider + "' and container '" + container + "'. " +
+                ( configuredLocation.isPresent() ? "Provider location: " + configuredLocation.get().getId() : StringUtils.EMPTY ) );
+        }
+        catch ( HttpResponseException ex )
+        {
+            log.error( "Could not configure file store with provider '" + provider + "' and container '" + container + "'. " +
+                "Check your internet connectivity. File storage will not be available.", ex );
+        }
     }
 
     public void cleanUp()