nus-yam/ex-repair huggingface dataset:
Program: 59257
Project: 59257
Buggy source:
/** 
 * Checks if current code is being executed inside Docker or not.
 * @return True if code is being executed inside Docker, false otherwise.
 */
public boolean isSpinning(){
  return Files.exists(dockerEnvPath) && Files.exists(dockerInitPath) && Files.exists(dockerSocketFile);
}

Fixed version (ground truth):
/** 
 * Checks if current code is being executed inside Docker or not.
 * @return True if code is being executed inside Docker, false otherwise.
 */
public boolean isSpinning(){
  return dockerEnvPath.exists() && dockerInitPath.exists() && dockerSocketFile.exists();
}
Program: 59258
Project: 59258
Buggy source:
public String buildImage(String location,Map<String,Object> params){
  BuildImageCmd buildImageCmd=createBuildCommand(location);
  configureBuildCommand(params,buildImageCmd);
  String imageId=buildImageCmd.exec(new BuildImageResultCallback()).awaitImageId();
  if (imageId == null) {
    throw new IllegalStateException(String.format("String_Node_Str",location));
  }
  return imageId.trim();
}

Fixed version (ground truth):
public String buildImage(String location,Map<String,Object> params){
  BuildImageCmd buildImageCmd=createBuildCommand(location);
  configureBuildCommand(params,buildImageCmd);
  String imageId=buildImageCmd.exec(new BuildImageResultCallback()).awaitImageId();
  if (imageId == null) {
    throw new IllegalStateException(String.format("String_Node_Str",location));
  }
  try {
    this.dockerClient.close();
  }
 catch (  IOException ioe) {
    throw new RuntimeException(ioe);
  }
  this.dockerClient=buildDockerClient();
  return imageId.trim();
}
Program: 59259
Project: 59259
Buggy source:
public DockerClientExecutor(CubeDockerConfiguration cubeConfiguration){
  DockerClientConfigBuilder configBuilder=DockerClientConfig.createDefaultConfigBuilder();
  String dockerServerUri=cubeConfiguration.getDockerServerUri();
  dockerUri=URI.create(dockerServerUri);
  dockerServerIp=cubeConfiguration.getDockerServerIp();
  configBuilder.withApiVersion(cubeConfiguration.getDockerServerVersion()).withDockerHost(dockerUri.toString());
  if (cubeConfiguration.getUsername() != null) {
    configBuilder.withRegistryUsername(cubeConfiguration.getUsername());
  }
  if (cubeConfiguration.getPassword() != null) {
    configBuilder.withRegistryPassword(cubeConfiguration.getPassword());
  }
  if (cubeConfiguration.getEmail() != null) {
    configBuilder.withRegistryEmail(cubeConfiguration.getEmail());
  }
  if (cubeConfiguration.getCertPath() != null) {
    configBuilder.withDockerCertPath(HomeResolverUtil.resolveHomeDirectoryChar(cubeConfiguration.getCertPath()));
  }
  this.dockerClient=DockerClientBuilder.getInstance(configBuilder.build()).build();
  this.cubeConfiguration=cubeConfiguration;
}

Fixed version (ground truth):
public DockerClientExecutor(CubeDockerConfiguration cubeConfiguration){
  DockerClientConfigBuilder configBuilder=DockerClientConfig.createDefaultConfigBuilder();
  String dockerServerUri=cubeConfiguration.getDockerServerUri();
  dockerUri=URI.create(dockerServerUri);
  dockerServerIp=cubeConfiguration.getDockerServerIp();
  configBuilder.withApiVersion(cubeConfiguration.getDockerServerVersion()).withDockerHost(dockerUri.toString());
  if (cubeConfiguration.getUsername() != null) {
    configBuilder.withRegistryUsername(cubeConfiguration.getUsername());
  }
  if (cubeConfiguration.getPassword() != null) {
    configBuilder.withRegistryPassword(cubeConfiguration.getPassword());
  }
  if (cubeConfiguration.getEmail() != null) {
    configBuilder.withRegistryEmail(cubeConfiguration.getEmail());
  }
  if (cubeConfiguration.getCertPath() != null) {
    configBuilder.withDockerCertPath(HomeResolverUtil.resolveHomeDirectoryChar(cubeConfiguration.getCertPath()));
  }
  this.dockerClientConfig=configBuilder.build();
  this.cubeConfiguration=cubeConfiguration;
  this.dockerClient=buildDockerClient();
}
Program: 59260
Project: 59260
Buggy source:
public static Image valueOf(String image){
  String name=null;
  String tag=null;
  String[] parts=image.split("String_Node_Str");
  name=parts[0];
  if (parts.length > 1) {
    tag=parts[1];
  }
  return new Image(name,tag);
}

Fixed version (ground truth):
public static Image valueOf(String image){
  String name=null;
  String tag=null;
  String[] parts=image.split("String_Node_Str");
switch (parts.length) {
case 1:
case 2:
{
      String imageName=image;
      final int colonIndex=imageName.indexOf(':');
      if (colonIndex > -1) {
        name=imageName.substring(0,colonIndex);
        tag=imageName.substring(colonIndex + 1);
      }
 else {
        name=imageName;
      }
      break;
    }
case 3:
{
    String imageName=parts[2];
    final int colonIndex=imageName.indexOf(':');
    if (colonIndex > -1) {
      name=parts[0] + "String_Node_Str" + parts[1]+ "String_Node_Str"+ imageName.substring(0,colonIndex);
      tag=imageName.substring(colonIndex + 1);
    }
 else {
      name=image;
    }
  }
}
return new Image(name,tag);
}
Program: 59261
Project: 59261
Buggy source:
public void pullImage(String imageName){
  PullImageCmd pullImageCmd=this.dockerClient.pullImageCmd(imageName);
  if (this.cubeConfiguration.getDockerRegistry() != null) {
    pullImageCmd.withRegistry(this.cubeConfiguration.getDockerRegistry());
  }
  int tagSeparator=imageName.indexOf(TAG_SEPARATOR);
  if (tagSeparator > 0) {
    pullImageCmd.withRepository(imageName.substring(0,tagSeparator));
    pullImageCmd.withTag(imageName.substring(tagSeparator + 1));
  }
  pullImageCmd.exec(new PullImageResultCallback()).awaitSuccess();
}

Fixed version (ground truth):
public void pullImage(String imageName){
  final Image image=Image.valueOf(imageName);
  PullImageCmd pullImageCmd=this.dockerClient.pullImageCmd(image.getName());
  if (this.cubeConfiguration.getDockerRegistry() != null) {
    pullImageCmd.withRegistry(this.cubeConfiguration.getDockerRegistry());
  }
  String tag=image.getTag();
  if (tag != null && !"String_Node_Str".equals(tag)) {
    pullImageCmd.withTag(tag);
  }
  pullImageCmd.exec(new PullImageResultCallback()).awaitSuccess();
}
Program: 59262
Project: 59262
Buggy source:
private Machine parse(String output){
  String[] fields=output.split("String_Node_Str");
  return Machine.toMachine(fields);
}

Fixed version (ground truth):
private Machine parse(Map<String,Index> headersIndex,String output){
  String name=resolveField(headersIndex.get("String_Node_Str"),output);
  String active=resolveField(headersIndex.get("String_Node_Str"),output);
  String driver=resolveField(headersIndex.get("String_Node_Str"),output);
  String state=resolveField(headersIndex.get("String_Node_Str"),output);
  String url=resolveField(headersIndex.get("String_Node_Str"),output);
  String swarm=resolveField(headersIndex.get("String_Node_Str"),output);
  return new Machine(name,active,driver,state,url,swarm);
}
Program: 59263
Project: 59263
Buggy source:
private Machine(String name,String active,String driver,String state,String url,String swarm){
  super();
  this.name=name;
  this.active=active;
  this.driver=driver;
  this.state=state;
  this.url=url;
  this.swarm=swarm;
}

Fixed version (ground truth):
public Machine(String name,String active,String driver,String state,String url,String swarm){
  super();
  this.name=name;
  this.active=active;
  this.driver=driver;
  this.state=state;
  this.url=url;
  this.swarm=swarm;
}
Program: 59265
Project: 59265
Buggy source:
private Map<String,String> resolveDefaultDockerMachine(Map<String,String> config){
  if (!config.containsKey(CubeDockerConfiguration.DOCKER_URI) && !config.containsKey(CubeDockerConfiguration.DOCKER_MACHINE_NAME)) {
    log.fine("String_Node_Str");
    if (dockerMachineInstance.get().isDockerMachineInstalled()) {
      Set<Machine> machines=this.dockerMachineInstance.get().list("String_Node_Str","String_Node_Str");
      if (machines.size() == 1) {
        log.fine(String.format("String_Node_Str",machines.iterator().next().getName()));
        config.put(CubeDockerConfiguration.DOCKER_MACHINE_NAME,getFirstMachine(machines).getName());
      }
    }
  }
  return config;
}

Fixed version (ground truth):
private Map<String,String> resolveDefaultDockerMachine(Map<String,String> config){
  if (!config.containsKey(CubeDockerConfiguration.DOCKER_URI) && !config.containsKey(CubeDockerConfiguration.DOCKER_MACHINE_NAME)) {
    log.fine("String_Node_Str");
    if (dockerMachineInstance.get().isDockerMachineInstalled(config.get(CubeDockerConfiguration.DOCKER_MACHINE_PATH))) {
      Set<Machine> machines=this.dockerMachineInstance.get().list(config.get(CubeDockerConfiguration.DOCKER_MACHINE_PATH),"String_Node_Str","String_Node_Str");
      if (machines.size() == 1) {
        log.fine(String.format("String_Node_Str",machines.iterator().next().getName()));
        config.put(CubeDockerConfiguration.DOCKER_MACHINE_NAME,getFirstMachine(machines).getName());
      }
    }
  }
  return config;
}
Program: 59266
Project: 59266
Buggy source:
private void configure(ArquillianDescriptor arquillianDescriptor){
  operatingSystemFamilyInstanceProducer.set(new OperatingSystemResolver().currentOperatingSystem().getFamily());
  Map<String,String> config=arquillianDescriptor.extension(EXTENSION_NAME).getExtensionProperties();
  config=resolveSystemEnvironmentVariables(config);
  config=resolveDefaultDockerMachine(config);
  config=resolveServerUriByOperativeSystem(config);
  config=resolveServerUriTcpProtocol(config);
  config=resolveServerIp(config);
  CubeDockerConfiguration cubeConfiguration=CubeDockerConfiguration.fromMap(config);
  System.out.println(cubeConfiguration);
  hostUriContextInstanceProducer.set(new HostUriContext(cubeConfiguration.getDockerServerUri()));
  configurationProducer.set(cubeConfiguration);
}

Fixed version (ground truth):
private void configure(ArquillianDescriptor arquillianDescriptor){
  operatingSystemFamilyInstanceProducer.set(new OperatingSystemResolver().currentOperatingSystem().getFamily());
  Map<String,String> config=arquillianDescriptor.extension(EXTENSION_NAME).getExtensionProperties();
  config=resolveSystemEnvironmentVariables(config);
  config=resolveAutoStartDockerMachine(config);
  config=resolveDefaultDockerMachine(config);
  config=resolveServerUriByOperativeSystem(config);
  config=resolveServerUriTcpProtocol(config);
  config=resolveServerIp(config);
  CubeDockerConfiguration cubeConfiguration=CubeDockerConfiguration.fromMap(config);
  System.out.println(cubeConfiguration);
  hostUriContextInstanceProducer.set(new HostUriContext(cubeConfiguration.getDockerServerUri()));
  configurationProducer.set(cubeConfiguration);
}
Program: 59267
Project: 59267
Buggy source:
@Override public void register(ExtensionBuilder builder){
  builder.observer(CubeDockerConfigurator.class).observer(DockerClientCreator.class).observer(CubeDockerRegistrar.class).observer(CubeSuiteLifecycleController.class).observer(BeforeStopContainerObserver.class).observer(Boot2DockerCreator.class).observer(DockerMachineCreator.class).observer(AfterClassContainerObjectObserver.class);
  builder.service(ResourceProvider.class,CubeResourceProvider.class);
  builder.service(TestEnricher.class,CubeContainerObjectTestEnricher.class);
  if (Validate.classExists("String_Node_Str")) {
    builder.observer(DockerServerIPConfigurator.class);
    builder.observer(CubeDockerAutoStartConfigurator.class);
  }
}

Fixed version (ground truth):
@Override public void register(ExtensionBuilder builder){
  builder.observer(CubeDockerConfigurator.class).observer(DockerClientCreator.class).observer(CubeDockerRegistrar.class).observer(CubeSuiteLifecycleController.class).observer(BeforeStopContainerObserver.class).observer(Boot2DockerCreator.class).observer(DockerMachineCreator.class).observer(AfterClassContainerObjectObserver.class).observer(StopDockerMachineAfterSuiteObserver.class);
  builder.service(ResourceProvider.class,CubeResourceProvider.class);
  builder.service(TestEnricher.class,CubeContainerObjectTestEnricher.class);
  if (Validate.classExists("String_Node_Str")) {
    builder.observer(DockerServerIPConfigurator.class);
    builder.observer(CubeDockerAutoStartConfigurator.class);
  }
}
Program: 59268
Project: 59268
Buggy source:
public String execCommand(String... arguments){
  try {
    ProcessBuilder processBuilder=new ProcessBuilder(arguments);
    processBuilder.redirectErrorStream(true);
    Process pwd=processBuilder.start();
    pwd.waitFor();
    String output=IOUtil.asString(pwd.getInputStream());
    return output;
  }
 catch (  InterruptedException|IOException e) {
    throw new IllegalArgumentException(e);
  }
}

Fixed version (ground truth):
public String execCommand(String... arguments){
  try {
    ProcessBuilder processBuilder=new ProcessBuilder(arguments);
    processBuilder.redirectErrorStream(true);
    Process pwd=processBuilder.start();
    pwd.waitFor();
    String output=IOUtil.asString(pwd.getInputStream());
    if (pwd.exitValue() > 0) {
      throw new IllegalArgumentException(String.format("String_Node_Str",Arrays.toString(arguments),pwd.exitValue(),output));
    }
    return output;
  }
 catch (  InterruptedException|IOException e) {
    throw new IllegalArgumentException(e);
  }
}
Program: 59269
Project: 59269
Buggy source:
public boolean isDockerMachineInstalled(){
  return isDockerMachineInstalled(null);
}

Fixed version (ground truth):
/** 
 * Checks if Docker Machine is installed by running docker-machine and inspect the result.
 * @return true if it is installed, false otherwise.
 */
public boolean isDockerMachineInstalled(){
  return isDockerMachineInstalled(null);
}
Program: 59270
Project: 59270
Buggy source:
@Test public void shouldUseDockerMachineIfDockerHostIsSetOnServerURIAndMachineNameIsSet(){
  Map<String,String> config=new HashMap<>();
  config.put(CubeDockerConfiguration.DOCKER_URI,"String_Node_Str");
  config.put(CubeDockerConfiguration.DOCKER_MACHINE_NAME,"String_Node_Str");
  when(extensionDef.getExtensionProperties()).thenReturn(config);
  when(arquillianDescriptor.extension("String_Node_Str")).thenReturn(extensionDef);
  when(commandLineExecutor.execCommand("String_Node_Str","String_Node_Str","String_Node_Str")).thenReturn("String_Node_Str");
  fire(new CubeConfiguration());
  assertThat(config,hasEntry(CubeDockerConfiguration.DOCKER_URI,"String_Node_Str"));
  assertThat(config,hasEntry(is(CubeDockerConfiguration.CERT_PATH),endsWith(File.separator + "String_Node_Str" + File.separator+ "String_Node_Str"+ File.separator+ "String_Node_Str"+ File.separator+ config.get(CubeDockerConfiguration.DOCKER_MACHINE_NAME))));
}

Fixed version (ground truth):
@Test public void shouldUseDockerMachineIfDockerHostIsSetOnServerURIAndMachineNameIsSet(){
  Map<String,String> config=new HashMap<>();
  config.put(CubeDockerConfiguration.DOCKER_URI,"String_Node_Str");
  config.put(CubeDockerConfiguration.DOCKER_MACHINE_NAME,"String_Node_Str");
  when(extensionDef.getExtensionProperties()).thenReturn(config);
  when(arquillianDescriptor.extension("String_Node_Str")).thenReturn(extensionDef);
  when(commandLineExecutor.execCommandAsArray("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str")).thenReturn(new String[]{"String_Node_Str","String_Node_Str"});
  when(commandLineExecutor.execCommand("String_Node_Str","String_Node_Str","String_Node_Str")).thenReturn("String_Node_Str");
  fire(new CubeConfiguration());
  assertThat(config,hasEntry(CubeDockerConfiguration.DOCKER_URI,"String_Node_Str"));
  assertThat(config,hasEntry(is(CubeDockerConfiguration.CERT_PATH),endsWith(File.separator + "String_Node_Str" + File.separator+ "String_Node_Str"+ File.separator+ "String_Node_Str"+ File.separator+ config.get(CubeDockerConfiguration.DOCKER_MACHINE_NAME))));
}
Program: 59271
Project: 59271
Buggy source:
@Test public void dockerUriTcpShouldBeReplacedToHttpsInCaseOfDockerMachine(){
  Map<String,String> config=new HashMap<>();
  config.put(CubeDockerConfiguration.DOCKER_URI,"String_Node_Str");
  config.put(CubeDockerConfiguration.DOCKER_MACHINE_NAME,"String_Node_Str");
  when(extensionDef.getExtensionProperties()).thenReturn(config);
  when(arquillianDescriptor.extension("String_Node_Str")).thenReturn(extensionDef);
  when(commandLineExecutor.execCommand("String_Node_Str","String_Node_Str","String_Node_Str")).thenReturn("String_Node_Str");
  fire(new CubeConfiguration());
  assertThat(config,hasEntry(CubeDockerConfiguration.DOCKER_URI,"String_Node_Str"));
}

Fixed version (ground truth):
@Test public void dockerUriTcpShouldBeReplacedToHttpsInCaseOfDockerMachine(){
  Map<String,String> config=new HashMap<>();
  config.put(CubeDockerConfiguration.DOCKER_URI,"String_Node_Str");
  config.put(CubeDockerConfiguration.DOCKER_MACHINE_NAME,"String_Node_Str");
  when(extensionDef.getExtensionProperties()).thenReturn(config);
  when(arquillianDescriptor.extension("String_Node_Str")).thenReturn(extensionDef);
  when(commandLineExecutor.execCommand("String_Node_Str","String_Node_Str","String_Node_Str")).thenReturn("String_Node_Str");
  when(commandLineExecutor.execCommandAsArray("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str")).thenReturn(new String[]{"String_Node_Str","String_Node_Str"});
  fire(new CubeConfiguration());
  assertThat(config,hasEntry(CubeDockerConfiguration.DOCKER_URI,"String_Node_Str"));
}
Program: 59272
Project: 59272
Buggy source:
@Override public void changeToPreRunning(){
  if (state != State.DESTROYED) {
    return;
  }
  log.fine(String.format("String_Node_Str",id,configuration));
  state=State.PRE_RUNNING;
}

Fixed version (ground truth):
@Override public void changeToPreRunning(){
  if (state != State.DESTROYED && state != State.STARTED) {
    return;
  }
  log.fine(String.format("String_Node_Str",id,configuration));
  state=State.PRE_RUNNING;
}
Program: 59274
Project: 59274
Buggy source:
@Test public void should_merge_more_than_one_file_into_one() throws IOException {
  File newFile=testFolder.newFile("String_Node_Str");
  Files.write(Paths.get(newFile.toURI()),CONTENT.getBytes());
  File newFile2=testFolder.newFile("String_Node_Str");
  Files.write(Paths.get(newFile2.toURI()),CONTENT2.getBytes());
  Map<String,String> parameters=new HashMap<String,String>();
  parameters.put("String_Node_Str","String_Node_Str");
  parameters.put("String_Node_Str","String_Node_Str");
  parameters.put("String_Node_Str",newFile.getAbsolutePath() + "String_Node_Str" + newFile2.getAbsolutePath());
  parameters.put("String_Node_Str",DefinitionFormat.COMPOSE.name());
  CubeDockerConfiguration cubeConfiguration=CubeDockerConfiguration.fromMap(parameters);
  final Map<String,Object> dockerContainersContent=cubeConfiguration.getDockerContainersContent();
  assertThat(dockerContainersContent.containsKey("String_Node_Str"),is(true));
  assertThat(dockerContainersContent.containsKey("String_Node_Str"),is(true));
}

Fixed version (ground truth):
@Test public void should_merge_more_than_one_file_into_one() throws IOException {
  File newFile=testFolder.newFile("String_Node_Str");
  Files.write(Paths.get(newFile.toURI()),CONTENT.getBytes());
  File newFile2=testFolder.newFile("String_Node_Str");
  Files.write(Paths.get(newFile2.toURI()),CONTENT2.getBytes());
  Map<String,String> parameters=new HashMap<String,String>();
  parameters.put("String_Node_Str","String_Node_Str");
  parameters.put("String_Node_Str","String_Node_Str");
  parameters.put("String_Node_Str",newFile.toURI().toString() + "String_Node_Str" + newFile2.toURI().toString());
  parameters.put("String_Node_Str",DefinitionFormat.COMPOSE.name());
  CubeDockerConfiguration cubeConfiguration=CubeDockerConfiguration.fromMap(parameters);
  final Map<String,Object> dockerContainersContent=cubeConfiguration.getDockerContainersContent();
  assertThat(dockerContainersContent.containsKey("String_Node_Str"),is(true));
  assertThat(dockerContainersContent.containsKey("String_Node_Str"),is(true));
}
Program: 59275
Project: 59275
Buggy source:
@Test public void should_parse_and_load_configuration_file_from_container_configuration_file_and_property_set_file() throws IOException {
  File newFile=testFolder.newFile("String_Node_Str");
  Files.write(Paths.get(newFile.toURI()),CONTENT.getBytes());
  File newFile2=testFolder.newFile("String_Node_Str");
  Files.write(Paths.get(newFile2.toURI()),CONTENT2.getBytes());
  System.setProperty("String_Node_Str","String_Node_Str");
  Map<String,String> parameters=new HashMap<String,String>();
  parameters.put("String_Node_Str","String_Node_Str");
  parameters.put("String_Node_Str","String_Node_Str");
  parameters.put("String_Node_Str",newFile.getAbsolutePath());
  CubeDockerConfiguration cubeConfiguration=CubeDockerConfiguration.fromMap(parameters);
  assertThat(cubeConfiguration.getDockerServerUri(),is("String_Node_Str"));
  assertThat(cubeConfiguration.getDockerServerVersion(),is("String_Node_Str"));
  Map<String,Object> dockerContainersContent=cubeConfiguration.getDockerContainersContent();
  @SuppressWarnings("String_Node_Str") Map<String,Object> actualTomcat=(Map<String,Object>)dockerContainersContent.get("String_Node_Str");
  assertThat(actualTomcat,is(notNullValue()));
  String image=(String)actualTomcat.get("String_Node_Str");
  assertThat(image,is("String_Node_Str"));
  assertThat(dockerContainersContent.containsKey("String_Node_Str"),is(true));
}

Fixed version (ground truth):
@Test public void should_parse_and_load_configuration_file_from_container_configuration_file_and_property_set_file() throws IOException {
  File newFile=testFolder.newFile("String_Node_Str");
  Files.write(Paths.get(newFile.toURI()),CONTENT.getBytes());
  File newFile2=testFolder.newFile("String_Node_Str");
  Files.write(Paths.get(newFile2.toURI()),CONTENT2.getBytes());
  System.setProperty("String_Node_Str","String_Node_Str");
  Map<String,String> parameters=new HashMap<String,String>();
  parameters.put("String_Node_Str","String_Node_Str");
  parameters.put("String_Node_Str","String_Node_Str");
  parameters.put("String_Node_Str",newFile.toURI().toString());
  CubeDockerConfiguration cubeConfiguration=CubeDockerConfiguration.fromMap(parameters);
  assertThat(cubeConfiguration.getDockerServerUri(),is("String_Node_Str"));
  assertThat(cubeConfiguration.getDockerServerVersion(),is("String_Node_Str"));
  Map<String,Object> dockerContainersContent=cubeConfiguration.getDockerContainersContent();
  @SuppressWarnings("String_Node_Str") Map<String,Object> actualTomcat=(Map<String,Object>)dockerContainersContent.get("String_Node_Str");
  assertThat(actualTomcat,is(notNullValue()));
  String image=(String)actualTomcat.get("String_Node_Str");
  assertThat(image,is("String_Node_Str"));
  assertThat(dockerContainersContent.containsKey("String_Node_Str"),is(true));
}
Program: 59276
Project: 59276
Buggy source:
@Test public void should_parse_and_load_configuration_file_from_container_configuration_file() throws IOException {
  File newFile=testFolder.newFile("String_Node_Str");
  Files.write(Paths.get(newFile.toURI()),CONTENT.getBytes());
  Map<String,String> parameters=new HashMap<String,String>();
  parameters.put("String_Node_Str","String_Node_Str");
  parameters.put("String_Node_Str","String_Node_Str");
  parameters.put("String_Node_Str",newFile.getAbsolutePath());
  CubeDockerConfiguration cubeConfiguration=CubeDockerConfiguration.fromMap(parameters);
  assertThat(cubeConfiguration.getDockerServerUri(),is("String_Node_Str"));
  assertThat(cubeConfiguration.getDockerServerVersion(),is("String_Node_Str"));
  Map<String,Object> dockerContainersContent=cubeConfiguration.getDockerContainersContent();
  @SuppressWarnings("String_Node_Str") Map<String,Object> actualTomcat=(Map<String,Object>)dockerContainersContent.get("String_Node_Str");
  assertThat(actualTomcat,is(notNullValue()));
  String image=(String)actualTomcat.get("String_Node_Str");
  assertThat(image,is("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void should_parse_and_load_configuration_file_from_container_configuration_file() throws IOException {
  File newFile=testFolder.newFile("String_Node_Str");
  Files.write(Paths.get(newFile.toURI()),CONTENT.getBytes());
  Map<String,String> parameters=new HashMap<String,String>();
  parameters.put("String_Node_Str","String_Node_Str");
  parameters.put("String_Node_Str","String_Node_Str");
  parameters.put("String_Node_Str",newFile.toURI().toString());
  CubeDockerConfiguration cubeConfiguration=CubeDockerConfiguration.fromMap(parameters);
  assertThat(cubeConfiguration.getDockerServerUri(),is("String_Node_Str"));
  assertThat(cubeConfiguration.getDockerServerVersion(),is("String_Node_Str"));
  Map<String,Object> dockerContainersContent=cubeConfiguration.getDockerContainersContent();
  @SuppressWarnings("String_Node_Str") Map<String,Object> actualTomcat=(Map<String,Object>)dockerContainersContent.get("String_Node_Str");
  assertThat(actualTomcat,is(notNullValue()));
  String image=(String)actualTomcat.get("String_Node_Str");
  assertThat(image,is("String_Node_Str"));
}
Program: 59277
Project: 59277
Buggy source:
@Override public Map<String,AutoStartOrderUtil.Node> parse(){
  Map<String,AutoStartOrderUtil.Node> nodes=new HashMap<>();
  for (  String deployableContainer : this.deployableContainers) {
    Map<String,Object> content=(Map<String,Object>)containerDefinition.get(deployableContainer);
    if (content == null) {
      return nodes;
    }
    if (content.containsKey("String_Node_Str")) {
      Set<String> links=(Set<String>)content.get("String_Node_Str");
      for (      String link : links) {
        String[] parsed=link.split("String_Node_Str");
        String name=parsed[0];
        if (containerDefinition.containsKey(name)) {
          AutoStartOrderUtil.Node child=AutoStartOrderUtil.Node.from(name);
          nodes.put(name,child);
        }
      }
    }
  }
  return nodes;
}

Fixed version (ground truth):
@Override public Map<String,AutoStartOrderUtil.Node> parse(){
  Map<String,AutoStartOrderUtil.Node> nodes=new HashMap<>();
  for (  String deployableContainer : this.deployableContainers) {
    Map<String,Object> content=(Map<String,Object>)containerDefinition.get(deployableContainer);
    if (content == null) {
      return nodes;
    }
    if (content.containsKey("String_Node_Str")) {
      Collection<String> links=(Collection<String>)content.get("String_Node_Str");
      for (      String link : links) {
        String[] parsed=link.split("String_Node_Str");
        String name=parsed[0];
        if (containerDefinition.containsKey(name)) {
          AutoStartOrderUtil.Node child=AutoStartOrderUtil.Node.from(name);
          nodes.put(name,child);
        }
      }
    }
  }
  return nodes;
}
Program: 59278
Project: 59278
Buggy source:
@SuppressWarnings("String_Node_Str") private static void addAll(Map<String,Node> nodes,CubeDockerConfiguration config,String id){
  Map<String,Object> content=(Map<String,Object>)config.getDockerContainersContent().get(id);
  if (content == null) {
    return;
  }
  Node parent=nodes.get(id);
  if (content.containsKey("String_Node_Str")) {
    List<String> links=(List<String>)content.get("String_Node_Str");
    for (    String link : links) {
      String[] parsed=link.split("String_Node_Str");
      String name=parsed[0];
      if (config.getDockerContainersContent().containsKey(name)) {
        Node child=nodes.get(name);
        if (child == null) {
          child=Node.from(name);
          nodes.put(name,child);
        }
        if (child.addAsChildOf(parent)) {
          addAll(nodes,config,name);
        }
      }
    }
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private static void addAll(Map<String,Node> nodes,CubeDockerConfiguration config,String id){
  Map<String,Object> content=(Map<String,Object>)config.getDockerContainersContent().get(id);
  if (content == null) {
    return;
  }
  Node parent=nodes.get(id);
  if (content.containsKey("String_Node_Str")) {
    Collection<String> links=(Collection<String>)content.get("String_Node_Str");
    for (    String link : links) {
      String[] parsed=link.split("String_Node_Str");
      String name=parsed[0];
      if (config.getDockerContainersContent().containsKey(name)) {
        Node child=nodes.get(name);
        if (child == null) {
          child=Node.from(name);
          nodes.put(name,child);
        }
        if (child.addAsChildOf(parent)) {
          addAll(nodes,config,name);
        }
      }
    }
  }
}
Program: 59279
Project: 59279
Buggy source:
public void configure(@Observes ArquillianDescriptor arquillianDescriptor){
  Map<String,String> config=arquillianDescriptor.extension(EXTENSION_NAME).getExtensionProperties();
  CubeConfiguration cubeConfiguration=CubeConfiguration.fromMap(config);
  configurationProducer.set(cubeConfiguration);
}

Fixed version (ground truth):
public void configure(@Observes(precedence=-10) ArquillianDescriptor arquillianDescriptor){
  Map<String,String> config=arquillianDescriptor.extension(EXTENSION_NAME).getExtensionProperties();
  CubeConfiguration cubeConfiguration=CubeConfiguration.fromMap(config);
  configurationProducer.set(cubeConfiguration);
}
Program: 59280
Project: 59280
Buggy source:
@Override public Map<String,AutoStartOrderUtil.Node> parse(){
  Map<String,AutoStartOrderUtil.Node> nodes=new HashMap<>();
  for (  String deployableContainer : this.deployableContainers) {
    Map<String,Object> content=(Map<String,Object>)containerDefinition.get(deployableContainer);
    if (content == null) {
      return nodes;
    }
    if (content.containsKey("String_Node_Str")) {
      List<String> links=(List<String>)content.get("String_Node_Str");
      for (      String link : links) {
        String[] parsed=link.split("String_Node_Str");
        String name=parsed[0];
        if (containerDefinition.containsKey(name)) {
          AutoStartOrderUtil.Node child=AutoStartOrderUtil.Node.from(name);
          nodes.put(name,child);
        }
      }
    }
  }
  return nodes;
}

Fixed version (ground truth):
@Override public Map<String,AutoStartOrderUtil.Node> parse(){
  Map<String,AutoStartOrderUtil.Node> nodes=new HashMap<>();
  for (  String deployableContainer : this.deployableContainers) {
    Map<String,Object> content=(Map<String,Object>)containerDefinition.get(deployableContainer);
    if (content == null) {
      return nodes;
    }
    if (content.containsKey("String_Node_Str")) {
      Set<String> links=(Set<String>)content.get("String_Node_Str");
      for (      String link : links) {
        String[] parsed=link.split("String_Node_Str");
        String name=parsed[0];
        if (containerDefinition.containsKey(name)) {
          AutoStartOrderUtil.Node child=AutoStartOrderUtil.Node.from(name);
          nodes.put(name,child);
        }
      }
    }
  }
  return nodes;
}
Program: 59282
Project: 59282
Buggy source:
private DockerComposeConverter(String content){
  this.dockerComposeDefinitionMap=(Map<String,Object>)new Yaml().load(content);
  this.dockerComposeRootDirectory=Paths.get("String_Node_Str");
}

Fixed version (ground truth):
private DockerComposeConverter(String content){
  String resolvePlaceholders=resolvePlaceholders(content);
  this.dockerComposeDefinitionMap=(Map<String,Object>)new Yaml().load(content);
  this.dockerComposeRootDirectory=Paths.get("String_Node_Str");
}
Program: 59284
Project: 59284
Buggy source:
public int getConnectionPort(){
  return 5000;
}

Fixed version (ground truth):
public int getConnectionPort(){
  return port;
}
Program: 59285
Project: 59285
Buggy source:
@Test public void shouldReturnOkAsPong() throws IOException {
  String pong=ping();
  assertThat(pong,containsString("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void shouldReturnOkAsPong() throws IOException {
  String pong=ping();
  assertThat(pong,containsString("String_Node_Str"));
  assertThat(pingPongContainer.getConnectionPort(),is(5000));
}
Program: 59286
Project: 59286
Buggy source:
public void configure(@Observes CubeConfiguration event,ArquillianDescriptor arquillianDescriptor){
  operatingSystemFamilyInstanceProducer.set(new OperatingSystemResolver().currentOperatingSystem().getFamily());
  Map<String,String> config=arquillianDescriptor.extension(EXTENSION_NAME).getExtensionProperties();
  config=resolveSystemEnvironmentVariables(config);
  config=resolveServerUriByOperativeSystem(config);
  config=resolveServerIp(config);
  CubeDockerConfiguration cubeConfiguration=CubeDockerConfiguration.fromMap(config);
  configurationProducer.set(cubeConfiguration);
}

Fixed version (ground truth):
public void configure(@Observes CubeConfiguration event,ArquillianDescriptor arquillianDescriptor){
  operatingSystemFamilyInstanceProducer.set(new OperatingSystemResolver().currentOperatingSystem().getFamily());
  Map<String,String> config=arquillianDescriptor.extension(EXTENSION_NAME).getExtensionProperties();
  config=resolveSystemEnvironmentVariables(config);
  config=resolveServerUriByOperativeSystem(config);
  config=resolveServerUriTcpProtocol(config);
  config=resolveServerIp(config);
  CubeDockerConfiguration cubeConfiguration=CubeDockerConfiguration.fromMap(config);
  configurationProducer.set(cubeConfiguration);
}
Program: 59287
Project: 59287
Buggy source:
private Map<String,String> resolveServerIp(Map<String,String> config){
  String dockerServerUri=config.get(CubeDockerConfiguration.DOCKER_URI);
  if (dockerServerUri.contains(AbstractCliInternetAddressResolver.DOCKERHOST_TAG)) {
    if (isDockerMachineSet(config)) {
      dockerServerUri=resolveDockerMachine(dockerServerUri,config.get(CubeDockerConfiguration.DOCKER_MACHINE_NAME),config.get(CubeDockerConfiguration.DOCKER_MACHINE_PATH));
    }
 else {
      dockerServerUri=resolveBoot2Docker(dockerServerUri,config.get(CubeDockerConfiguration.BOOT2DOCKER_PATH));
    }
  }
  config.put(CubeDockerConfiguration.DOCKER_URI,dockerServerUri);
  if (!config.containsKey(CubeDockerConfiguration.CERT_PATH)) {
    config.put(CubeDockerConfiguration.CERT_PATH,HomeResolverUtil.resolveHomeDirectoryChar(getDefaultTlsDirectory(config)));
  }
  resolveDockerServerIp(config,dockerServerUri);
  return config;
}

Fixed version (ground truth):
private Map<String,String> resolveServerIp(Map<String,String> config){
  String dockerServerUri=config.get(CubeDockerConfiguration.DOCKER_URI);
  if (containsDockerHostTag(dockerServerUri)) {
    if (isDockerMachineSet(config)) {
      dockerServerUri=resolveDockerMachine(dockerServerUri,config.get(CubeDockerConfiguration.DOCKER_MACHINE_NAME),config.get(CubeDockerConfiguration.DOCKER_MACHINE_PATH));
    }
 else {
      dockerServerUri=resolveBoot2Docker(dockerServerUri,config.get(CubeDockerConfiguration.BOOT2DOCKER_PATH));
    }
  }
  config.put(CubeDockerConfiguration.DOCKER_URI,dockerServerUri);
  if (!config.containsKey(CubeDockerConfiguration.CERT_PATH)) {
    config.put(CubeDockerConfiguration.CERT_PATH,HomeResolverUtil.resolveHomeDirectoryChar(getDefaultTlsDirectory(config)));
  }
  resolveDockerServerIp(config,dockerServerUri);
  return config;
}
Program: 59288
Project: 59288
Buggy source:
@Override public void register(ExtensionBuilder builder){
  builder.observer(CubeConfigurator.class).observer(CubeRegistrar.class).observer(CubeLifecycleController.class).observer(ClientCubeControllerCreator.class);
  builder.service(ResourceProvider.class,CubeControllerProvider.class);
  if (Validate.classExists("String_Node_Str")) {
    builder.observer(ProtocolMetadataUpdater.class).observer(CubeContainerLifecycleController.class).observer(ContainerConfigurationController.class).observer(CubeRemoteCommandObserver.class);
    builder.service(AuxiliaryArchiveAppender.class,CubeAuxiliaryArchiveAppender.class);
  }
  if (Validate.classExists("String_Node_Str")) {
    builder.service(ResourceProvider.class,CubeIDResourceProvider.class);
  }
}

Fixed version (ground truth):
@Override public void register(ExtensionBuilder builder){
  builder.observer(CubeConfigurator.class).observer(CubeRegistrar.class).observer(CubeLifecycleController.class).observer(ClientCubeControllerCreator.class);
  builder.service(ResourceProvider.class,CubeControllerProvider.class).service(TestEnricher.class,HostIpTestEnricher.class);
  if (Validate.classExists("String_Node_Str")) {
    builder.observer(ProtocolMetadataUpdater.class).observer(CubeContainerLifecycleController.class).observer(ContainerConfigurationController.class).observer(CubeRemoteCommandObserver.class);
    builder.service(AuxiliaryArchiveAppender.class,CubeAuxiliaryArchiveAppender.class);
  }
  if (Validate.classExists("String_Node_Str")) {
    builder.service(ResourceProvider.class,CubeIDResourceProvider.class);
  }
}
Program: 59289
Project: 59289
Buggy source:
public void configure(@Observes CubeConfiguration event,ArquillianDescriptor arquillianDescriptor){
  operatingSystemFamilyInstanceProducer.set(new OperatingSystemResolver().currentOperatingSystem().getFamily());
  Map<String,String> config=arquillianDescriptor.extension(EXTENSION_NAME).getExtensionProperties();
  config=resolveSystemEnvironmentVariables(config);
  config=resolveServerUriByOperativeSystem(config);
  config=resolveServerUriTcpProtocol(config);
  config=resolveServerIp(config);
  CubeDockerConfiguration cubeConfiguration=CubeDockerConfiguration.fromMap(config);
  configurationProducer.set(cubeConfiguration);
}

Fixed version (ground truth):
public void configure(@Observes CubeConfiguration event,ArquillianDescriptor arquillianDescriptor){
  operatingSystemFamilyInstanceProducer.set(new OperatingSystemResolver().currentOperatingSystem().getFamily());
  Map<String,String> config=arquillianDescriptor.extension(EXTENSION_NAME).getExtensionProperties();
  config=resolveSystemEnvironmentVariables(config);
  config=resolveServerUriByOperativeSystem(config);
  config=resolveServerUriTcpProtocol(config);
  config=resolveServerIp(config);
  CubeDockerConfiguration cubeConfiguration=CubeDockerConfiguration.fromMap(config);
  hostUriContextInstanceProducer.set(new HostUriContext(cubeConfiguration.getDockerServerUri()));
  configurationProducer.set(cubeConfiguration);
}
Program: 59290
Project: 59290
Buggy source:
private ProtocolMetaData createProtocolMetadata(Cube cube,Archive<?> deployment){
  Binding bindings=cube.bindings();
  HTTPContext httpContext=new HTTPContext(bindings.getIP(),configuration.getEmbeddedPort());
  if (containsArquillianServletProtocol(deployment)) {
    addArquillianTestServlet(deployment,httpContext);
  }
  return new ProtocolMetaData().addContext(httpContext);
}

Fixed version (ground truth):
private ProtocolMetaData createProtocolMetadata(Cube cube,Archive<?> deployment){
  Binding bindings=cube.bindings();
  HTTPContext httpContext=null;
  if (this.configuration.isEmbeddedPortSet()) {
    httpContext=new HTTPContext(bindings.getIP(),this.configuration.getEmbeddedPort());
  }
 else {
    if (bindings.getNumberOfPortBindings() == 1) {
      httpContext=new HTTPContext(bindings.getIP(),bindings.getFirstPortBinding().getBindingPort());
    }
 else {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
  if (containsArquillianServletProtocol(deployment)) {
    addArquillianTestServlet(deployment,httpContext);
  }
  return new ProtocolMetaData().addContext(httpContext);
}
Program: 59291
Project: 59291
Buggy source:
private void configure(ArquillianDescriptor arquillianDescriptor,ContainerRegistry containerRegistry){
  operatingSystemFamilyInstanceProducer.set(new OperatingSystemResolver().currentOperatingSystem().getFamily());
  Map<String,String> config=arquillianDescriptor.extension(EXTENSION_NAME).getExtensionProperties();
  config=resolveSystemEnvironmentVariables(config);
  config=resolveServerUriByOperativeSystem(config);
  config=resolveServerUriTcpProtocol(config);
  config=resolveServerIp(config);
  CubeDockerConfiguration cubeConfiguration=CubeDockerConfiguration.fromMap(config);
  hostUriContextInstanceProducer.set(new HostUriContext(cubeConfiguration.getDockerServerUri()));
  configurationProducer.set(cubeConfiguration);
}

Fixed version (ground truth):
private void configure(ArquillianDescriptor arquillianDescriptor,ContainerRegistry containerRegistry){
  operatingSystemFamilyInstanceProducer.set(new OperatingSystemResolver().currentOperatingSystem().getFamily());
  Map<String,String> config=arquillianDescriptor.extension(EXTENSION_NAME).getExtensionProperties();
  config=resolveSystemEnvironmentVariables(config);
  config=resolveServerUriByOperativeSystem(config);
  config=resolveServerUriTcpProtocol(config);
  config=resolveServerIp(config);
  CubeDockerConfiguration cubeConfiguration=CubeDockerConfiguration.fromMap(config);
  System.out.println(cubeConfiguration);
  hostUriContextInstanceProducer.set(new HostUriContext(cubeConfiguration.getDockerServerUri()));
  configurationProducer.set(cubeConfiguration);
}
Program: 59292
Project: 59292
Buggy source:
@Override public String toString(){
  String SEP=System.getProperty("String_Node_Str");
  return "String_Node_Str" + SEP + "String_Node_Str"+ dockerServerVersion+ '\''+ SEP+ "String_Node_Str"+ dockerServerUri+ '\''+ SEP+ "String_Node_Str"+ dockerRegistry+ '\''+ SEP+ "String_Node_Str"+ boot2DockerPath+ '\''+ SEP+ "String_Node_Str"+ dockerMachinePath+ '\''+ SEP+ "String_Node_Str"+ machineName+ '\''+ SEP+ "String_Node_Str"+ username+ '\''+ SEP+ "String_Node_Str"+ password+ '\''+ SEP+ "String_Node_Str"+ email+ '\''+ SEP+ "String_Node_Str"+ certPath+ '\''+ SEP+ "String_Node_Str"+ dockerServerIp+ '\''+ SEP+ "String_Node_Str"+ definitionFormat+ SEP+ "String_Node_Str"+ autoStartContainers+ SEP+ "String_Node_Str"+ dockerContainersContent+ SEP+ '}';
}

Fixed version (ground truth):
@Override public String toString(){
  String SEP=System.getProperty("String_Node_Str");
  StringBuilder content=new StringBuilder();
  content.append("String_Node_Str").append(SEP);
  if (dockerServerVersion != null) {
    content.append("String_Node_Str").append(dockerServerVersion).append(SEP);
  }
  if (dockerServerUri != null) {
    content.append("String_Node_Str").append(dockerServerUri).append(SEP);
  }
  if (dockerRegistry != null) {
    content.append("String_Node_Str").append(dockerRegistry).append(SEP);
  }
  if (boot2DockerPath != null) {
    content.append("String_Node_Str").append(boot2DockerPath).append(SEP);
  }
  if (dockerMachinePath != null) {
    content.append("String_Node_Str").append(dockerMachinePath).append(SEP);
  }
  if (machineName != null) {
    content.append("String_Node_Str").append(machineName).append(SEP);
  }
  if (username != null) {
    content.append("String_Node_Str").append(username).append(SEP);
  }
  if (password != null) {
    content.append("String_Node_Str").append(password).append(SEP);
  }
  if (email != null) {
    content.append("String_Node_Str").append(email).append(SEP);
  }
  if (certPath != null) {
    content.append("String_Node_Str").append(certPath).append(SEP);
  }
  if (dockerServerIp != null) {
    content.append("String_Node_Str").append(dockerServerIp).append(SEP);
  }
  if (definitionFormat != null) {
    content.append("String_Node_Str").append(definitionFormat).append(SEP);
  }
  if (autoStartContainers != null) {
    content.append("String_Node_Str").append(autoStartContainers).append(SEP);
  }
  if (dockerContainersContent != null) {
    content.append("String_Node_Str").append(dockerContainersContent).append(SEP);
  }
  return content.toString();
}
Program: 59293
Project: 59293
Buggy source:
public static String asStringPreservingNewLines(InputStream response){
  StringWriter logwriter=new StringWriter();
  try (BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(response))){
    String line=null;
    while ((line=bufferedReader.readLine()) != null) {
      logwriter.write(line);
      logwriter.write(System.lineSeparator());
    }
    return logwriter.toString();
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public static String asStringPreservingNewLines(InputStream response){
  StringWriter logwriter=new StringWriter();
  try (BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(response))){
    String line=null;
    while ((line=bufferedReader.readLine()) != null) {
      logwriter.write(line);
      logwriter.write(IOUtils.LINE_SEPARATOR_UNIX);
    }
    return logwriter.toString();
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}
Program: 59295
Project: 59295
Buggy source:
private Ports assignPorts(List<String> portBindings){
  Ports ports=new Ports();
  for (  String portBinding : portBindings) {
    String[] elements=portBinding.split(PORTS_SEPARATOR);
    if (elements.length == 1) {
      log.info("String_Node_Str" + elements[0]);
      String exposedPortValue=elements[0].substring(0,elements[0].indexOf("String_Node_Str"));
      ports.bind(ExposedPort.parse(elements[0]),toBinding(exposedPortValue));
    }
 else {
      if (elements.length == 2) {
        ports.bind(ExposedPort.parse(elements[1]),toBinding(elements[0]));
      }
    }
  }
  return ports;
}

Fixed version (ground truth):
private Ports assignPorts(List<String> portBindings){
  Ports ports=new Ports();
  for (  String portBinding : portBindings) {
    String[] elements=portBinding.split(PORTS_SEPARATOR);
    if (elements.length == 1) {
      log.info("String_Node_Str" + elements[0]);
      int positionOfProtocolSeparator=elements[0].indexOf("String_Node_Str");
      String bindingPortValue=elements[0];
      if (positionOfProtocolSeparator > -1) {
        bindingPortValue=elements[0].substring(0,positionOfProtocolSeparator);
      }
      ports.bind(ExposedPort.parse(elements[0]),toBinding(bindingPortValue));
    }
 else {
      if (elements.length == 2) {
        ports.bind(ExposedPort.parse(elements[1]),toBinding(elements[0]));
      }
    }
  }
  return ports;
}
Program: 59296
Project: 59296
Buggy source:
public static Binding binding(Map<String,Object> cubeConfiguration){
  Binding binding=new Binding(NO_GATEWAY);
  if (cubeConfiguration.containsKey("String_Node_Str")) {
    @SuppressWarnings("String_Node_Str") List<String> cubePortBindings=(List<String>)cubeConfiguration.get("String_Node_Str");
    for (    String cubePortBinding : cubePortBindings) {
      String[] elements=cubePortBinding.split(PORTS_SEPARATOR);
      if (elements.length == 1) {
        int exposedPort=Integer.parseInt(elements[0].substring(0,elements[0].indexOf("String_Node_Str")));
        binding.addPortBinding(exposedPort,exposedPort);
      }
 else {
        if (elements.length == 2) {
          int exposedPort=Integer.parseInt(elements[1].substring(0,elements[1].indexOf("String_Node_Str")));
          int port=Integer.parseInt(elements[0]);
          binding.addPortBinding(exposedPort,port);
        }
      }
    }
  }
  return binding;
}

Fixed version (ground truth):
public static Binding binding(Map<String,Object> cubeConfiguration){
  Binding binding=new Binding(NO_GATEWAY);
  if (cubeConfiguration.containsKey("String_Node_Str")) {
    @SuppressWarnings("String_Node_Str") List<String> cubePortBindings=(List<String>)cubeConfiguration.get("String_Node_Str");
    for (    String cubePortBinding : cubePortBindings) {
      String[] elements=cubePortBinding.split(PORTS_SEPARATOR);
      if (elements.length == 1) {
        int positionOfProtocolSeparator=elements[0].indexOf("String_Node_Str");
        String bindingPortValue=elements[0];
        if (positionOfProtocolSeparator > -1) {
          bindingPortValue=elements[0].substring(0,positionOfProtocolSeparator);
        }
        int exposedPort=Integer.parseInt(bindingPortValue);
        binding.addPortBinding(exposedPort,exposedPort);
      }
 else {
        if (elements.length == 2) {
          int exposedPort=Integer.parseInt(elements[1].substring(0,elements[1].indexOf("String_Node_Str")));
          int port=Integer.parseInt(elements[0]);
          binding.addPortBinding(exposedPort,port);
        }
      }
    }
  }
  return binding;
}