You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2015/06/15 11:07:01 UTC

[11/13] git commit: updated refs/heads/master to 967da97

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 <ro...@shapeblue.com>

This closes #408


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

Branch: refs/heads/master
Commit: 474065e98b57d666dc4f6403242fd55a201aed25
Parents: aa56fae
Author: Rafael da Fonseca <rs...@gmail.com>
Authored: Sun Jun 14 13:38:09 2015 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Jun 15 12:06:01 2015 +0300

----------------------------------------------------------------------
 .../com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java    | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/474065e9/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
index 1a8f8da..ca98c4f 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
@@ -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;