cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [01/34] git commit: updated refs/heads/master to 7a57ce3
Date Mon, 15 Jun 2015 09:14:34 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master ccd7d41ee -> 7a57ce333


Fix 3 findbugs encoding warnings in VmwareStorageProcessor.java Ova templates and metadata
should be written to file in UTF-8 Fix warning in UUID generation

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

This closes #411


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

Branch: refs/heads/master
Commit: 85ad1b7e0fe366147b2e986e4388d618a5a68145
Parents: ccd7d41
Author: Rafael da Fonseca <rsafonseca@gmail.com>
Authored: Sun Jun 14 14:17:40 2015 +0200
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Mon Jun 15 12:09:13 2015 +0300

----------------------------------------------------------------------
 .../cloud/storage/resource/VmwareStorageProcessor.java | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/85ad1b7e/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 ab1a01d..0bad8a6 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
@@ -30,6 +30,7 @@ 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;
@@ -680,7 +681,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
         // TODO a bit ugly here
         BufferedWriter out = null;
         try {
-            out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(installFullPath
+ "/template.properties")));
+            out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(installFullPath
+ "/template.properties"),"UTF-8"));
             out.write("filename=" + templateName + ".ova");
             out.newLine();
             out.write("description=");
@@ -859,7 +860,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
         // TODO a bit ugly here
         BufferedWriter out = null;
         try {
-            out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(installFullPath
+ "/" + templateName + ".ova.meta")));
+            out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(installFullPath
+ "/" + templateName + ".ova.meta"),"UTF-8"));
             out.write("ova.filename=" + templateName + ".ova");
             out.newLine();
             out.write("version=1.0");
@@ -1388,7 +1389,13 @@ public class VmwareStorageProcessor implements StorageProcessor {
     }
 
     private static String getSecondaryDatastoreUUID(String storeUrl) {
-        return UUID.nameUUIDFromBytes(storeUrl.getBytes()).toString();
+        String uuid = null;
+        try{
+            uuid=UUID.nameUUIDFromBytes(storeUrl.getBytes("UTF-8")).toString();
+        }catch(UnsupportedEncodingException e){
+            s_logger.warn("Failed to create UUID from string " + storeUrl + ". Bad storeUrl
or UTF-8 encoding error." );
+        }
+        return uuid;
     }
 
     public synchronized ManagedObjectReference prepareSecondaryDatastoreOnHost(String storeUrl)
throws Exception {


Mime
View raw message