From db91e54bf3c079e6b9932258f6327585f11cac08 Mon Sep 17 00:00:00 2001 From: Likitha Shetty Date: Fri, 14 Feb 2014 17:00:03 +0530 Subject: [PATCH] CLOUDSTACK-6112. Adding VPC router to a guest network fails with StringIndexOutOfBoundsException. --- .../vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java index c0ec41bfa10..9cb37f576bb 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java @@ -270,9 +270,11 @@ public class VMwareGuru extends HypervisorGuruBase implements HypervisorGuru, Co for (NicTO nicTo : sortNicsByDeviceId(to.getNics())) { sbMacSequence.append(nicTo.getMac()).append("|"); } - sbMacSequence.deleteCharAt(sbMacSequence.length() - 1); - String bootArgs = to.getBootArgs(); - to.setBootArgs(bootArgs + " nic_macs=" + sbMacSequence.toString()); + if (!sbMacSequence.toString().isEmpty()) { + sbMacSequence.deleteCharAt(sbMacSequence.length() - 1); + String bootArgs = to.getBootArgs(); + to.setBootArgs(bootArgs + " nic_macs=" + sbMacSequence.toString()); + } }