1) I don't see why the existing if/else is being broken here. Was this meant to be 'else if' and not just 'if'?
2) If the 'if' block starting a L138 has executed, then serverGroupName == null, and this code is going to throw an exception.