Program: 144638
Project: 144638
Buggy source:
@Override public void onRead(final SelectionKey key) throws Exception {
  HttpRequest req1=null;
  if (key.attachment() instanceof Object[]) {
    Object[] ar=(Object[])key.attachment();
    for (    Object o : ar) {
      if (o instanceof Rfc822HeaderState) {
        req1=((Rfc822HeaderState)o).$req();
      }
    }
  }
  final HttpRequest request=req1;
  if (request == null) {
    Errors.$500(key);
    return;
  }
  final String path=request.path();
  final Place place=placeFactory.route(path.substring(1));
  if (place == null) {
    Errors.$404(key,path);
    return;
  }
  final Presenter presenter=presenterFactory.getPresenterInstance(place);
  if (presenter == null) {
    Errors.$404(key,path);
    return;
  }
  WEBAPP_THREADS.submit(new Runnable(){
    public void run(){
      final ByteBuffer payload;
      try {
        final View<?>[] viewWrapper=new View[1];
        presenter.go(new AcceptsView(){
          @Override public void setView(          View view){
            viewWrapper[0]=view;
          }
        }
,place);
        final String response=viewWrapper[0] == null ? null : viewWrapper[0].asSafeHtml() == null ? null : viewWrapper[0].asSafeHtml().asString();
        if (response == null) {
          return;
        }
        String title="String_Node_Str";
        String script="String_Node_Str" + compiledServer + "String_Node_Str";
        int length=APP_RESPONSE_WRAPPER_SIZE + response.length() + title.length()+ script.length();
        ByteBuffer resp=request.$res().status(HttpStatus.$200).headerString(HttpHeaders.Content$2dType,"String_Node_Str").headerString(HttpHeaders.Content$2dLength,String.valueOf(length)).as(ByteBuffer.class);
        int needed=resp.rewind().limit() + length;
        payload=(ByteBuffer)ByteBuffer.allocate(needed);
        payload.put(resp);
        payload.put(APP_RESPONSE_TEMPLATE[0]);
        payload.put(title.getBytes());
        payload.put(APP_RESPONSE_TEMPLATE[1]);
        payload.put(HttpMethod.UTF8.encode(response));
        payload.put(APP_RESPONSE_TEMPLATE[2]);
        payload.put(script.getBytes());
        payload.put(APP_RESPONSE_TEMPLATE[3]).rewind();
      }
 catch (      Exception ex) {
        ex.printStackTrace();
        Errors.$500(key);
        return;
      }
      key.attach(new Impl(){
        @Override public void onWrite(        SelectionKey key) throws Exception {
          ((SocketChannel)key.channel()).write(payload);
          if (!payload.hasRemaining()) {
            key.selector().wakeup();
            key.interestOps(SelectionKey.OP_READ).attach(null);
          }
        }
      }
);
      key.interestOps(SelectionKey.OP_WRITE);
    }
  }
);
}

Fixed version (ground truth):
@Override public void onRead(final SelectionKey key) throws Exception {
  HttpRequest req1=null;
  if (key.attachment() instanceof Object[]) {
    Object[] ar=(Object[])key.attachment();
    for (    Object o : ar) {
      if (o instanceof Rfc822HeaderState) {
        req1=((Rfc822HeaderState)o).$req();
      }
    }
  }
  final HttpRequest request=req1;
  if (request == null) {
    Errors.$500(key);
    return;
  }
  final String path=request.path();
  final Place place=placeFactory.route(path.substring(1));
  if (place == null) {
    Errors.$404(key,path);
    return;
  }
  final Presenter presenter=presenterFactory.getPresenterInstance(place);
  if (presenter == null) {
    Errors.$404(key,path);
    return;
  }
  key.interestOps(SelectionKey.OP_READ).attach(null);
  WEBAPP_THREADS.submit(new Runnable(){
    public void run(){
      final ByteBuffer payload;
      try {
        final View<?>[] viewWrapper=new View[1];
        presenter.go(new AcceptsView(){
          @Override public void setView(          View view){
            viewWrapper[0]=view;
          }
        }
,place);
        final String response=viewWrapper[0] == null ? null : viewWrapper[0].asSafeHtml() == null ? null : viewWrapper[0].asSafeHtml().asString();
        if (response == null) {
          return;
        }
        String title="String_Node_Str";
        String script="String_Node_Str" + compiledServer + "String_Node_Str";
        int length=APP_RESPONSE_WRAPPER_SIZE + response.length() + title.length()+ script.length();
        ByteBuffer resp=request.$res().status(HttpStatus.$200).headerString(HttpHeaders.Content$2dType,"String_Node_Str").headerString(HttpHeaders.Content$2dLength,String.valueOf(length)).as(ByteBuffer.class);
        int needed=resp.rewind().limit() + length;
        payload=(ByteBuffer)ByteBuffer.allocate(needed);
        payload.put(resp);
        payload.put(APP_RESPONSE_TEMPLATE[0]);
        payload.put(title.getBytes());
        payload.put(APP_RESPONSE_TEMPLATE[1]);
        payload.put(HttpMethod.UTF8.encode(response));
        payload.put(APP_RESPONSE_TEMPLATE[2]);
        payload.put(script.getBytes());
        payload.put(APP_RESPONSE_TEMPLATE[3]).rewind();
      }
 catch (      Exception ex) {
        ex.printStackTrace();
        Errors.$500(key);
        return;
      }
      key.attach(new Impl(){
        @Override public void onWrite(        SelectionKey key) throws Exception {
          ((SocketChannel)key.channel()).write(payload);
          if (!payload.hasRemaining()) {
            key.selector().wakeup();
            key.interestOps(SelectionKey.OP_READ).attach(null);
          }
        }
      }
);
      key.interestOps(SelectionKey.OP_WRITE);
    }
  }
);
}