Fix 1 findbugs warning in VmwareResource.java

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

This closes #409
This commit is contained in:
Rafael da Fonseca 2015-06-14 14:00:35 +02:00 committed by Rohit Yadav
parent 474065e98b
commit 11fec86ba3

View File

@ -38,6 +38,7 @@ import java.util.Random;
import java.util.Set;
import java.util.TimeZone;
import java.util.UUID;
import java.io.UnsupportedEncodingException;
import javax.naming.ConfigurationException;
@ -3573,7 +3574,13 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
}
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;
}
protected Answer execute(ValidateSnapshotCommand cmd) {