Program: 59264
Project: 59264
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(READ_ONLY_ROOT_FS)) {
    createContainerCmd.withReadonlyRootfs(asBoolean(containerConfiguration,READ_ONLY_ROOT_FS));
  }
  if (containerConfiguration.containsKey(LABELS)) {
    Map<String,String> labels=asMapOfStrings(containerConfiguration,LABELS);
    createContainerCmd.withLabels(labels);
  }
  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)) {
    Collection<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(CPU_SET)) {
    createContainerCmd.withCpuset(asString(containerConfiguration,CPU_SET));
  }
  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)) {
    Collection<String> env=asListOfString(containerConfiguration,ENV);
    env=resolveDockerServerIpInList(env);
    createContainerCmd.withEnv(env.toArray(new String[env.size()]));
  }
  if (containerConfiguration.containsKey(CMD)) {
    Collection<String> cmd=asListOfString(containerConfiguration,CMD);
    createContainerCmd.withCmd(cmd.toArray(new String[cmd.size()]));
  }
  if (containerConfiguration.containsKey(DNS)) {
    Collection<String> dns=asListOfString(containerConfiguration,DNS);
    createContainerCmd.withDns(dns.toArray(new String[dns.size()]));
  }
  if (containerConfiguration.containsKey(VOLUMES)) {
    Collection<String> volumes=asListOfString(containerConfiguration,VOLUMES);
    createContainerCmd.withVolumes(toVolumes(volumes));
  }
  if (containerConfiguration.containsKey(VOLUMES_FROM)) {
    Collection<String> volumesFrom=asListOfString(containerConfiguration,VOLUMES_FROM);
    createContainerCmd.withVolumesFrom(toVolumesFrom(volumesFrom));
  }
  if (containerConfiguration.containsKey(BINDS)) {
    Collection<String> binds=asListOfString(containerConfiguration,BINDS);
    createContainerCmd.withBinds(toBinds(binds));
  }
  if (containerConfiguration.containsKey(LINKS)) {
    createContainerCmd.withLinks(toLinks(asListOfString(containerConfiguration,LINKS)));
  }
  if (containerConfiguration.containsKey(PORT_BINDINGS)) {
    Collection<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)) {
    Collection<String> dnsSearch=asListOfString(containerConfiguration,DNS_SEARCH);
    createContainerCmd.withDnsSearch(dnsSearch.toArray(new String[dnsSearch.size()]));
  }
  if (containerConfiguration.containsKey(DEVICES)) {
    Collection<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)) {
    Collection<String> capAdds=asListOfString(containerConfiguration,CAP_ADD);
    createContainerCmd.withCapAdd(toCapability(capAdds));
  }
  if (containerConfiguration.containsKey(CAP_DROP)) {
    Collection<String> capDrop=asListOfString(containerConfiguration,CAP_DROP);
    createContainerCmd.withCapDrop(toCapability(capDrop));
  }
  if (containerConfiguration.containsKey(EXTRA_HOSTS)) {
    Collection<String> extraHosts=asListOfString(containerConfiguration,EXTRA_HOSTS);
    createContainerCmd.withExtraHosts(extraHosts.toArray(new String[extraHosts.size()]));
  }
  if (containerConfiguration.containsKey(ENTRYPOINT)) {
    Collection<String> entrypoints=asListOfString(containerConfiguration,ENTRYPOINT);
    createContainerCmd.withEntrypoint(entrypoints.toArray(new String[entrypoints.size()]));
  }
  if (containerConfiguration.containsKey(DOMAINNAME)) {
    String domainName=asString(containerConfiguration,DOMAINNAME);
    createContainerCmd.withDomainName(domainName);
  }
  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(READ_ONLY_ROOT_FS)) {
    createContainerCmd.withReadonlyRootfs(asBoolean(containerConfiguration,READ_ONLY_ROOT_FS));
  }
  if (containerConfiguration.containsKey(LABELS)) {
    Map<String,String> labels=asMapOfStrings(containerConfiguration,LABELS);
    createContainerCmd.withLabels(labels);
  }
  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)) {
    Collection<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(CPU_SET)) {
    createContainerCmd.withCpuset(asString(containerConfiguration,CPU_SET));
  }
  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)) {
    Collection<String> env=asListOfString(containerConfiguration,ENV);
    env=resolveDockerServerIpInList(env);
    createContainerCmd.withEnv(env.toArray(new String[env.size()]));
  }
  if (containerConfiguration.containsKey(CMD)) {
    Collection<String> cmd=asListOfString(containerConfiguration,CMD);
    createContainerCmd.withCmd(cmd.toArray(new String[cmd.size()]));
  }
  if (containerConfiguration.containsKey(DNS)) {
    Collection<String> dns=asListOfString(containerConfiguration,DNS);
    createContainerCmd.withDns(dns.toArray(new String[dns.size()]));
  }
  if (containerConfiguration.containsKey(VOLUMES)) {
    Collection<String> volumes=asListOfString(containerConfiguration,VOLUMES);
    createContainerCmd.withVolumes(toVolumes(volumes));
  }
  if (containerConfiguration.containsKey(VOLUMES_FROM)) {
    Collection<String> volumesFrom=asListOfString(containerConfiguration,VOLUMES_FROM);
    createContainerCmd.withVolumesFrom(toVolumesFrom(volumesFrom));
  }
  if (containerConfiguration.containsKey(BINDS)) {
    Collection<String> binds=asListOfString(containerConfiguration,BINDS);
    createContainerCmd.withBinds(toBinds(binds));
  }
  if (containerConfiguration.containsKey(LINKS)) {
    createContainerCmd.withLinks(toLinks(asListOfString(containerConfiguration,LINKS)));
  }
  if (containerConfiguration.containsKey(PORT_BINDINGS)) {
    Collection<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)) {
    Collection<String> dnsSearch=asListOfString(containerConfiguration,DNS_SEARCH);
    createContainerCmd.withDnsSearch(dnsSearch.toArray(new String[dnsSearch.size()]));
  }
  if (containerConfiguration.containsKey(DEVICES)) {
    Collection<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)) {
    Collection<String> capAdds=asListOfString(containerConfiguration,CAP_ADD);
    createContainerCmd.withCapAdd(toCapability(capAdds));
  }
  if (containerConfiguration.containsKey(CAP_DROP)) {
    Collection<String> capDrop=asListOfString(containerConfiguration,CAP_DROP);
    createContainerCmd.withCapDrop(toCapability(capDrop));
  }
  if (containerConfiguration.containsKey(EXTRA_HOSTS)) {
    Collection<String> extraHosts=asListOfString(containerConfiguration,EXTRA_HOSTS);
    createContainerCmd.withExtraHosts(extraHosts.toArray(new String[extraHosts.size()]));
  }
  if (containerConfiguration.containsKey(ENTRYPOINT)) {
    Collection<String> entrypoints=asListOfString(containerConfiguration,ENTRYPOINT);
    createContainerCmd.withEntrypoint(entrypoints.toArray(new String[entrypoints.size()]));
  }
  if (containerConfiguration.containsKey(DOMAINNAME)) {
    String domainName=asString(containerConfiguration,DOMAINNAME);
    createContainerCmd.withDomainName(domainName);
  }
  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;
    }
  }
catch (  ProcessingException e) {
    if (e.getCause() instanceof UnsupportedSchemeException) {
      if (e.getCause().getMessage().contains("String_Node_Str")) {
        throw new IllegalStateException("String_Node_Str" + "String_Node_Str",e.getCause());
      }
 else {
        throw e;
      }
    }
 else {
      throw e;
    }
  }
}