Program: 160706
Project: 160706
Buggy source:
public RestxSpecTape doRecord(final Optional<String> recordPath,final Optional<String> recordTitle) throws IOException {
  specTape.set(this);
  for (  RestxSpecRecorder.GivenRecorder recorder : recorders) {
    givenTapes.add(recorder.recordIn(givens));
  }
  DateTime now=DateTime.now();
  givens.put(GivenTime.class.getSimpleName() + "String_Node_Str",new GivenTime(now));
  DateTimeUtils.setCurrentMillisFixed(now.getMillis());
  recordedSpec.setRecordTime(now);
  Stopwatch stopwatch=new Stopwatch().start();
  System.out.print("String_Node_Str");
  final String method=restxRequest.getHttpMethod();
  final String path=restxRequest.getRestxUri().substring(1);
  final ImmutableMap<String,String> cookies=sessionFilter.toCookiesMap(sessionFilter.buildContextFromRequest(restxRequest));
  final byte[] requestBody=ByteStreams.toByteArray(restxRequest.getContentStream());
  System.out.println("String_Node_Str" + method + "String_Node_Str"+ path+ "String_Node_Str"+ requestBody.length+ "String_Node_Str"+ stopwatch.stop());
  recordedSpec.setCapturedRequestSize(requestBody.length);
  id=specId.incrementAndGet();
  final String title=recordTitle.or(buildTitle(id,method,path));
  final String specPath=storage.buildPath(recordPath,title);
  recordingRequest=new RestxRequestWrapper(restxRequest){
    @Override public InputStream getContentStream() throws IOException {
      return new ByteArrayInputStream(requestBody);
    }
  }
;
  recordingResponse=new RestxResponseWrapper(restxResponse){
    private Stopwatch stopwatch=new Stopwatch();
    private ByteArrayOutputStream baos;
    private PrintWriter realWriter;
    private PrintWriter writer;
    private OutputStream realOS;
    public HttpStatus status=HttpStatus.OK;
    @Override public PrintWriter getWriter() throws IOException {
      if (writer == null) {
        if (recordPath.isPresent()) {
          super.setHeader("String_Node_Str",specPath);
        }
        System.out.print("String_Node_Str");
        stopwatch.start();
        realWriter=super.getWriter();
        writer=new PrintWriter(baos=new ByteArrayOutputStream());
      }
      return writer;
    }
    @Override public OutputStream getOutputStream() throws IOException {
      if (recordPath.isPresent()) {
        super.setHeader("String_Node_Str",specPath);
      }
      System.out.print("String_Node_Str");
      stopwatch.start();
      realOS=super.getOutputStream();
      return baos=new ByteArrayOutputStream();
    }
    @Override public HttpStatus getStatus(){
      return status;
    }
    @Override public RestxResponse setStatus(    HttpStatus i){
      super.setStatus(i);
      status=i;
      return null;
    }
    @Override public void close() throws Exception {
      System.out.println("String_Node_Str" + baos.size() + "String_Node_Str"+ stopwatch.stop());
      if (realWriter != null) {
        CharStreams.copy(CharStreams.asCharSource(baos.toString(Charsets.UTF_8.name())).openStream(),realWriter);
      }
 else       if (realOS != null) {
        ByteStreams.copy(ByteStreams.asByteSource(baos.toByteArray()).openStream(),realOS);
      }
      super.close();
      RestxSpec restxSpec=new RestxSpec(specPath,title,ImmutableList.copyOf(givens.values()),ImmutableList.<When>of(new WhenHttpRequest(method,path,cookies,new String(requestBody,Charsets.UTF_8),new ThenHttpResponse(status.getCode(),baos.toString(Charsets.UTF_8.name())))));
      System.out.println("String_Node_Str" + restxSpec + "String_Node_Str"+ "String_Node_Str");
      recordedSpec.setId(id).setSpec(restxSpec).setMethod(method).setPath(path).setDuration(new Duration(recordedSpec.getRecordTime(),new DateTime(System.currentTimeMillis()))).setCapturedResponseSize(baos.size());
    }
  }
;
  return this;
}

Fixed version (ground truth):
public RestxSpecTape doRecord(final Optional<String> recordPath,final Optional<String> recordTitle) throws IOException {
  specTape.set(this);
  for (  RestxSpecRecorder.GivenRecorder recorder : recorders) {
    givenTapes.add(recorder.recordIn(givens));
  }
  DateTime now=DateTime.now();
  givens.put(GivenTime.class.getSimpleName() + "String_Node_Str",new GivenTime(now));
  DateTimeUtils.setCurrentMillisFixed(now.getMillis());
  recordedSpec.setRecordTime(now);
  Stopwatch stopwatch=new Stopwatch().start();
  System.out.print("String_Node_Str");
  final String method=restxRequest.getHttpMethod();
  final String path=restxRequest.getRestxUri().substring(1);
  final ImmutableMap<String,String> cookies=sessionFilter.toCookiesMap(sessionFilter.buildContextFromRequest(restxRequest));
  final byte[] requestBody=ByteStreams.toByteArray(restxRequest.getContentStream());
  System.out.println("String_Node_Str" + method + "String_Node_Str"+ path+ "String_Node_Str"+ requestBody.length+ "String_Node_Str"+ stopwatch.stop());
  recordedSpec.setCapturedRequestSize(requestBody.length);
  id=specId.incrementAndGet();
  final String title=recordTitle.or(buildTitle(id,method,path));
  final String specPath=storage.buildPath(recordPath,title);
  recordingRequest=new RestxRequestWrapper(restxRequest){
    @Override public InputStream getContentStream() throws IOException {
      return new ByteArrayInputStream(requestBody);
    }
  }
;
  recordingResponse=new RestxResponseWrapper(restxResponse){
    private Stopwatch stopwatch=new Stopwatch();
    private ByteArrayOutputStream baos;
    private PrintWriter realWriter;
    private PrintWriter writer;
    private OutputStream realOS;
    public HttpStatus status=HttpStatus.OK;
    @Override public PrintWriter getWriter() throws IOException {
      if (writer == null) {
        if (recordPath.isPresent()) {
          super.setHeader("String_Node_Str",specPath);
        }
        System.out.print("String_Node_Str");
        stopwatch.start();
        realWriter=super.getWriter();
        writer=new PrintWriter(baos=new ByteArrayOutputStream());
      }
      return writer;
    }
    @Override public OutputStream getOutputStream() throws IOException {
      if (recordPath.isPresent()) {
        super.setHeader("String_Node_Str",specPath);
      }
      System.out.print("String_Node_Str");
      stopwatch.start();
      realOS=super.getOutputStream();
      return baos=new ByteArrayOutputStream();
    }
    @Override public HttpStatus getStatus(){
      return status;
    }
    @Override public RestxResponse setStatus(    HttpStatus i){
      super.setStatus(i);
      status=i;
      return null;
    }
    @Override public void close() throws Exception {
      if (writer != null) {
        writer.flush();
      }
      System.out.println("String_Node_Str" + baos.size() + "String_Node_Str"+ stopwatch.stop());
      if (realWriter != null) {
        CharStreams.copy(CharStreams.asCharSource(baos.toString(Charsets.UTF_8.name())).openStream(),realWriter);
      }
 else       if (realOS != null) {
        ByteStreams.copy(ByteStreams.asByteSource(baos.toByteArray()).openStream(),realOS);
      }
      super.close();
      Iterator<AutoCloseable> iterator=givenTapes.iterator();
      while (iterator.hasNext()) {
        AutoCloseable givenTape=iterator.next();
        try {
          givenTape.close();
          iterator.remove();
        }
 catch (        Exception e) {
        }
      }
      DateTimeUtils.setCurrentMillisSystem();
      RestxSpec restxSpec=new RestxSpec(specPath,title,ImmutableList.copyOf(givens.values()),ImmutableList.<When>of(new WhenHttpRequest(method,path,cookies,new String(requestBody,Charsets.UTF_8),new ThenHttpResponse(status.getCode(),baos.toString(Charsets.UTF_8.name())))));
      System.out.println("String_Node_Str" + restxSpec + "String_Node_Str"+ "String_Node_Str");
      recordedSpec.setId(id).setSpec(restxSpec).setMethod(method).setPath(path).setDuration(new Duration(recordedSpec.getRecordTime(),DateTime.now())).setCapturedResponseSize(baos.size());
    }
  }
;
  return this;
}