nus-yam/ex-repair huggingface dataset:
Program: 111345
Project: 111345
Buggy source:
@Test public void testUpdateSwarmNode(){
  DockerClient docker1=startDockerInDocker();
  docker1.initializeSwarmCmd(new SwarmSpec()).exec();
  List<SwarmNode> nodes=docker1.listSwarmNodesCmd().exec();
  assertThat(1,is(nodes.size()));
  SwarmNode node=nodes.get(0);
  assertThat(SwarmNodeState.READY,is(node.getStatus().getState()));
  SwarmNodeSpec nodeSpec=node.getSpec().withAvailability(SwarmNodeAvailability.PAUSE);
  docker1.updateSwarmNodeCmd().withSwarmNodeId(node.getId()).withVersion(node.getVersion().getIndex()).withSwarmNodeSpec(nodeSpec).exec();
  nodes=docker1.listSwarmNodesCmd().exec();
  assertThat(1,is(nodes.size()));
  assertThat(SwarmNodeAvailability.PAUSE,is(nodes.get(0).getSpec().getAvailability()));
}

Fixed version (ground truth):
@Test public void testUpdateSwarmNode(){
  DockerClient docker1=startDockerInDocker();
  docker1.initializeSwarmCmd(new SwarmSpec()).exec();
  List<SwarmNode> nodes=docker1.listSwarmNodesCmd().exec();
  assertThat(1,is(nodes.size()));
  SwarmNode node=nodes.get(0);
  assertThat(SwarmNodeState.READY,is(node.getStatus().getState()));
  SwarmNodeSpec nodeSpec=node.getSpec().withAvailability(SwarmNodeAvailability.PAUSE);
  docker1.updateSwarmNodeCmd().withSwarmNodeId(node.getId()).withVersion(node.getVersion().getIndex()).withSwarmNodeSpec(nodeSpec).exec();
  nodes=docker1.listSwarmNodesCmd().exec();
  assertThat(nodes.size(),is(1));
  assertThat(nodes.get(0).getSpec().getAvailability(),is(SwarmNodeAvailability.PAUSE));
}
Program: 111346
Project: 111346
Buggy source:
/** 
 * @see #ioMergedRecursive
 */
@CheckForNull public List<Long> getIoMergedRecursive(){
  return ioMergedRecursive;
}

Fixed version (ground truth):
/** 
 * @see #ioMergedRecursive
 */
@CheckForNull public List<BlkioStatEntry> getIoMergedRecursive(){
  return ioMergedRecursive;
}
Program: 111347
Project: 111347
Buggy source:
/** 
 * @see #sectorsRecursive
 */
@CheckForNull public List<Long> getSectorsRecursive(){
  return sectorsRecursive;
}

Fixed version (ground truth):
/** 
 * @see #sectorsRecursive
 */
@CheckForNull public List<BlkioStatEntry> getSectorsRecursive(){
  return sectorsRecursive;
}
Program: 111348
Project: 111348
Buggy source:
/** 
 * @see #ioWaitTimeRecursive
 */
@CheckForNull public List<Long> getIoWaitTimeRecursive(){
  return ioWaitTimeRecursive;
}

Fixed version (ground truth):
/** 
 * @see #ioWaitTimeRecursive
 */
@CheckForNull public List<BlkioStatEntry> getIoWaitTimeRecursive(){
  return ioWaitTimeRecursive;
}
Program: 111349
Project: 111349
Buggy source:
/** 
 * @see #ioTimeRecursive
 */
@CheckForNull public List<Long> getIoTimeRecursive(){
  return ioTimeRecursive;
}

Fixed version (ground truth):
/** 
 * @see #ioTimeRecursive
 */
@CheckForNull public List<BlkioStatEntry> getIoTimeRecursive(){
  return ioTimeRecursive;
}
Program: 111350
Project: 111350
Buggy source:
/** 
 * @see #ioServiceBytesRecursive
 */
@CheckForNull public List<Long> getIoServiceBytesRecursive(){
  return ioServiceBytesRecursive;
}

Fixed version (ground truth):
/** 
 * @see #ioServiceBytesRecursive
 */
@CheckForNull public List<BlkioStatEntry> getIoServiceBytesRecursive(){
  return ioServiceBytesRecursive;
}
Program: 111351
Project: 111351
Buggy source:
/** 
 * @see #ioServicedRecursive
 */
@CheckForNull public List<Long> getIoServicedRecursive(){
  return ioServicedRecursive;
}

Fixed version (ground truth):
/** 
 * @see #ioServicedRecursive
 */
@CheckForNull public List<BlkioStatEntry> getIoServicedRecursive(){
  return ioServicedRecursive;
}
Program: 111352
Project: 111352
Buggy source:
/** 
 * @see #ioServiceTimeRecursive
 */
@CheckForNull public List<Long> getIoServiceTimeRecursive(){
  return ioServiceTimeRecursive;
}

Fixed version (ground truth):
/** 
 * @see #ioServiceTimeRecursive
 */
@CheckForNull public List<BlkioStatEntry> getIoServiceTimeRecursive(){
  return ioServiceTimeRecursive;
}
Program: 111353
Project: 111353
Buggy source:
/** 
 * @see #ioQueueRecursive
 */
@CheckForNull public List<Long> getIoQueueRecursive(){
  return ioQueueRecursive;
}

Fixed version (ground truth):
/** 
 * @see #ioQueueRecursive
 */
@CheckForNull public List<BlkioStatEntry> getIoQueueRecursive(){
  return ioQueueRecursive;
}
Program: 111355
Project: 111355
Buggy source:
/** 
 * Blocks until   {@link ResultCallback#onComplete()} was called or the given timeout occurs
 * @return {@code true} if completed and {@code false} if the waiting time elapsedbefore  {@link ResultCallback#onComplete()} was called.
 */
public boolean awaitCompletion(long timeout,TimeUnit timeUnit) throws InterruptedException {
  return completed.await(timeout,timeUnit);
}

Fixed version (ground truth):
/** 
 * Blocks until   {@link ResultCallback#onComplete()} was called or the given timeout occurs
 * @return {@code true} if completed and {@code false} if the waiting time elapsedbefore  {@link ResultCallback#onComplete()} was called.
 */
public boolean awaitCompletion(long timeout,TimeUnit timeUnit) throws InterruptedException {
  boolean result=completed.await(timeout,timeUnit);
  getFirstError();
  return result;
}
Program: 111356
Project: 111356
Buggy source:
@Test public void attachContainerWithTTY() throws Exception {
  File baseDir=new File(Thread.currentThread().getContextClassLoader().getResource("String_Node_Str").getFile());
  String imageId=buildImage(baseDir);
  CreateContainerResponse container=dockerClient.createContainerCmd(imageId).withTty(true).exec();
  LOG.info("String_Node_Str",container.toString());
  assertThat(container.getId(),not(isEmptyString()));
  dockerClient.startContainerCmd(container.getId()).exec();
  AttachContainerTestCallback callback=new AttachContainerTestCallback(){
    @Override public void onNext(    Frame frame){
      assertEquals(frame.getStreamType(),StreamType.RAW);
      super.onNext(frame);
    }
  }
;
  dockerClient.attachContainerCmd(container.getId()).withStdErr(true).withStdOut(true).withFollowStream(true).exec(callback).awaitCompletion(10,TimeUnit.SECONDS);
  callback.close();
  assertThat(callback.toString(),containsString("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void attachContainerWithTTY() throws Exception {
  File baseDir=new File(Thread.currentThread().getContextClassLoader().getResource("String_Node_Str").getFile());
  String imageId=buildImage(baseDir);
  CreateContainerResponse container=dockerClient.createContainerCmd(imageId).withTty(true).exec();
  LOG.info("String_Node_Str",container.toString());
  assertThat(container.getId(),not(isEmptyString()));
  dockerClient.startContainerCmd(container.getId()).exec();
  AttachContainerTestCallback callback=new AttachContainerTestCallback(){
    @Override public void onNext(    Frame frame){
      assertEquals(frame.getStreamType(),StreamType.RAW);
      super.onNext(frame);
    }
  }
;
  dockerClient.attachContainerCmd(container.getId()).withStdErr(true).withStdOut(true).withFollowStream(true).exec(callback).awaitCompletion(10,SECONDS);
  callback.close();
  assertThat(callback.toString(),containsString("String_Node_Str"));
}
Program: 111357
Project: 111357
Buggy source:
@Test public void attachContainerWithStdin() throws Exception {
  String snippet="String_Node_Str";
  CreateContainerResponse container=dockerClient.createContainerCmd("String_Node_Str").withCmd("String_Node_Str","String_Node_Str","String_Node_Str").withTty(false).withStdinOpen(true).exec();
  LOG.info("String_Node_Str",container.toString());
  assertThat(container.getId(),not(isEmptyString()));
  dockerClient.startContainerCmd(container.getId()).exec();
  InspectContainerResponse inspectContainerResponse=dockerClient.inspectContainerCmd(container.getId()).exec();
  assertTrue(inspectContainerResponse.getState().getRunning());
  AttachContainerTestCallback callback=new AttachContainerTestCallback(){
    @Override public void onNext(    Frame frame){
      assertEquals(frame.getStreamType(),StreamType.STDOUT);
      super.onNext(frame);
    }
  }
;
  InputStream stdin=new ByteArrayInputStream((snippet + "String_Node_Str").getBytes());
  dockerClient.attachContainerCmd(container.getId()).withStdErr(true).withStdOut(true).withFollowStream(true).withStdIn(stdin).exec(callback).awaitCompletion(5,TimeUnit.SECONDS);
  callback.close();
  assertThat(callback.toString(),containsString(snippet));
}

Fixed version (ground truth):
@Test public void attachContainerWithStdin() throws Exception {
  String snippet="String_Node_Str";
  CreateContainerResponse container=dockerClient.createContainerCmd("String_Node_Str").withCmd("String_Node_Str","String_Node_Str","String_Node_Str").withTty(false).withStdinOpen(true).exec();
  LOG.info("String_Node_Str",container.toString());
  assertThat(container.getId(),not(isEmptyString()));
  dockerClient.startContainerCmd(container.getId()).exec();
  Thread.sleep(SECONDS.toMillis(3));
  InspectContainerResponse inspectContainerResponse=dockerClient.inspectContainerCmd(container.getId()).exec();
  assertTrue(inspectContainerResponse.getState().getRunning());
  AttachContainerTestCallback callback=new AttachContainerTestCallback(){
    @Override public void onNext(    Frame frame){
      assertEquals(frame.getStreamType(),StreamType.STDOUT);
      super.onNext(frame);
    }
  }
;
  InputStream stdin=new ByteArrayInputStream((snippet + "String_Node_Str").getBytes());
  dockerClient.attachContainerCmd(container.getId()).withStdErr(true).withStdOut(true).withFollowStream(true).withStdIn(stdin).exec(callback).awaitCompletion(15,SECONDS);
  callback.close();
  assertThat(callback.toString(),containsString(snippet));
}
Program: 111358
Project: 111358
Buggy source:
@Test public void attachContainerWithoutTTY() throws Exception {
  String snippet="String_Node_Str";
  CreateContainerResponse container=dockerClient.createContainerCmd("String_Node_Str").withCmd("String_Node_Str",snippet).withTty(false).exec();
  LOG.info("String_Node_Str",container.toString());
  assertThat(container.getId(),not(isEmptyString()));
  dockerClient.startContainerCmd(container.getId()).exec();
  AttachContainerTestCallback callback=new AttachContainerTestCallback(){
    @Override public void onNext(    Frame frame){
      assertEquals(frame.getStreamType(),StreamType.STDOUT);
      super.onNext(frame);
    }
  }
;
  dockerClient.attachContainerCmd(container.getId()).withStdErr(true).withStdOut(true).withFollowStream(true).withLogs(true).exec(callback).awaitCompletion(10,TimeUnit.SECONDS);
  callback.close();
  assertThat(callback.toString(),containsString(snippet));
}

Fixed version (ground truth):
@Test public void attachContainerWithoutTTY() throws Exception {
  String snippet="String_Node_Str";
  CreateContainerResponse container=dockerClient.createContainerCmd("String_Node_Str").withCmd("String_Node_Str",snippet).withTty(false).exec();
  LOG.info("String_Node_Str",container.toString());
  assertThat(container.getId(),not(isEmptyString()));
  dockerClient.startContainerCmd(container.getId()).exec();
  AttachContainerTestCallback callback=new AttachContainerTestCallback(){
    @Override public void onNext(    Frame frame){
      assertEquals(frame.getStreamType(),StreamType.STDOUT);
      super.onNext(frame);
    }
  }
;
  dockerClient.attachContainerCmd(container.getId()).withStdErr(true).withStdOut(true).withFollowStream(true).withLogs(true).exec(callback).awaitCompletion(10,SECONDS);
  callback.close();
  assertThat(callback.toString(),containsString(snippet));
}
Program: 111359
Project: 111359
Buggy source:
@Override public BuildImageCmdImpl withDockerfile(File dockerfile){
  checkNotNull(dockerfile);
  if (!dockerfile.exists()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (!dockerfile.isFile()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (baseDirectory == null) {
    withBaseDirectory(dockerfile.getParentFile());
  }
  this.dockerFile=dockerfile;
  try {
    withTarInputStream(new Dockerfile(dockerfile).parse().buildDockerFolderTar(baseDirectory));
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
  return this;
}

Fixed version (ground truth):
@Override public BuildImageCmdImpl withDockerfile(File dockerfile){
  checkNotNull(dockerfile);
  if (!dockerfile.exists()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (!dockerfile.isFile()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (baseDirectory == null) {
    withBaseDirectory(dockerfile.getParentFile());
  }
  this.dockerFile=dockerfile;
  try {
    withTarInputStream(new Dockerfile(dockerfile,baseDirectory).parse().buildDockerFolderTar());
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
  return this;
}
Program: 111360
Project: 111360
Buggy source:
public ScannedResult() throws IOException {
  ignores=getIgnores();
  String matchingIgnorePattern=effectiveMatchingIgnorePattern(dockerFile);
  if (matchingIgnorePattern != null) {
    throw new DockerClientException(String.format("String_Node_Str",matchingIgnorePattern));
  }
  Collection<File> filesInBuildContext=FileUtils.listFiles(getDockerFolder(),TrueFileFilter.INSTANCE,TrueFileFilter.INSTANCE);
  for (  File f : filesInBuildContext) {
    if (effectiveMatchingIgnorePattern(f) == null) {
      filesToAdd.add(f);
    }
  }
}

Fixed version (ground truth):
public ScannedResult() throws IOException {
  ignores=getIgnores();
  String matchingIgnorePattern=effectiveMatchingIgnorePattern(dockerFile);
  if (matchingIgnorePattern != null) {
    throw new DockerClientException(String.format("String_Node_Str",matchingIgnorePattern));
  }
  Collection<File> filesInBuildContext=FileUtils.listFiles(baseDirectory,TrueFileFilter.INSTANCE,TrueFileFilter.INSTANCE);
  for (  File f : filesInBuildContext) {
    if (effectiveMatchingIgnorePattern(f) == null) {
      filesToAdd.add(f);
    }
  }
}
Program: 111361
Project: 111361
Buggy source:
public List<String> getIgnores() throws IOException {
  List<String> ignores=new ArrayList<String>();
  File dockerIgnoreFile=new File(getDockerFolder(),"String_Node_Str");
  if (dockerIgnoreFile.exists()) {
    int lineNumber=0;
    List<String> dockerIgnoreFileContent=FileUtils.readLines(dockerIgnoreFile);
    for (    String pattern : dockerIgnoreFileContent) {
      lineNumber++;
      pattern=pattern.trim();
      if (pattern.isEmpty()) {
        continue;
      }
      pattern=FilenameUtils.normalize(pattern);
      try {
        ignores.add(pattern);
      }
 catch (      GoLangFileMatchException e) {
        throw new DockerClientException(String.format("String_Node_Str",pattern,lineNumber));
      }
    }
  }
  return ignores;
}

Fixed version (ground truth):
public List<String> getIgnores() throws IOException {
  List<String> ignores=new ArrayList<String>();
  File dockerIgnoreFile=new File(baseDirectory,"String_Node_Str");
  if (dockerIgnoreFile.exists()) {
    int lineNumber=0;
    List<String> dockerIgnoreFileContent=FileUtils.readLines(dockerIgnoreFile);
    for (    String pattern : dockerIgnoreFileContent) {
      lineNumber++;
      pattern=pattern.trim();
      if (pattern.isEmpty()) {
        continue;
      }
      pattern=FilenameUtils.normalize(pattern);
      try {
        ignores.add(pattern);
      }
 catch (      GoLangFileMatchException e) {
        throw new DockerClientException(String.format("String_Node_Str",pattern,lineNumber));
      }
    }
  }
  return ignores;
}
Program: 111362
Project: 111362
Buggy source:
public Dockerfile(File dockerFile){
  if (!dockerFile.exists()) {
    throw new IllegalStateException(String.format("String_Node_Str",dockerFile.getAbsolutePath()));
  }
  if (!dockerFile.isFile()) {
    throw new IllegalStateException(String.format("String_Node_Str",dockerFile.getAbsolutePath()));
  }
  this.dockerFile=dockerFile;
}

Fixed version (ground truth):
public Dockerfile(File dockerFile,File baseDirectory){
  if (!dockerFile.exists()) {
    throw new IllegalStateException(String.format("String_Node_Str",dockerFile.getAbsolutePath()));
  }
  if (!dockerFile.isFile()) {
    throw new IllegalStateException(String.format("String_Node_Str",dockerFile.getAbsolutePath()));
  }
  this.dockerFile=dockerFile;
  if (!baseDirectory.exists()) {
    throw new IllegalStateException(String.format("String_Node_Str",baseDirectory.getAbsolutePath()));
  }
  if (!baseDirectory.isDirectory()) {
    throw new IllegalStateException(String.format("String_Node_Str",baseDirectory.getAbsolutePath()));
  }
  this.baseDirectory=baseDirectory;
}
Program: 111363
Project: 111363
Buggy source:
/** 
 * Returns the matching ignore pattern for the given file or null if it should NOT be ignored. Exception rules like "!Dockerfile" will be respected.
 */
private String effectiveMatchingIgnorePattern(File file){
  String relativeFilename=FilePathUtil.relativize(getDockerFolder(),file);
  List<String> matchingPattern=matchingIgnorePatterns(relativeFilename);
  if (matchingPattern.isEmpty()) {
    return null;
  }
  String lastMatchingPattern=matchingPattern.get(matchingPattern.size() - 1);
  int lastMatchingPatternIndex=ignores.lastIndexOf(lastMatchingPattern);
  if (lastMatchingPatternIndex == ignores.size() - 1) {
    return lastMatchingPattern;
  }
  List<String> remainingIgnorePattern=ignores.subList(lastMatchingPatternIndex + 1,ignores.size());
  for (  String ignorePattern : remainingIgnorePattern) {
    if (ignorePattern.equals("String_Node_Str" + relativeFilename)) {
      return null;
    }
  }
  return lastMatchingPattern;
}

Fixed version (ground truth):
/** 
 * Returns the matching ignore pattern for the given file or null if it should NOT be ignored. Exception rules like "!Dockerfile" will be respected.
 */
private String effectiveMatchingIgnorePattern(File file){
  String relativeFilename=FilePathUtil.relativize(baseDirectory,file);
  List<String> matchingPattern=matchingIgnorePatterns(relativeFilename);
  if (matchingPattern.isEmpty()) {
    return null;
  }
  String lastMatchingPattern=matchingPattern.get(matchingPattern.size() - 1);
  int lastMatchingPatternIndex=ignores.lastIndexOf(lastMatchingPattern);
  if (lastMatchingPatternIndex == ignores.size() - 1) {
    return lastMatchingPattern;
  }
  List<String> remainingIgnorePattern=ignores.subList(lastMatchingPatternIndex + 1,ignores.size());
  for (  String ignorePattern : remainingIgnorePattern) {
    if (ignorePattern.equals("String_Node_Str" + relativeFilename)) {
      return null;
    }
  }
  return lastMatchingPattern;
}
Program: 111364
Project: 111364
Buggy source:
@Test public void testAddMultipleFiles() throws IOException {
  File baseDir=new File(Thread.currentThread().getContextClassLoader().getResource("String_Node_Str").getFile());
  Dockerfile dockerfile=new Dockerfile(new File(baseDir,"String_Node_Str"));
  Dockerfile.ScannedResult result=dockerfile.parse();
  Collection<String> filesToAdd=transform(result.filesToAdd,TO_FILE_NAMES);
  assertThat(filesToAdd,containsInAnyOrder("String_Node_Str","String_Node_Str","String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testAddMultipleFiles() throws IOException {
  File baseDir=new File(Thread.currentThread().getContextClassLoader().getResource("String_Node_Str").getFile());
  Dockerfile dockerfile=new Dockerfile(new File(baseDir,"String_Node_Str"),baseDir);
  Dockerfile.ScannedResult result=dockerfile.parse();
  Collection<String> filesToAdd=transform(result.filesToAdd,TO_FILE_NAMES);
  assertThat(filesToAdd,containsInAnyOrder("String_Node_Str","String_Node_Str","String_Node_Str"));
}
Program: 111365
Project: 111365
Buggy source:
@Test public void testAllItems() throws IOException {
  File baseDir=new File(Thread.currentThread().getContextClassLoader().getResource("String_Node_Str").getFile());
  File root=baseDir.getParentFile();
  Map<String,Dockerfile> dockerfiles=new HashMap<String,Dockerfile>();
  Map<String,Dockerfile.ScannedResult> results=new HashMap<String,Dockerfile.ScannedResult>();
  for (  File child : root.listFiles()) {
    if (new File(child,"String_Node_Str").exists()) {
      Dockerfile dockerfile=new Dockerfile(new File(child,"String_Node_Str"));
      dockerfiles.put(child.getName(),dockerfile);
    }
  }
  for (  String name : dockerfiles.keySet()) {
    log.info("String_Node_Str",name);
    try {
      results.put(name,dockerfiles.get(name).parse());
    }
 catch (    Exception ex) {
      log.error("String_Node_Str",name,ex);
    }
  }
  for (  String name : results.keySet()) {
    log.info("String_Node_Str",name,results.get(name));
  }
}

Fixed version (ground truth):
@Test public void testAllItems() throws IOException {
  File baseDir=new File(Thread.currentThread().getContextClassLoader().getResource("String_Node_Str").getFile());
  File root=baseDir.getParentFile();
  Map<String,Dockerfile> dockerfiles=new HashMap<String,Dockerfile>();
  Map<String,Dockerfile.ScannedResult> results=new HashMap<String,Dockerfile.ScannedResult>();
  for (  File child : root.listFiles()) {
    if (new File(child,"String_Node_Str").exists()) {
      Dockerfile dockerfile=new Dockerfile(new File(child,"String_Node_Str"),baseDir);
      dockerfiles.put(child.getName(),dockerfile);
    }
  }
  for (  String name : dockerfiles.keySet()) {
    log.info("String_Node_Str",name);
    try {
      results.put(name,dockerfiles.get(name).parse());
    }
 catch (    Exception ex) {
      log.error("String_Node_Str",name,ex);
    }
  }
  for (  String name : results.keySet()) {
    log.info("String_Node_Str",name,results.get(name));
  }
}
Program: 111367
Project: 111367
Buggy source:
/** 
 * @see #deviceId
 */
public GraphData withRootDir(String rootDir){
  this.rootDir=rootDir;
  return this;
}

Fixed version (ground truth):
/** 
 * @see #rootDir
 */
public GraphData withRootDir(String rootDir){
  this.rootDir=rootDir;
  return this;
}
Program: 111369
Project: 111369
Buggy source:
@Override protected void channelRead0(ChannelHandlerContext ctx,ByteBuf msg) throws Exception {
  rawBuffer.writeBytes(msg.copy(),0,msg.readableBytes());
  Frame frame=null;
  do {
    frame=decode();
    if (frame != null) {
      resultCallback.onNext(frame);
    }
  }
 while (frame != null);
}

Fixed version (ground truth):
@Override protected void channelRead0(ChannelHandlerContext ctx,ByteBuf msg) throws Exception {
  rawBuffer.writeBytes(msg,0,msg.readableBytes());
  Frame frame=null;
  do {
    frame=decode();
    if (frame != null) {
      resultCallback.onNext(frame);
    }
  }
 while (frame != null);
}
Program: 111370
Project: 111370
Buggy source:
private String getBodyAsMessage(ByteBuf body){
  return body.readBytes(body.readableBytes()).toString(Charset.forName("String_Node_Str"));
}

Fixed version (ground truth):
private String getBodyAsMessage(ByteBuf body){
  String result=body.readBytes(body.readableBytes()).toString(Charset.forName("String_Node_Str"));
  body.discardReadBytes();
  body.release();
  return result;
}
Program: 111371
Project: 111371
Buggy source:
@Override protected void channelRead0(ChannelHandlerContext ctx,ByteBuf msg) throws Exception {
  byte[] buffer=new byte[msg.readableBytes()];
  msg.readBytes(buffer);
  T object=null;
  try {
    object=objectMapper.readValue(buffer,typeReference);
  }
 catch (  Exception e) {
    callback.onError(e);
    throw new RuntimeException(e);
  }
  callback.onNext(object);
}

Fixed version (ground truth):
@Override protected void channelRead0(ChannelHandlerContext ctx,ByteBuf msg) throws Exception {
  byte[] buffer=new byte[msg.readableBytes()];
  msg.readBytes(buffer);
  msg.discardReadBytes();
  T object=null;
  try {
    object=objectMapper.readValue(buffer,typeReference);
  }
 catch (  Exception e) {
    callback.onError(e);
    throw new RuntimeException(e);
  }
  callback.onNext(object);
}
Program: 111372
Project: 111372
Buggy source:
private int read(byte[] buf,int offset,int length){
  length=Math.min(rawBuffer.readableBytes(),length);
  rawBuffer.readBytes(buf,offset,length);
  return length;
}

Fixed version (ground truth):
private int read(byte[] buf,int offset,int length){
  length=Math.min(rawBuffer.readableBytes(),length);
  rawBuffer.readBytes(buf,offset,length);
  rawBuffer.discardReadBytes();
  return length;
}
Program: 111373
Project: 111373
Buggy source:
protected String registryConfigs(AuthConfigurations authConfigs){
  try {
    final String json;
    if (dockerClientConfig.getApiVersion().isGreaterOrEqual(RemoteApiVersion.VERSION_1_19)) {
      json=new ObjectMapper().writeValueAsString(authConfigs.getConfigs());
    }
 else {
      json=new ObjectMapper().writeValueAsString(authConfigs);
    }
    return Base64.encodeBase64String(json.getBytes());
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
protected String registryConfigs(AuthConfigurations authConfigs){
  try {
    final String json;
    final ObjectMapper objectMapper=new ObjectMapper();
    final RemoteApiVersion apiVersion=dockerClientConfig.getApiVersion();
    if (apiVersion.equals(UNKNOWN_VERSION)) {
      ObjectNode rootNode=objectMapper.valueToTree(authConfigs.getConfigs());
      final ObjectNode authNodes=objectMapper.valueToTree(authConfigs);
      rootNode.setAll(authNodes);
      json=rootNode.toString();
    }
 else     if (apiVersion.isGreaterOrEqual(VERSION_1_19)) {
      json=objectMapper.writeValueAsString(authConfigs.getConfigs());
    }
 else {
      json=objectMapper.writeValueAsString(authConfigs);
    }
    return Base64.encodeBase64String(json.getBytes());
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}
Program: 111374
Project: 111374
Buggy source:
@Override public void processResponseStream(InputStream response,ResultCallback<T> resultCallback){
  resultCallback.onStart(response);
  OBJECT_MAPPER.configure(com.fasterxml.jackson.core.JsonParser.Feature.AUTO_CLOSE_SOURCE,true);
  try {
    JsonParser jp=JSON_FACTORY.createParser(response);
    Boolean closed=jp.isClosed();
    JsonToken nextToken=jp.nextToken();
    while (!closed && nextToken != null && nextToken != JsonToken.END_OBJECT) {
      try {
        T next=OBJECT_MAPPER.readValue(jp,clazz);
        resultCallback.onNext(next);
      }
 catch (      Exception e) {
        resultCallback.onError(e);
      }
      closed=jp.isClosed();
      nextToken=jp.nextToken();
    }
  }
 catch (  Throwable t) {
    resultCallback.onError(t);
  }
 finally {
    try {
      response.close();
    }
 catch (    IOException e) {
      resultCallback.onError(e);
    }
 finally {
      resultCallback.onComplete();
    }
  }
}

Fixed version (ground truth):
@Override public void processResponseStream(InputStream response,ResultCallback<T> resultCallback){
  resultCallback.onStart(response);
  OBJECT_MAPPER.configure(com.fasterxml.jackson.core.JsonParser.Feature.AUTO_CLOSE_SOURCE,true);
  try {
    JsonParser jp=JSON_FACTORY.createParser(response);
    Boolean closed=jp.isClosed();
    JsonToken nextToken=jp.nextToken();
    while (!closed && nextToken != null && nextToken != JsonToken.END_OBJECT) {
      try {
        ObjectNode objectNode=OBJECT_MAPPER.readTree(jp);
        if (!objectNode.isEmpty(null)) {
          T next=OBJECT_MAPPER.treeToValue(objectNode,clazz);
          resultCallback.onNext(next);
        }
      }
 catch (      Exception e) {
        resultCallback.onError(e);
      }
      closed=jp.isClosed();
      nextToken=jp.nextToken();
    }
  }
 catch (  Throwable t) {
    resultCallback.onError(t);
  }
 finally {
    try {
      response.close();
    }
 catch (    IOException e) {
      resultCallback.onError(e);
    }
 finally {
      resultCallback.onComplete();
    }
  }
}
Program: 111375
Project: 111375
Buggy source:
/** 
 * Called when the async processing starts. The passed   {@link Closeable} can be used to close/interrupt theprocessing
 */
void onStart(Closeable closeable);

Fixed version (ground truth):
/** 
 * Called when the async processing starts respectively when the response arrives from the server. The passed  {@link Closeable} can be used to close/interrupt the processing.
 */
void onStart(Closeable closeable);
Program: 111376
Project: 111376
Buggy source:
@Override public void onStart(Closeable stream){
  this.stream=stream;
  this.closed=false;
}

Fixed version (ground truth):
@Override public void onStart(Closeable stream){
  this.stream=stream;
  this.closed=false;
  started.countDown();
}
Program: 111377
Project: 111377
Buggy source:
@Override public void onNext(Frame frame){
  if (frame != null) {
    try {
switch (frame.getStreamType()) {
case STDOUT:
case RAW:
        if (stdout != null) {
          stdout.write(frame.getPayload());
          stdout.flush();
        }
      break;
case STDERR:
    if (stderr != null) {
      stderr.write(frame.getPayload());
      stderr.flush();
    }
  break;
default :
LOGGER.error("String_Node_Str" + frame.getStreamType());
}
}
 catch (IOException e) {
onError(e);
}
}
LOGGER.debug(frame.toString());
}

Fixed version (ground truth):
@Override public void onNext(Frame frame){
  if (frame != null) {
    try {
switch (frame.getStreamType()) {
case STDOUT:
case RAW:
        if (stdout != null) {
          stdout.write(frame.getPayload());
          stdout.flush();
        }
      break;
case STDERR:
    if (stderr != null) {
      stderr.write(frame.getPayload());
      stderr.flush();
    }
  break;
default :
LOGGER.error("String_Node_Str" + frame.getStreamType());
}
}
 catch (IOException e) {
onError(e);
}
LOGGER.debug(frame.toString());
}
}
Program: 111378
Project: 111378
Buggy source:
public <T>void post(TypeReference<T> typeReference,ResultCallback<T> resultCallback,InputStream body){
  HttpRequestProvider requestProvider=httpPostRequestProvider(null);
  Channel channel=getChannel();
  initCallback(channel,resultCallback);
  JsonResponseCallbackHandler<T> jsonResponseHandler=new JsonResponseCallbackHandler<T>(typeReference,resultCallback);
  HttpResponseHandler responseHandler=new HttpResponseHandler(requestProvider,resultCallback);
  channel.pipeline().addLast(new ChunkedWriteHandler());
  channel.pipeline().addLast(responseHandler);
  channel.pipeline().addLast(new JsonObjectDecoder());
  channel.pipeline().addLast(jsonResponseHandler);
  HttpRequest request=requestProvider.getHttpRequest(resource);
  if (request instanceof FullHttpRequest) {
    throw new DockerClientException("String_Node_Str");
  }
  request.headers().set(HttpHeaderNames.TRANSFER_ENCODING,HttpHeaderValues.CHUNKED);
  request.headers().remove(HttpHeaderNames.CONTENT_LENGTH);
  channel.write(request);
  channel.write(new ChunkedStream(new BufferedInputStream(body,1024 * 1024),1024 * 1024));
  channel.write(LastHttpContent.EMPTY_LAST_CONTENT);
  channel.flush();
}

Fixed version (ground truth):
public <T>void post(TypeReference<T> typeReference,ResultCallback<T> resultCallback,InputStream body){
  HttpRequestProvider requestProvider=httpPostRequestProvider(null);
  Channel channel=getChannel();
  JsonResponseCallbackHandler<T> jsonResponseHandler=new JsonResponseCallbackHandler<T>(typeReference,resultCallback);
  HttpResponseHandler responseHandler=new HttpResponseHandler(requestProvider,resultCallback);
  channel.pipeline().addLast(new ChunkedWriteHandler());
  channel.pipeline().addLast(responseHandler);
  channel.pipeline().addLast(new JsonObjectDecoder());
  channel.pipeline().addLast(jsonResponseHandler);
  HttpRequest request=requestProvider.getHttpRequest(resource);
  if (request instanceof FullHttpRequest) {
    throw new DockerClientException("String_Node_Str");
  }
  request.headers().set(HttpHeaderNames.TRANSFER_ENCODING,HttpHeaderValues.CHUNKED);
  request.headers().remove(HttpHeaderNames.CONTENT_LENGTH);
  channel.write(request);
  channel.write(new ChunkedStream(new BufferedInputStream(body,1024 * 1024),1024 * 1024));
  channel.write(LastHttpContent.EMPTY_LAST_CONTENT);
  channel.flush();
}
Program: 111379
Project: 111379
Buggy source:
public InputStream get(){
  HttpRequestProvider requestProvider=httpGetRequestProvider();
  Channel channel=getChannel();
  ResponseCallback<InputStream> resultCallback=new ResponseCallback<InputStream>();
  initCallback(channel,resultCallback);
  HttpResponseHandler responseHandler=new HttpResponseHandler(requestProvider,resultCallback);
  HttpResponseStreamHandler streamHandler=new HttpResponseStreamHandler(resultCallback);
  channel.pipeline().addLast(responseHandler);
  channel.pipeline().addLast(streamHandler);
  sendRequest(requestProvider,channel);
  return resultCallback.awaitResult();
}

Fixed version (ground truth):
public InputStream get(){
  HttpRequestProvider requestProvider=httpGetRequestProvider();
  Channel channel=getChannel();
  ResponseCallback<InputStream> resultCallback=new ResponseCallback<InputStream>();
  HttpResponseHandler responseHandler=new HttpResponseHandler(requestProvider,resultCallback);
  HttpResponseStreamHandler streamHandler=new HttpResponseStreamHandler(resultCallback);
  channel.pipeline().addLast(responseHandler);
  channel.pipeline().addLast(streamHandler);
  sendRequest(requestProvider,channel);
  return resultCallback.awaitResult();
}
Program: 111381
Project: 111381
Buggy source:
@Test(groups="String_Node_Str") public void execStartAttached() throws Exception {
  String containerName="String_Node_Str" + new SecureRandom().nextInt();
  CreateContainerResponse container=dockerClient.createContainerCmd("String_Node_Str").withCmd("String_Node_Str","String_Node_Str").withName(containerName).exec();
  LOG.info("String_Node_Str",container.toString());
  assertThat(container.getId(),not(isEmptyString()));
  dockerClient.startContainerCmd(container.getId()).exec();
  ExecCreateCmdResponse execCreateCmdResponse=dockerClient.execCreateCmd(container.getId()).withAttachStdout(true).withCmd("String_Node_Str","String_Node_Str").exec();
  dockerClient.execStartCmd(execCreateCmdResponse.getId()).withDetach(false).withTty(true).exec(new ExecStartResultCallback(System.out,System.err));
  InputStream response=dockerClient.copyArchiveFromContainerCmd(container.getId(),"String_Node_Str").exec();
  Boolean bytesAvailable=response.available() > 0;
  assertTrue(bytesAvailable,"String_Node_Str");
  String responseAsString=asString(response);
  assertNotNull(responseAsString);
  assertTrue(responseAsString.length() > 0);
}

Fixed version (ground truth):
@Test(groups="String_Node_Str") public void execStartAttached() throws Exception {
  String containerName="String_Node_Str" + new SecureRandom().nextInt();
  CreateContainerResponse container=dockerClient.createContainerCmd("String_Node_Str").withCmd("String_Node_Str","String_Node_Str").withName(containerName).exec();
  LOG.info("String_Node_Str",container.toString());
  assertThat(container.getId(),not(isEmptyString()));
  dockerClient.startContainerCmd(container.getId()).exec();
  ExecCreateCmdResponse execCreateCmdResponse=dockerClient.execCreateCmd(container.getId()).withAttachStdout(true).withCmd("String_Node_Str","String_Node_Str").exec();
  dockerClient.execStartCmd(execCreateCmdResponse.getId()).withDetach(false).withTty(true).exec(new ExecStartResultCallback(System.out,System.err)).awaitCompletion();
  InputStream response=dockerClient.copyArchiveFromContainerCmd(container.getId(),"String_Node_Str").exec();
  Boolean bytesAvailable=response.available() > 0;
  assertTrue(bytesAvailable,"String_Node_Str");
  String responseAsString=asString(response);
  assertNotNull(responseAsString);
  assertTrue(responseAsString.length() > 0);
}
Program: 111384
Project: 111384
Buggy source:
@Override public void onNext(Frame frame){
  if (frame != null) {
    try {
switch (frame.getStreamType()) {
case STDOUT:
        if (stdout != null) {
          stdout.write(frame.getPayload());
          stdout.flush();
        }
      break;
case STDERR:
    if (stderr != null) {
      stderr.write(frame.getPayload());
      stderr.flush();
    }
  break;
default :
LOGGER.error("String_Node_Str" + frame.getStreamType());
}
}
 catch (IOException e) {
onError(e);
}
}
LOGGER.debug(frame.toString());
}

Fixed version (ground truth):
@Override public void onNext(Frame frame){
  if (frame != null) {
    try {
switch (frame.getStreamType()) {
case STDOUT:
case RAW:
        if (stdout != null) {
          System.err.println(new String(frame.getPayload()));
          stdout.write(frame.getPayload());
          stdout.flush();
        }
      break;
case STDERR:
    if (stderr != null) {
      stderr.write(frame.getPayload());
      stderr.flush();
    }
  break;
default :
LOGGER.error("String_Node_Str" + frame.getStreamType());
}
}
 catch (IOException e) {
onError(e);
}
}
LOGGER.debug(frame.toString());
}
Program: 111385
Project: 111385
Buggy source:
@Override protected AbstractCallbackNotifier<Frame> callbackNotifier(ExecStartCmd command,ResultCallback<Frame> resultCallback){
  WebTarget webTarget=getBaseResource().path("String_Node_Str").resolveTemplate("String_Node_Str",command.getExecId());
  LOGGER.trace("String_Node_Str",webTarget);
  return new POSTCallbackNotifier<Frame>(new FrameStreamProcessor(),resultCallback,webTarget.request().accept(MediaType.APPLICATION_JSON),null);
}

Fixed version (ground truth):
@Override protected AbstractCallbackNotifier<Frame> callbackNotifier(ExecStartCmd command,ResultCallback<Frame> resultCallback){
  WebTarget webTarget=getBaseResource().path("String_Node_Str").resolveTemplate("String_Node_Str",command.getExecId());
  LOGGER.trace("String_Node_Str",webTarget);
  return new POSTCallbackNotifier<Frame>(new FrameStreamProcessor(),resultCallback,webTarget.request().accept(MediaType.APPLICATION_JSON),entity(command,MediaType.APPLICATION_JSON));
}
Program: 111386
Project: 111386
Buggy source:
private Frame decode(){
  if (headerCnt < HEADER_SIZE) {
    int headerCount=read(header,headerCnt,HEADER_SIZE - headerCnt);
    if (headerCount == 0) {
      return null;
    }
    headerCnt+=headerCount;
    if (headerCnt < HEADER_SIZE) {
      return null;
    }
    streamType=streamType(header[0]);
    if (streamType.equals(StreamType.RAW)) {
      return new Frame(streamType,header);
    }
  }
  if (streamType.equals(StreamType.RAW)) {
    if (payloadCnt == 0)     payload=new byte[rawBuffer.readableBytes()];
    int count=read(payload,payloadCnt,rawBuffer.readableBytes());
    if (count == 0) {
      return null;
    }
    payloadCnt=0;
    return new Frame(StreamType.RAW,payload);
  }
 else {
    int payloadSize=((header[4] & 0xff) << 24) + ((header[5] & 0xff) << 16) + ((header[6] & 0xff) << 8)+ (header[7] & 0xff);
    if (payloadCnt == 0) {
      payload=new byte[payloadSize];
    }
    int count=read(payload,payloadCnt,payloadSize - payloadCnt);
    if (count == 0) {
      return null;
    }
    payloadCnt+=count;
    if (payloadCnt < payloadSize) {
      return null;
    }
    headerCnt=0;
    payloadCnt=0;
    return new Frame(streamType,payload);
  }
}

Fixed version (ground truth):
private Frame decode(){
  if (headerCnt < HEADER_SIZE) {
    int headerCount=read(header,headerCnt,HEADER_SIZE - headerCnt);
    if (headerCount == 0) {
      return null;
    }
    headerCnt+=headerCount;
    streamType=streamType(header[0]);
    if (streamType.equals(StreamType.RAW)) {
      return new Frame(streamType,Arrays.copyOf(header,headerCount));
    }
    if (headerCnt < HEADER_SIZE) {
      return null;
    }
  }
  if (streamType.equals(StreamType.RAW)) {
    if (payloadCnt == 0)     payload=new byte[rawBuffer.readableBytes()];
    int count=read(payload,payloadCnt,rawBuffer.readableBytes());
    if (count == 0) {
      return null;
    }
    payloadCnt=0;
    return new Frame(StreamType.RAW,payload);
  }
 else {
    int payloadSize=((header[4] & 0xff) << 24) + ((header[5] & 0xff) << 16) + ((header[6] & 0xff) << 8)+ (header[7] & 0xff);
    if (payloadCnt == 0) {
      payload=new byte[payloadSize];
    }
    int count=read(payload,payloadCnt,payloadSize - payloadCnt);
    if (count == 0) {
      return null;
    }
    payloadCnt+=count;
    if (payloadCnt < payloadSize) {
      return null;
    }
    headerCnt=0;
    payloadCnt=0;
    return new Frame(streamType,payload);
  }
}
Program: 111387
Project: 111387
Buggy source:
@Test(groups="String_Node_Str") public void execStart() throws Exception {
  String containerName="String_Node_Str" + new SecureRandom().nextInt();
  CreateContainerResponse container=dockerClient.createContainerCmd("String_Node_Str").withCmd("String_Node_Str").withName(containerName).exec();
  LOG.info("String_Node_Str",container.toString());
  assertThat(container.getId(),not(isEmptyString()));
  dockerClient.startContainerCmd(container.getId()).exec();
  ExecCreateCmdResponse execCreateCmdResponse=dockerClient.execCreateCmd(container.getId()).withAttachStdout(true).withCmd("String_Node_Str","String_Node_Str").exec();
  dockerClient.execStartCmd(execCreateCmdResponse.getId()).exec(new ExecStartResultCallback(System.out,System.err));
  InputStream response=dockerClient.copyArchiveFromContainerCmd(container.getId(),"String_Node_Str").exec();
  Boolean bytesAvailable=response.available() > 0;
  assertTrue(bytesAvailable,"String_Node_Str");
  String responseAsString=asString(response);
  assertNotNull(responseAsString);
  assertTrue(responseAsString.length() > 0);
}

Fixed version (ground truth):
@Test(groups="String_Node_Str") public void execStart() throws Exception {
  String containerName="String_Node_Str" + new SecureRandom().nextInt();
  CreateContainerResponse container=dockerClient.createContainerCmd("String_Node_Str").withCmd("String_Node_Str").withName(containerName).exec();
  LOG.info("String_Node_Str",container.toString());
  assertThat(container.getId(),not(isEmptyString()));
  dockerClient.startContainerCmd(container.getId()).exec();
  ExecCreateCmdResponse execCreateCmdResponse=dockerClient.execCreateCmd(container.getId()).withAttachStdout(true).withCmd("String_Node_Str","String_Node_Str").exec();
  dockerClient.execStartCmd(execCreateCmdResponse.getId()).exec(new ExecStartResultCallback(System.out,System.err)).awaitCompletion();
  InputStream response=dockerClient.copyArchiveFromContainerCmd(container.getId(),"String_Node_Str").exec();
  Boolean bytesAvailable=response.available() > 0;
  assertTrue(bytesAvailable,"String_Node_Str");
  String responseAsString=asString(response);
  assertNotNull(responseAsString);
  assertTrue(responseAsString.length() > 0);
}
Program: 111390
Project: 111390
Buggy source:
public String getName(){
  return name;
}

Fixed version (ground truth):
@CheckForNull public String getName(){
  return name;
}
Program: 111391
Project: 111391
Buggy source:
public String getDriver(){
  return driver;
}

Fixed version (ground truth):
@CheckForNull public String getDriver(){
  return driver;
}
Program: 111392
Project: 111392
Buggy source:
@JsonIgnore public VolumeRW[] getVolumesRW(){
  return volumesRW == null ? null : volumesRW.getVolumesRW();
}

Fixed version (ground truth):
/** 
 * @deprecated As of {@link RemoteApiVersion#VERSION_1_20}use   {@link #getMounts()} instead
 */
@JsonIgnore @Deprecated public VolumeRW[] getVolumesRW(){
  return volumesRW == null ? null : volumesRW.getVolumesRW();
}
Program: 111393
Project: 111393
Buggy source:
@Override public Binds deserialize(JsonParser jsonParser,DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
  List<Bind> binds=new ArrayList<Bind>();
  ObjectCodec oc=jsonParser.getCodec();
  JsonNode node=oc.readTree(jsonParser);
  for (Iterator<Map.Entry<String,JsonNode>> it=node.fields(); it.hasNext(); ) {
    Map.Entry<String,JsonNode> field=it.next();
    if (!field.getValue().equals(NullNode.getInstance())) {
      binds.add(Bind.parse(field.getKey()));
    }
  }
  return new Binds(binds.toArray(new Bind[0]));
}

Fixed version (ground truth):
@Override public Binds deserialize(JsonParser jsonParser,DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
  List<Bind> binds=new ArrayList<Bind>();
  ObjectCodec oc=jsonParser.getCodec();
  JsonNode node=oc.readTree(jsonParser);
  for (Iterator<JsonNode> it=node.elements(); it.hasNext(); ) {
    JsonNode field=it.next();
    binds.add(Bind.parse(field.asText()));
  }
  return new Binds(binds.toArray(new Bind[0]));
}
Program: 111394
Project: 111394
Buggy source:
/** 
 * Asserts that   {@link InspectContainerResponse#getVolumes()} (<code>.Volumes</code>) has {@link VolumeBind}s for the given   {@link Volume}s
 */
public static void assertContainerHasVolumes(InspectContainerResponse inspectContainerResponse,Volume... expectedVolumes){
  List<Volume> volumes=new ArrayList<Volume>();
  VolumeBind[] volumeBinds=inspectContainerResponse.getVolumes();
  if (volumeBinds != null) {
    for (    VolumeBind bind : volumeBinds) {
      volumes.add(new Volume(bind.getContainerPath()));
    }
  }
  assertThat(volumes,contains(expectedVolumes));
}

Fixed version (ground truth):
/** 
 * Asserts that   {@link InspectContainerResponse#getVolumes()} (<code>.Volumes</code>) has {@link VolumeBind}s for the given   {@link Volume}s
 */
public static void assertContainerHasVolumes(InspectContainerResponse inspectContainerResponse,Volume... expectedVolumes){
  List<Volume> volumes=new ArrayList<Volume>();
  List<Mount> mounts=inspectContainerResponse.getMounts();
  if (mounts != null) {
    for (    Mount mount : mounts) {
      volumes.add(mount.getDestination());
    }
  }
  assertThat(volumes,containsInAnyOrder(expectedVolumes));
}
Program: 111395
Project: 111395
Buggy source:
@Test public void createContainerWithReadOnlyVolume() throws DockerException {
  Volume volume=new Volume("String_Node_Str");
  CreateContainerResponse container=dockerClient.createContainerCmd("String_Node_Str").withVolumes(volume).withCmd("String_Node_Str").exec();
  LOG.info("String_Node_Str",container.toString());
  assertThat(container.getId(),not(isEmptyString()));
  InspectContainerResponse inspectContainerResponse=dockerClient.inspectContainerCmd(container.getId()).exec();
  LOG.info("String_Node_Str",inspectContainerResponse.getConfig().getVolumes());
  assertThat(inspectContainerResponse.getConfig().getVolumes().keySet(),contains("String_Node_Str"));
  assertThat(Arrays.asList(inspectContainerResponse.getVolumesRW()),contains(new VolumeRW(volume)));
}

Fixed version (ground truth):
@Test public void createContainerWithReadOnlyVolume() throws DockerException {
  Volume volume=new Volume("String_Node_Str");
  CreateContainerResponse container=dockerClient.createContainerCmd("String_Node_Str").withVolumes(volume).withCmd("String_Node_Str").exec();
  LOG.info("String_Node_Str",container.toString());
  assertThat(container.getId(),not(isEmptyString()));
  InspectContainerResponse inspectContainerResponse=dockerClient.inspectContainerCmd(container.getId()).exec();
  LOG.info("String_Node_Str",inspectContainerResponse.getConfig().getVolumes());
  assertThat(inspectContainerResponse.getConfig().getVolumes().keySet(),contains("String_Node_Str"));
  assertEquals(inspectContainerResponse.getMounts().get(0).getDestination(),volume);
}
Program: 111396
Project: 111396
Buggy source:
@Test public void createContainerWithVolume() throws DockerException {
  Volume volume=new Volume("String_Node_Str");
  CreateContainerResponse container=dockerClient.createContainerCmd("String_Node_Str").withVolumes(volume).withCmd("String_Node_Str").exec();
  LOG.info("String_Node_Str",container.toString());
  assertThat(container.getId(),not(isEmptyString()));
  InspectContainerResponse inspectContainerResponse=dockerClient.inspectContainerCmd(container.getId()).exec();
  LOG.info("String_Node_Str",inspectContainerResponse.getConfig().getVolumes());
  assertThat(inspectContainerResponse.getConfig().getVolumes().keySet(),contains("String_Node_Str"));
  assertThat(inspectContainerResponse.getVolumesRW(),hasItemInArray(new VolumeRW(volume,AccessMode.rw)));
}

Fixed version (ground truth):
@Test public void createContainerWithVolume() throws DockerException {
  Volume volume=new Volume("String_Node_Str");
  CreateContainerResponse container=dockerClient.createContainerCmd("String_Node_Str").withVolumes(volume).withCmd("String_Node_Str").exec();
  LOG.info("String_Node_Str",container.toString());
  assertThat(container.getId(),not(isEmptyString()));
  InspectContainerResponse inspectContainerResponse=dockerClient.inspectContainerCmd(container.getId()).exec();
  LOG.info("String_Node_Str",inspectContainerResponse.getConfig().getVolumes());
  assertThat(inspectContainerResponse.getConfig().getVolumes().keySet(),contains("String_Node_Str"));
  assertEquals(inspectContainerResponse.getMounts().get(0).getDestination(),volume);
  assertEquals(inspectContainerResponse.getMounts().get(0).getMode(),AccessMode.rw);
  assertTrue(inspectContainerResponse.getMounts().get(0).getRW());
}