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 ab1a01d66cf..0bad8a63ccb 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 {