cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject [2/2] git commit: updated refs/heads/master to 41c1fdd
Date Tue, 16 Jun 2015 09:57:58 GMT
findbugs: better message and fallback to defaultCharset

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/41c1fdda
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/41c1fdda
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/41c1fdda

Branch: refs/heads/master
Commit: 41c1fddaee12dccded5e3d41d37f0665e6bfc7a2
Parents: 0851e4e
Author: Daan Hoogland <daan.hoogland@gmail.com>
Authored: Tue Jun 16 11:57:15 2015 +0200
Committer: Daan Hoogland <daan.hoogland@gmail.com>
Committed: Tue Jun 16 11:57:15 2015 +0200

----------------------------------------------------------------------
 .../resource/VmwareStorageProcessor.java        | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/41c1fdda/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
index 7a6d9c2..7295685 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
@@ -20,7 +20,9 @@ import java.io.BufferedWriter;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
 import java.net.URI;
+import java.nio.charset.Charset;
 import java.rmi.RemoteException;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -30,7 +32,6 @@ import java.util.UUID;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
-import java.io.UnsupportedEncodingException;
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
@@ -108,11 +109,11 @@ public class VmwareStorageProcessor implements StorageProcessor {
     private static final Logger s_logger = Logger.getLogger(VmwareStorageProcessor.class);
     private static final int DEFAULT_NFS_PORT = 2049;
 
-    private VmwareHostService hostService;
-    private boolean _fullCloneFlag;
-    private VmwareStorageMount mountService;
-    private VmwareResource resource;
-    private Integer _timeout;
+    private final VmwareHostService hostService;
+    private final boolean _fullCloneFlag;
+    private final VmwareStorageMount mountService;
+    private final VmwareResource resource;
+    private final Integer _timeout;
     protected Integer _shutdownWaitMs;
     private final Gson _gson;
     private final StorageLayer _storage = new JavaStorageLayer();
@@ -2265,10 +2266,13 @@ public class VmwareStorageProcessor implements StorageProcessor {
     }
 
     private static String deriveTemplateUuidOnHost(VmwareHypervisorHost hyperHost, String
storeIdentifier, String templateName) {
+        String templateUuid;
         try{
-            String templateUuid = UUID.nameUUIDFromBytes((templateName + "@" + storeIdentifier
+ "-" + hyperHost.getMor().getValue()).getBytes("UTF-8")).toString();
+            templateUuid = UUID.nameUUIDFromBytes((templateName + "@" + storeIdentifier +
"-" + hyperHost.getMor().getValue()).getBytes("UTF-8")).toString();
         }catch(UnsupportedEncodingException e){
-            s_logger.warn("Unable to generate UUID due to unexpected encoding error."+e);
+            s_logger.warn("unexpected encoding error, using default Charset: " + e.getLocalizedMessage());
+            templateUuid = UUID.nameUUIDFromBytes((templateName + "@" + storeIdentifier +
"-" + hyperHost.getMor().getValue()).getBytes(Charset.defaultCharset()))
+                    .toString();
         }
         templateUuid = templateUuid.replaceAll("-", "");
         return templateUuid;


Mime
View raw message