mirror of https://github.com/apache/cloudstack.git
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
This commit is contained in:
parent
ccd7d41ee3
commit
85ad1b7e0f
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue