Program: 105527
Project: 105527
Buggy source:
@Override public final Answer executeRequest(final Command cmd){
  URI agentUri=null;
  Class<? extends Command> clazz=cmd.getClass();
  Answer answer=null;
  try {
    String cmdName=cmd.getClass().getName();
    agentUri=new URI("String_Node_Str",null,_agentIp,_port,"String_Node_Str" + cmdName,null,null);
  }
 catch (  URISyntaxException e) {
    String errMsg="String_Node_Str";
    s_logger.error(errMsg,e);
    return null;
  }
  if (cmd instanceof NetworkElementCommand) {
    return _vrResource.executeRequest((NetworkElementCommand)cmd);
  }
  if (clazz == CheckSshCommand.class) {
    answer=execute((CheckSshCommand)cmd);
  }
 else   if (clazz == GetDomRVersionCmd.class) {
    answer=execute((GetDomRVersionCmd)cmd);
  }
 else   if (cmd instanceof NetworkUsageCommand) {
    answer=execute((NetworkUsageCommand)cmd);
  }
 else   if (clazz == IpAssocCommand.class) {
    answer=execute((IpAssocCommand)cmd);
  }
 else   if (clazz == DnsMasqConfigCommand.class) {
    return execute((DnsMasqConfigCommand)cmd);
  }
 else   if (clazz == CreateIpAliasCommand.class) {
    return execute((CreateIpAliasCommand)cmd);
  }
 else   if (clazz == DhcpEntryCommand.class) {
    answer=execute((DhcpEntryCommand)cmd);
  }
 else   if (clazz == VmDataCommand.class) {
    answer=execute((VmDataCommand)cmd);
  }
 else   if (clazz == SavePasswordCommand.class) {
    answer=execute((SavePasswordCommand)cmd);
  }
 else   if (clazz == SetFirewallRulesCommand.class) {
    answer=execute((SetFirewallRulesCommand)cmd);
  }
 else   if (clazz == LoadBalancerConfigCommand.class) {
    answer=execute((LoadBalancerConfigCommand)cmd);
  }
 else   if (clazz == DeleteIpAliasCommand.class) {
    return execute((DeleteIpAliasCommand)cmd);
  }
 else   if (clazz == PingTestCommand.class) {
    answer=execute((PingTestCommand)cmd);
  }
 else   if (clazz == SetStaticNatRulesCommand.class) {
    answer=execute((SetStaticNatRulesCommand)cmd);
  }
 else   if (clazz == CheckRouterCommand.class) {
    answer=execute((CheckRouterCommand)cmd);
  }
 else   if (clazz == SetPortForwardingRulesCommand.class) {
    answer=execute((SetPortForwardingRulesCommand)cmd);
  }
 else   if (clazz == SetSourceNatCommand.class) {
    answer=execute((SetSourceNatCommand)cmd);
  }
 else   if (clazz == Site2SiteVpnCfgCommand.class) {
    answer=execute((Site2SiteVpnCfgCommand)cmd);
  }
 else   if (clazz == CheckS2SVpnConnectionsCommand.class) {
    answer=execute((CheckS2SVpnConnectionsCommand)cmd);
  }
 else   if (clazz == RemoteAccessVpnCfgCommand.class) {
    answer=execute((RemoteAccessVpnCfgCommand)cmd);
  }
 else   if (clazz == VpnUsersCfgCommand.class) {
    answer=execute((VpnUsersCfgCommand)cmd);
  }
 else   if (clazz == SetStaticRouteCommand.class) {
    answer=execute((SetStaticRouteCommand)cmd);
  }
 else   if (clazz == SetMonitorServiceCommand.class) {
    answer=execute((SetMonitorServiceCommand)cmd);
  }
 else   if (clazz == PlugNicCommand.class) {
    answer=execute((PlugNicCommand)cmd);
  }
 else   if (clazz == UnPlugNicCommand.class) {
    answer=execute((UnPlugNicCommand)cmd);
  }
 else   if (clazz == CopyCommand.class) {
    answer=execute((CopyCommand)cmd);
  }
 else {
    if (clazz == StartCommand.class) {
      VirtualMachineTO vmSpec=((StartCommand)cmd).getVirtualMachine();
      if (vmSpec.getType() != VirtualMachine.Type.User) {
        if (s_hypervMgr != null) {
          String secondary=s_hypervMgr.prepareSecondaryStorageStore(Long.parseLong(_zoneId));
          if (secondary != null) {
            ((StartCommand)cmd).setSecondaryStorage(secondary);
          }
        }
 else {
          s_logger.error("String_Node_Str");
        }
      }
    }
    String ansStr=postHttpRequest(s_gson.toJson(cmd),agentUri);
    if (ansStr == null) {
      return Answer.createUnsupportedCommandAnswer(cmd);
    }
    Answer[] result=s_gson.fromJson(ansStr,Answer[].class);
    String logResult=cleanPassword(StringEscapeUtils.unescapeJava(result.toString()));
    s_logger.debug("String_Node_Str" + logResult);
    if (result.length > 0) {
      return result[0];
    }
  }
  return answer;
}

Fixed version (ground truth):
@Override public final Answer executeRequest(final Command cmd){
  URI agentUri=null;
  Class<? extends Command> clazz=cmd.getClass();
  Answer answer=null;
  try {
    String cmdName=cmd.getClass().getName();
    agentUri=new URI("String_Node_Str",null,_agentIp,_port,"String_Node_Str" + cmdName,null,null);
  }
 catch (  URISyntaxException e) {
    String errMsg="String_Node_Str";
    s_logger.error(errMsg,e);
    return null;
  }
  if (cmd instanceof NetworkElementCommand) {
    return _vrResource.executeRequest((NetworkElementCommand)cmd);
  }
  if (clazz == CheckSshCommand.class) {
    answer=execute((CheckSshCommand)cmd);
  }
 else   if (clazz == GetDomRVersionCmd.class) {
    answer=execute((GetDomRVersionCmd)cmd);
  }
 else   if (cmd instanceof NetworkUsageCommand) {
    answer=execute((NetworkUsageCommand)cmd);
  }
 else   if (clazz == IpAssocCommand.class) {
    answer=execute((IpAssocCommand)cmd);
  }
 else   if (clazz == DnsMasqConfigCommand.class) {
    return execute((DnsMasqConfigCommand)cmd);
  }
 else   if (clazz == CreateIpAliasCommand.class) {
    return execute((CreateIpAliasCommand)cmd);
  }
 else   if (clazz == DhcpEntryCommand.class) {
    answer=execute((DhcpEntryCommand)cmd);
  }
 else   if (clazz == VmDataCommand.class) {
    answer=execute((VmDataCommand)cmd);
  }
 else   if (clazz == SavePasswordCommand.class) {
    answer=execute((SavePasswordCommand)cmd);
  }
 else   if (clazz == SetFirewallRulesCommand.class) {
    answer=execute((SetFirewallRulesCommand)cmd);
  }
 else   if (clazz == LoadBalancerConfigCommand.class) {
    answer=execute((LoadBalancerConfigCommand)cmd);
  }
 else   if (clazz == DeleteIpAliasCommand.class) {
    return execute((DeleteIpAliasCommand)cmd);
  }
 else   if (clazz == PingTestCommand.class) {
    answer=execute((PingTestCommand)cmd);
  }
 else   if (clazz == SetStaticNatRulesCommand.class) {
    answer=execute((SetStaticNatRulesCommand)cmd);
  }
 else   if (clazz == CheckRouterCommand.class) {
    answer=execute((CheckRouterCommand)cmd);
  }
 else   if (clazz == SetPortForwardingRulesCommand.class) {
    answer=execute((SetPortForwardingRulesCommand)cmd);
  }
 else   if (clazz == SetSourceNatCommand.class) {
    answer=execute((SetSourceNatCommand)cmd);
  }
 else   if (clazz == Site2SiteVpnCfgCommand.class) {
    answer=execute((Site2SiteVpnCfgCommand)cmd);
  }
 else   if (clazz == CheckS2SVpnConnectionsCommand.class) {
    answer=execute((CheckS2SVpnConnectionsCommand)cmd);
  }
 else   if (clazz == RemoteAccessVpnCfgCommand.class) {
    answer=execute((RemoteAccessVpnCfgCommand)cmd);
  }
 else   if (clazz == VpnUsersCfgCommand.class) {
    answer=execute((VpnUsersCfgCommand)cmd);
  }
 else   if (clazz == SetStaticRouteCommand.class) {
    answer=execute((SetStaticRouteCommand)cmd);
  }
 else   if (clazz == SetMonitorServiceCommand.class) {
    answer=execute((SetMonitorServiceCommand)cmd);
  }
 else   if (clazz == PlugNicCommand.class) {
    answer=execute((PlugNicCommand)cmd);
  }
 else   if (clazz == UnPlugNicCommand.class) {
    answer=execute((UnPlugNicCommand)cmd);
  }
 else   if (clazz == CopyCommand.class) {
    answer=execute((CopyCommand)cmd);
  }
 else {
    if (clazz == StartCommand.class) {
      VirtualMachineTO vmSpec=((StartCommand)cmd).getVirtualMachine();
      if (vmSpec.getType() != VirtualMachine.Type.User) {
        if (s_hypervMgr != null) {
          String secondary=s_hypervMgr.prepareSecondaryStorageStore(Long.parseLong(_zoneId));
          if (secondary != null) {
            ((StartCommand)cmd).setSecondaryStorage(secondary);
          }
        }
 else {
          s_logger.error("String_Node_Str");
        }
      }
    }
    String ansStr=postHttpRequest(s_gson.toJson(cmd),agentUri);
    if (ansStr == null) {
      return Answer.createUnsupportedCommandAnswer(cmd);
    }
    Answer[] result=s_gson.fromJson(ansStr,Answer[].class);
    String logResult=cleanPassword(s_gson.toJson(result));
    s_logger.debug("String_Node_Str" + logResult);
    if (result.length > 0) {
      return result[0];
    }
  }
  return answer;
}