Program: 59297
Project: 59297
Buggy source:
public String createContainer(String name,Map<String,Object> containerConfiguration){
  this.pingDockerServer();
  String image=getImageName(containerConfiguration);
  CreateContainerCmd createContainerCmd=this.dockerClient.createContainerCmd(image);
  createContainerCmd.withName(name);
  Set<ExposedPort> allExposedPorts=resolveExposedPorts(containerConfiguration,createContainerCmd);
  if (!allExposedPorts.isEmpty()) {
    int numberOfExposedPorts=allExposedPorts.size();
    createContainerCmd.withExposedPorts(allExposedPorts.toArray(new ExposedPort[numberOfExposedPorts]));
  }
  if (containerConfiguration.containsKey(WORKING_DIR)) {
    createContainerCmd.withWorkingDir(asString(containerConfiguration,WORKING_DIR));
  }
  if (containerConfiguration.containsKey(DISABLE_NETWORK)) {
    createContainerCmd.withDisableNetwork(asBoolean(containerConfiguration,DISABLE_NETWORK));
  }
  if (containerConfiguration.containsKey(HOST_NAME)) {
    createContainerCmd.withHostName(asString(containerConfiguration,HOST_NAME));
  }
  if (containerConfiguration.containsKey(PORT_SPECS)) {
    List<String> portSpecs=asListOfString(containerConfiguration,PORT_SPECS);
    createContainerCmd.withPortSpecs(portSpecs.toArray(new String[portSpecs.size()]));
  }
  if (containerConfiguration.containsKey(USER)) {
    createContainerCmd.withUser(asString(containerConfiguration,USER));
  }
  if (containerConfiguration.containsKey(TTY)) {
    createContainerCmd.withTty(asBoolean(containerConfiguration,TTY));
  }
  if (containerConfiguration.containsKey(STDIN_OPEN)) {
    createContainerCmd.withStdinOpen(asBoolean(containerConfiguration,STDIN_OPEN));
  }
  if (containerConfiguration.containsKey(STDIN_ONCE)) {
    createContainerCmd.withStdInOnce(asBoolean(containerConfiguration,STDIN_ONCE));
  }
  if (containerConfiguration.containsKey(MEMORY_LIMIT)) {
    createContainerCmd.withMemoryLimit(asInt(containerConfiguration,MEMORY_LIMIT));
  }
  if (containerConfiguration.containsKey(MEMORY_SWAP)) {
    createContainerCmd.withMemorySwap(asInt(containerConfiguration,MEMORY_SWAP));
  }
  if (containerConfiguration.containsKey(CPU_SHARES)) {
    createContainerCmd.withCpuShares(asInt(containerConfiguration,CPU_SHARES));
  }
  if (containerConfiguration.containsKey(ATTACH_STDIN)) {
    createContainerCmd.withAttachStdin(asBoolean(containerConfiguration,ATTACH_STDIN));
  }
  if (containerConfiguration.containsKey(ATTACH_STDERR)) {
    createContainerCmd.withAttachStderr(asBoolean(containerConfiguration,ATTACH_STDERR));
  }
  if (containerConfiguration.containsKey(ENV)) {
    List<String> env=asListOfString(containerConfiguration,ENV);
    env=resolveDockerServerIpInList(env);
    createContainerCmd.withEnv(env.toArray(new String[env.size()]));
  }
  if (containerConfiguration.containsKey(CMD)) {
    List<String> cmd=asListOfString(containerConfiguration,CMD);
    createContainerCmd.withCmd(cmd.toArray(new String[cmd.size()]));
  }
  if (containerConfiguration.containsKey(DNS)) {
    List<String> dns=asListOfString(containerConfiguration,DNS);
    createContainerCmd.withDns(dns.toArray(new String[dns.size()]));
  }
  if (containerConfiguration.containsKey(VOLUMES)) {
    List<String> volumes=asListOfString(containerConfiguration,VOLUMES);
    createContainerCmd.withVolumes(toVolumes(volumes));
  }
  if (containerConfiguration.containsKey(VOLUMES_FROM)) {
    List<String> volumesFrom=asListOfString(containerConfiguration,VOLUMES_FROM);
    createContainerCmd.withVolumesFrom(toVolumesFrom(volumesFrom));
  }
  boolean alwaysPull=false;
  if (containerConfiguration.containsKey(ALWAYS_PULL)) {
    alwaysPull=asBoolean(containerConfiguration,ALWAYS_PULL);
  }
  if (alwaysPull) {
    log.info(String.format("String_Node_Str",image));
    this.pullImage(image);
  }
  try {
    return createContainerCmd.exec().getId();
  }
 catch (  NotFoundException e) {
    if (!alwaysPull) {
      log.warning(String.format("String_Node_Str",image));
      this.pullImage(image);
      return createContainerCmd.exec().getId();
    }
 else {
      throw e;
    }
  }
}

Fixed version (ground truth):
public String createContainer(String name,Map<String,Object> containerConfiguration){
  this.pingDockerServer();
  String image=getImageName(containerConfiguration);
  CreateContainerCmd createContainerCmd=this.dockerClient.createContainerCmd(image);
  createContainerCmd.withName(name);
  Set<ExposedPort> allExposedPorts=resolveExposedPorts(containerConfiguration,createContainerCmd);
  if (!allExposedPorts.isEmpty()) {
    int numberOfExposedPorts=allExposedPorts.size();
    createContainerCmd.withExposedPorts(allExposedPorts.toArray(new ExposedPort[numberOfExposedPorts]));
  }
  if (containerConfiguration.containsKey(WORKING_DIR)) {
    createContainerCmd.withWorkingDir(asString(containerConfiguration,WORKING_DIR));
  }
  if (containerConfiguration.containsKey(DISABLE_NETWORK)) {
    createContainerCmd.withNetworkDisabled(asBoolean(containerConfiguration,DISABLE_NETWORK));
  }
  if (containerConfiguration.containsKey(HOST_NAME)) {
    createContainerCmd.withHostName(asString(containerConfiguration,HOST_NAME));
  }
  if (containerConfiguration.containsKey(PORT_SPECS)) {
    List<String> portSpecs=asListOfString(containerConfiguration,PORT_SPECS);
    createContainerCmd.withPortSpecs(portSpecs.toArray(new String[portSpecs.size()]));
  }
  if (containerConfiguration.containsKey(USER)) {
    createContainerCmd.withUser(asString(containerConfiguration,USER));
  }
  if (containerConfiguration.containsKey(TTY)) {
    createContainerCmd.withTty(asBoolean(containerConfiguration,TTY));
  }
  if (containerConfiguration.containsKey(STDIN_OPEN)) {
    createContainerCmd.withStdinOpen(asBoolean(containerConfiguration,STDIN_OPEN));
  }
  if (containerConfiguration.containsKey(STDIN_ONCE)) {
    createContainerCmd.withStdInOnce(asBoolean(containerConfiguration,STDIN_ONCE));
  }
  if (containerConfiguration.containsKey(MEMORY_LIMIT)) {
    createContainerCmd.withMemoryLimit(asInt(containerConfiguration,MEMORY_LIMIT));
  }
  if (containerConfiguration.containsKey(MEMORY_SWAP)) {
    createContainerCmd.withMemorySwap(asInt(containerConfiguration,MEMORY_SWAP));
  }
  if (containerConfiguration.containsKey(CPU_SHARES)) {
    createContainerCmd.withCpuShares(asInt(containerConfiguration,CPU_SHARES));
  }
  if (containerConfiguration.containsKey(ATTACH_STDIN)) {
    createContainerCmd.withAttachStdin(asBoolean(containerConfiguration,ATTACH_STDIN));
  }
  if (containerConfiguration.containsKey(ATTACH_STDERR)) {
    createContainerCmd.withAttachStderr(asBoolean(containerConfiguration,ATTACH_STDERR));
  }
  if (containerConfiguration.containsKey(ENV)) {
    List<String> env=asListOfString(containerConfiguration,ENV);
    env=resolveDockerServerIpInList(env);
    createContainerCmd.withEnv(env.toArray(new String[env.size()]));
  }
  if (containerConfiguration.containsKey(CMD)) {
    List<String> cmd=asListOfString(containerConfiguration,CMD);
    createContainerCmd.withCmd(cmd.toArray(new String[cmd.size()]));
  }
  if (containerConfiguration.containsKey(DNS)) {
    List<String> dns=asListOfString(containerConfiguration,DNS);
    createContainerCmd.withDns(dns.toArray(new String[dns.size()]));
  }
  if (containerConfiguration.containsKey(VOLUMES)) {
    List<String> volumes=asListOfString(containerConfiguration,VOLUMES);
    createContainerCmd.withVolumes(toVolumes(volumes));
  }
  if (containerConfiguration.containsKey(VOLUMES_FROM)) {
    List<String> volumesFrom=asListOfString(containerConfiguration,VOLUMES_FROM);
    createContainerCmd.withVolumesFrom(toVolumesFrom(volumesFrom));
  }
  if (containerConfiguration.containsKey(BINDS)) {
    List<String> binds=asListOfString(containerConfiguration,BINDS);
    createContainerCmd.withBinds(toBinds(binds));
  }
  if (containerConfiguration.containsKey(LINKS)) {
    createContainerCmd.withLinks(toLinks(asListOfString(containerConfiguration,LINKS)));
  }
  if (containerConfiguration.containsKey(PORT_BINDINGS)) {
    List<String> portBindings=asListOfString(containerConfiguration,PORT_BINDINGS);
    Ports ports=assignPorts(portBindings);
    createContainerCmd.withPortBindings(ports);
  }
  if (containerConfiguration.containsKey(PRIVILEGED)) {
    createContainerCmd.withPrivileged(asBoolean(containerConfiguration,PRIVILEGED));
  }
  if (containerConfiguration.containsKey(PUBLISH_ALL_PORTS)) {
    createContainerCmd.withPublishAllPorts(asBoolean(containerConfiguration,PUBLISH_ALL_PORTS));
  }
  if (containerConfiguration.containsKey(NETWORK_MODE)) {
    createContainerCmd.withNetworkMode(asString(containerConfiguration,NETWORK_MODE));
  }
  if (containerConfiguration.containsKey(DNS_SEARCH)) {
    List<String> dnsSearch=asListOfString(containerConfiguration,DNS_SEARCH);
    createContainerCmd.withDnsSearch(dnsSearch.toArray(new String[dnsSearch.size()]));
  }
  if (containerConfiguration.containsKey(DEVICES)) {
    List<Map<String,Object>> devices=asListOfMap(containerConfiguration,DEVICES);
    createContainerCmd.withDevices(toDevices(devices));
  }
  if (containerConfiguration.containsKey(RESTART_POLICY)) {
    Map<String,Object> restart=asMap(containerConfiguration,RESTART_POLICY);
    createContainerCmd.withRestartPolicy(toRestatPolicy(restart));
  }
  if (containerConfiguration.containsKey(CAP_ADD)) {
    List<String> capAdds=asListOfString(containerConfiguration,CAP_ADD);
    createContainerCmd.withCapAdd(toCapability(capAdds));
  }
  if (containerConfiguration.containsKey(CAP_DROP)) {
    List<String> capDrop=asListOfString(containerConfiguration,CAP_DROP);
    createContainerCmd.withCapDrop(toCapability(capDrop));
  }
  boolean alwaysPull=false;
  if (containerConfiguration.containsKey(ALWAYS_PULL)) {
    alwaysPull=asBoolean(containerConfiguration,ALWAYS_PULL);
  }
  if (alwaysPull) {
    log.info(String.format("String_Node_Str",image));
    this.pullImage(image);
  }
  try {
    return createContainerCmd.exec().getId();
  }
 catch (  NotFoundException e) {
    if (!alwaysPull) {
      log.warning(String.format("String_Node_Str",image));
      this.pullImage(image);
      return createContainerCmd.exec().getId();
    }
 else {
      throw e;
    }
  }
}