Fix findbugs encoding warning in VmwareServerDiscoverer.java Input string should only contain safe characters, since it's derived from a Long object. This just gets rid of the findbugs warning

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

This closes #408
This commit is contained in:
Rafael da Fonseca 2015-06-14 13:38:09 +02:00 committed by Rohit Yadav
parent aa56faec51
commit 474065e98b
1 changed files with 5 additions and 1 deletions

View File

@ -398,7 +398,11 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer
}
// place a place holder guid derived from cluster ID
cluster.setGuid(UUID.nameUUIDFromBytes(String.valueOf(clusterId).getBytes()).toString());
try{
cluster.setGuid(UUID.nameUUIDFromBytes(String.valueOf(clusterId).getBytes("UTF-8")).toString());
}catch(UnsupportedEncodingException e){
throw new DiscoveredWithErrorException("Unable to create UUID based on string " + String.valueOf(clusterId) + ". Bad clusterId or UTF-8 encoding error.");
}
_clusterDao.update(clusterId, cluster);
// Flag cluster discovery success
failureInClusterDiscovery = false;