← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20639: Small hack to avoid exception on windows with jclouds

 

------------------------------------------------------------
revno: 20639
committer: Halvdan Hoem Grelland <halvdanhg@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-10-12 17:19:46 +0200
message:
  Small hack to avoid exception on windows with jclouds
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	2015-10-07 23:01:57 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/fileresource/JCloudsFileResourceContentStore.java	2015-10-12 15:19:46 +0000
@@ -54,6 +54,7 @@
 import java.io.InputStream;
 import java.net.URI;
 import java.nio.file.Files;
+import java.nio.file.attribute.UserPrincipalNotFoundException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -276,6 +277,8 @@
             .contentMD5( HashCode.fromString( contentMd5 ) )
             .build();
 
+        org.jclouds.filesystem.util.Utils
+
         if ( blob == null )
         {
             return null;
@@ -342,7 +345,26 @@
 
     private String putBlob( Blob blob )
     {
-        return blobStore.putBlob( container, blob );
+        String etag = null;
+
+        try
+        {
+            etag = blobStore.putBlob( container, blob );
+        }
+        catch ( RuntimeException rte )
+        {
+            Throwable cause = rte.getCause();
+
+            if ( ( cause == null ) || !( cause instanceof UserPrincipalNotFoundException ) )
+            {
+                throw rte;
+            }
+            // Else:
+            //  Intentionally ignored exception which occurs with JClouds on
+            //  non-English Windows installation while trying to resolve the "Everyone" group.
+        }
+
+        return etag;
     }
 
     private Blob createBlob( String key, ByteSource content, long size, String contentMd5 )