Program: 91737
Project: 91737
Buggy source:
/** 
 * Create a Process to run an arbitrary command in a Container with uid of caller so any files created are accessible to user.
 * @param connectionName - uri of connection to use
 * @param imageName - name of image to use
 * @param project - Eclipse project
 * @param errMsgHolder - holder for any error messages
 * @param command - command to run
 * @param commandDir - directory path to command
 * @param workingDir - where to run command
 * @param additionalDirs - additional directories to mount
 * @param origEnv - original environment if we are appending to existing
 * @param envMap - new environment
 * @param supportStdin - support using stdin
 * @param privilegedMode - run in privileged mode
 * @param labels - labels to apply to Container
 * @param keepContainer - boolean whether to keep Container when done
 * @return Process that can be used to check for completion and for routingstdout/stderr
 * @since 3.0
 */
public Process runCommand(String connectionName,String imageName,IProject project,IErrorMessageHolder errMsgHolder,String command,String commandDir,String workingDir,List<String> additionalDirs,Map<String,String> origEnv,Properties envMap,boolean supportStdin,boolean privilegedMode,HashMap<String,String> labels,boolean keepContainer){
  Integer uid=null;
  Integer gid=null;
  String os=System.getProperty("String_Node_Str");
  if (os.indexOf("String_Node_Str") > 0) {
    ID ugid=fidMap.get(project);
    if (ugid == null) {
      try {
        uid=(Integer)Files.getAttribute(project.getLocation().toFile().toPath(),"String_Node_Str");
        gid=(Integer)Files.getAttribute(project.getLocation().toFile().toPath(),"String_Node_Str");
        ugid=new ID(uid,gid);
        fidMap.put(project,ugid);
      }
 catch (      IOException e) {
      }
    }
 else {
      uid=ugid.getuid();
      gid=ugid.getgid();
    }
  }
  final List<String> env=new ArrayList<>();
  env.addAll(toList(origEnv));
  env.addAll(toList(envMap));
  final List<String> cmdList=getCmdList(command);
  final Map<String,List<IDockerPortBinding>> portBindingsMap=new HashMap<>();
  IDockerConnection[] connections=DockerConnectionManager.getInstance().getConnections();
  if (connections == null || connections.length == 0) {
    errMsgHolder.setErrorMessage(Messages.getString("String_Node_Str"));
    return null;
  }
  IDockerConnection connection=null;
  for (  IDockerConnection c : connections) {
    if (c.getUri().equals(connectionName)) {
      connection=c;
      break;
    }
  }
  if (connection == null) {
    errMsgHolder.setErrorMessage(Messages.getFormattedString("String_Node_Str",connectionName));
    return null;
  }
  List<IDockerImage> images=connection.getImages();
  if (images.isEmpty()) {
    errMsgHolder.setErrorMessage(Messages.getString("String_Node_Str"));
    return null;
  }
  IDockerImageInfo info=connection.getImageInfo(imageName);
  if (info == null) {
    errMsgHolder.setErrorMessage(Messages.getFormattedString("String_Node_Str",imageName));
    return null;
  }
  DockerContainerConfig.Builder builder=new DockerContainerConfig.Builder().openStdin(supportStdin).cmd(cmdList).image(imageName).workingDir(workingDir);
  if (uid != null) {
    builder=builder.user(uid.toString());
  }
  if (labels != null)   builder=builder.labels(labels);
  DockerHostConfig.Builder hostBuilder=new DockerHostConfig.Builder().privileged(privilegedMode);
  final Set<String> remoteVolumes=new TreeSet<>();
  final Map<String,String> remoteDataVolumes=new HashMap<>();
  final Set<String> readOnlyVolumes=new TreeSet<>();
  if (!((DockerConnection)connection).isLocal()) {
    if (additionalDirs != null) {
      for (      String dir : additionalDirs) {
        IPath p=new Path(dir).removeTrailingSeparator();
        remoteVolumes.add(p.toPortableString());
        remoteDataVolumes.put(p.toPortableString(),p.toPortableString());
        if (dir.contains("String_Node_Str")) {
          DataVolumeModel dvm=DataVolumeModel.parseString(dir);
switch (dvm.getMountType()) {
case HOST_FILE_SYSTEM:
            dir=dvm.getHostPathMount();
          remoteDataVolumes.put(dir,dvm.getContainerMount());
        if (dvm.isReadOnly()) {
          readOnlyVolumes.add(dir);
        }
      break;
default :
    continue;
}
}
}
}
if (workingDir != null) {
IPath p=new Path(workingDir).removeTrailingSeparator();
remoteVolumes.add(p.toPortableString());
remoteDataVolumes.put(p.toPortableString(),p.toPortableString());
}
if (commandDir != null) {
IPath p=new Path(commandDir).removeTrailingSeparator();
remoteVolumes.add(p.toPortableString());
remoteDataVolumes.put(p.toPortableString(),p.toPortableString());
}
builder=builder.volumes(remoteVolumes);
}
 else {
final Set<String> volumes=new TreeSet<>();
final List<String> volumesFrom=new ArrayList<>();
if (additionalDirs != null) {
for (String dir : additionalDirs) {
IPath p=new Path(dir).removeTrailingSeparator();
if (dir.contains("String_Node_Str")) {
DataVolumeModel dvm=DataVolumeModel.parseString(dir);
switch (dvm.getMountType()) {
case HOST_FILE_SYSTEM:
  String bind=LaunchConfigurationUtils.convertToUnixPath(dvm.getHostPathMount()) + ':' + dvm.getContainerPath()+ "String_Node_Str";
if (dvm.isReadOnly()) {
  bind+="String_Node_Str";
}
volumes.add(bind);
break;
case CONTAINER:
volumesFrom.add(dvm.getContainerMount());
break;
default :
break;
}
}
 else {
volumes.add(p.toPortableString() + "String_Node_Str" + p.toPortableString()+ "String_Node_Str");
}
}
}
if (workingDir != null) {
IPath p=new Path(workingDir).removeTrailingSeparator();
volumes.add(p.toPortableString() + "String_Node_Str" + p.toPortableString()+ "String_Node_Str");
}
if (commandDir != null) {
IPath p=new Path(commandDir).removeTrailingSeparator();
volumes.add(p.toPortableString() + "String_Node_Str" + p.toPortableString()+ "String_Node_Str");
}
List<String> volumeList=new ArrayList<>(volumes);
hostBuilder=hostBuilder.binds(volumeList);
if (!volumesFrom.isEmpty()) {
hostBuilder=hostBuilder.volumesFrom(volumesFrom);
}
}
final DockerContainerConfig config=builder.build();
if (portBindingsMap.size() > 0) hostBuilder=hostBuilder.portBindings(portBindingsMap);
final IDockerHostConfig hostConfig=hostBuilder.build();
String containerId=null;
try {
containerId=((DockerConnection)connection).createContainer(config,hostConfig,null);
}
 catch (DockerException|InterruptedException e) {
errMsgHolder.setErrorMessage(e.getMessage());
return null;
}
final String id=containerId;
final IDockerConnection conn=connection;
if (!((DockerConnection)conn).isLocal()) {
if (!remoteVolumes.isEmpty()) {
CopyVolumesJob job=new CopyVolumesJob(remoteDataVolumes,conn,id);
job.schedule();
try {
job.join();
}
 catch (InterruptedException e) {
}
}
}
try {
((DockerConnection)conn).startContainer(id,null);
}
 catch (DockerException|InterruptedException e) {
Activator.log(e);
}
for (String readonly : readOnlyVolumes) {
remoteDataVolumes.remove(readonly);
}
return new ContainerCommandProcess(connection,imageName,containerId,remoteDataVolumes,keepContainer);
}

Fixed version (ground truth):
/** 
 * Create a Process to run an arbitrary command in a Container with uid of caller so any files created are accessible to user.
 * @param connectionName - uri of connection to use
 * @param imageName - name of image to use
 * @param project - Eclipse project
 * @param errMsgHolder - holder for any error messages
 * @param cmdList - command to run as list of String
 * @param workingDir - where to run command
 * @param additionalDirs - additional directories to mount
 * @param origEnv - original environment if we are appending to existing
 * @param envMap - new environment
 * @param supportStdin - support using stdin
 * @param privilegedMode - run in privileged mode
 * @param labels - labels to apply to Container
 * @param keepContainer - boolean whether to keep Container when done
 * @return Process that can be used to check for completion and for routingstdout/stderr
 * @since 4.0
 */
public Process runCommand(String connectionName,String imageName,IProject project,IErrorMessageHolder errMsgHolder,List<String> cmdList,String workingDir,List<String> additionalDirs,Map<String,String> origEnv,Properties envMap,boolean supportStdin,boolean privilegedMode,HashMap<String,String> labels,boolean keepContainer){
  Integer uid=null;
  Integer gid=null;
  String os=System.getProperty("String_Node_Str");
  if (os.indexOf("String_Node_Str") > 0) {
    ID ugid=fidMap.get(project);
    if (ugid == null) {
      try {
        uid=(Integer)Files.getAttribute(project.getLocation().toFile().toPath(),"String_Node_Str");
        gid=(Integer)Files.getAttribute(project.getLocation().toFile().toPath(),"String_Node_Str");
        ugid=new ID(uid,gid);
        fidMap.put(project,ugid);
      }
 catch (      IOException e) {
      }
    }
 else {
      uid=ugid.getuid();
      gid=ugid.getgid();
    }
  }
  final List<String> env=new ArrayList<>();
  env.addAll(toList(origEnv));
  env.addAll(toList(envMap));
  final Map<String,List<IDockerPortBinding>> portBindingsMap=new HashMap<>();
  IDockerConnection[] connections=DockerConnectionManager.getInstance().getConnections();
  if (connections == null || connections.length == 0) {
    errMsgHolder.setErrorMessage(Messages.getString("String_Node_Str"));
    return null;
  }
  IDockerConnection connection=null;
  for (  IDockerConnection c : connections) {
    if (c.getUri().equals(connectionName)) {
      connection=c;
      break;
    }
  }
  if (connection == null) {
    errMsgHolder.setErrorMessage(Messages.getFormattedString("String_Node_Str",connectionName));
    return null;
  }
  List<IDockerImage> images=connection.getImages();
  if (images.isEmpty()) {
    errMsgHolder.setErrorMessage(Messages.getString("String_Node_Str"));
    return null;
  }
  IDockerImageInfo info=connection.getImageInfo(imageName);
  if (info == null) {
    errMsgHolder.setErrorMessage(Messages.getFormattedString("String_Node_Str",imageName));
    return null;
  }
  DockerContainerConfig.Builder builder=new DockerContainerConfig.Builder().openStdin(supportStdin).cmd(cmdList).image(imageName).workingDir(workingDir);
  if (uid != null) {
    builder=builder.user(uid.toString());
  }
  if (labels != null)   builder=builder.labels(labels);
  DockerHostConfig.Builder hostBuilder=new DockerHostConfig.Builder().privileged(privilegedMode);
  final Set<String> remoteVolumes=new TreeSet<>();
  final Map<String,String> remoteDataVolumes=new HashMap<>();
  final Set<String> readOnlyVolumes=new TreeSet<>();
  if (!((DockerConnection)connection).isLocal()) {
    if (additionalDirs != null) {
      for (      String dir : additionalDirs) {
        IPath p=new Path(dir).removeTrailingSeparator();
        remoteVolumes.add(p.toPortableString());
        remoteDataVolumes.put(p.toPortableString(),p.toPortableString());
        if (dir.contains("String_Node_Str")) {
          DataVolumeModel dvm=DataVolumeModel.parseString(dir);
switch (dvm.getMountType()) {
case HOST_FILE_SYSTEM:
            dir=dvm.getHostPathMount();
          remoteDataVolumes.put(dir,dvm.getContainerMount());
        if (dvm.isReadOnly()) {
          readOnlyVolumes.add(dir);
        }
      break;
default :
    continue;
}
}
}
}
if (workingDir != null) {
IPath p=new Path(workingDir).removeTrailingSeparator();
remoteVolumes.add(p.toPortableString());
remoteDataVolumes.put(p.toPortableString(),p.toPortableString());
}
builder=builder.volumes(remoteVolumes);
}
 else {
final Set<String> volumes=new TreeSet<>();
final List<String> volumesFrom=new ArrayList<>();
if (additionalDirs != null) {
for (String dir : additionalDirs) {
IPath p=new Path(dir).removeTrailingSeparator();
if (dir.contains("String_Node_Str")) {
DataVolumeModel dvm=DataVolumeModel.parseString(dir);
switch (dvm.getMountType()) {
case HOST_FILE_SYSTEM:
  String bind=LaunchConfigurationUtils.convertToUnixPath(dvm.getHostPathMount()) + ':' + dvm.getContainerPath()+ "String_Node_Str";
if (dvm.isReadOnly()) {
  bind+="String_Node_Str";
}
volumes.add(bind);
break;
case CONTAINER:
volumesFrom.add(dvm.getContainerMount());
break;
default :
break;
}
}
 else {
volumes.add(p.toPortableString() + "String_Node_Str" + p.toPortableString()+ "String_Node_Str");
}
}
}
if (workingDir != null) {
IPath p=new Path(workingDir).removeTrailingSeparator();
volumes.add(p.toPortableString() + "String_Node_Str" + p.toPortableString()+ "String_Node_Str");
}
List<String> volumeList=new ArrayList<>(volumes);
hostBuilder=hostBuilder.binds(volumeList);
if (!volumesFrom.isEmpty()) {
hostBuilder=hostBuilder.volumesFrom(volumesFrom);
}
}
final DockerContainerConfig config=builder.build();
if (portBindingsMap.size() > 0) hostBuilder=hostBuilder.portBindings(portBindingsMap);
final IDockerHostConfig hostConfig=hostBuilder.build();
String containerId=null;
try {
containerId=((DockerConnection)connection).createContainer(config,hostConfig,null);
}
 catch (DockerException|InterruptedException e) {
errMsgHolder.setErrorMessage(e.getMessage());
return null;
}
final String id=containerId;
final IDockerConnection conn=connection;
if (!((DockerConnection)conn).isLocal()) {
if (!remoteVolumes.isEmpty()) {
CopyVolumesJob job=new CopyVolumesJob(remoteDataVolumes,conn,id);
job.schedule();
try {
job.join();
}
 catch (InterruptedException e) {
}
}
}
try {
((DockerConnection)conn).startContainer(id,null);
}
 catch (DockerException|InterruptedException e) {
Activator.log(e);
}
for (String readonly : readOnlyVolumes) {
remoteDataVolumes.remove(readonly);
}
return new ContainerCommandProcess(connection,imageName,containerId,remoteDataVolumes,keepContainer);
}