nus-yam/ex-repair huggingface dataset:
Program: 35745
Project: 35745
Buggy source:
Node(int cost,Net.Wire wire,Node parent){
  this.cost=cost;
  this.wire=wire;
  this.parent=parent;
}

Fixed version (ground truth):
Node(double cost,Net.Wire wire,Node parent){
  this.cost=cost;
  this.wire=wire;
  this.parent=parent;
  if (wire.isRepeater) {
    lengthSinceLastRepeater=0;
  }
 else   if (parent != null) {
    lengthSinceLastRepeater=parent.lengthSinceLastRepeater + 1;
  }
}
Program: 35748
Project: 35748
Buggy source:
/** 
 * Place wires and blocks in buffer and net from a solution path that's benn found. This skips the first and last nodes in the node hierarchy, since they refer to the source and destination (respectively), which are merely markers rather than places where wire should be physically placed.
 */
private void commitRoute(BlockBuffer buffer,Net net,Node solution,boolean skipFirst){
  log("String_Node_Str");
  for (Node n=solution; n != null && n.parent != null; n=n.parent) {
    if (skipFirst) {
      skipFirst=false;
      continue;
    }
    log("String_Node_Str" + getCoordText(n.wire.x,n.wire.y,n.wire.z));
    net.addWire(n.wire);
    if (buffer.getBlock(n.wire.x,n.wire.y - 1,n.wire.z).block == Blocks.air) {
      buffer.setBlock(n.wire.x,n.wire.y - 1,n.wire.z,Blocks.stone,0);
    }
    if (n.wire.isRepeater) {
      buffer.setBlock(n.wire.x,n.wire.y,n.wire.z,Blocks.unpowered_repeater,0);
    }
 else {
      buffer.setBlock(n.wire.x,n.wire.y,n.wire.z,Blocks.redstone_wire,0);
    }
  }
}

Fixed version (ground truth):
/** 
 * Place wires and blocks in buffer and net from a solution path that's benn found. This skips the first and last nodes in the node hierarchy, since they refer to the source and destination (respectively), which are merely markers rather than places where wire should be physically placed.
 */
private void commitRoute(BlockBuffer buffer,Net net,Node solution,boolean skipFirst){
  log("String_Node_Str");
  for (Node n=solution; n != null && n.parent != null; n=n.parent) {
    if (skipFirst) {
      skipFirst=false;
      continue;
    }
    log("String_Node_Str" + getCoordText(n.wire.x,n.wire.y,n.wire.z));
    net.addWire(n.wire);
    if (buffer.getBlock(n.wire.x,n.wire.y - 1,n.wire.z).block == Blocks.air) {
      buffer.setBlock(n.wire.x,n.wire.y - 1,n.wire.z,Blocks.stone,0);
    }
    if (n.wire.isRepeater) {
      int meta=-1;
      if (n.parent != null) {
        if (n.wire.x > n.parent.wire.x) {
          meta=1;
        }
 else         if (n.wire.x < n.parent.wire.x) {
          meta=3;
        }
 else         if (n.wire.z < n.parent.wire.z) {
          meta=0;
        }
 else         if (n.wire.z > n.parent.wire.z) {
          meta=2;
        }
      }
      if (meta == -1) {
        log2("String_Node_Str");
      }
      buffer.setBlock(n.wire.x,n.wire.y,n.wire.z,Blocks.unpowered_repeater,meta);
    }
 else {
      buffer.setBlock(n.wire.x,n.wire.y,n.wire.z,Blocks.redstone_wire,0);
    }
  }
}
Program: 35750
Project: 35750
Buggy source:
private long getCoordinateHash(BlockBuffer buffer,int x,int y,int z){
  long hash=x;
  hash*=buffer.getSizeX();
  hash+=y;
  hash*=buffer.getSizeY();
  hash+=z;
  return hash;
}

Fixed version (ground truth):
private long getCoordinateHash(BlockBuffer buffer,int x,int y,int z){
  long hash=x;
  hash*=buffer.getSizeY();
  hash+=y;
  hash*=buffer.getSizeZ();
  hash+=z;
  return hash;
}
Program: 35753
Project: 35753
Buggy source:
/** 
 * Place wires and blocks in buffer and net from a solution path that's benn found. This skips the first and last nodes in the node hierarchy, since they refer to the source and destination (respectively), which are merely markers rather than places where wire should be physically placed.
 */
private void commitRoute(BlockBuffer buffer,Net net,Node solution){
  log("String_Node_Str");
  for (Node n=solution.parent; n != null && n.parent != null; n=n.parent) {
    log("String_Node_Str" + getCoordText(n.wire.x,n.wire.y,n.wire.z));
    net.addWire(n.wire);
    if (buffer.getBlock(n.wire.x,n.wire.y - 1,n.wire.z).block == Blocks.air) {
      buffer.setBlock(n.wire.x,n.wire.y - 1,n.wire.z,Blocks.stone,0);
    }
    if (n.wire.isRepeater) {
      buffer.setBlock(n.wire.x,n.wire.y,n.wire.z,Blocks.unpowered_repeater,0);
    }
 else {
      buffer.setBlock(n.wire.x,n.wire.y,n.wire.z,Blocks.redstone_wire,0);
    }
  }
}

Fixed version (ground truth):
/** 
 * Place wires and blocks in buffer and net from a solution path that's benn found. This skips the first and last nodes in the node hierarchy, since they refer to the source and destination (respectively), which are merely markers rather than places where wire should be physically placed.
 */
private void commitRoute(BlockBuffer buffer,Net net,Node solution,boolean skipFirst){
  log("String_Node_Str");
  for (Node n=solution; n != null && n.parent != null; n=n.parent) {
    if (skipFirst) {
      skipFirst=false;
      continue;
    }
    log("String_Node_Str" + getCoordText(n.wire.x,n.wire.y,n.wire.z));
    net.addWire(n.wire);
    if (buffer.getBlock(n.wire.x,n.wire.y - 1,n.wire.z).block == Blocks.air) {
      buffer.setBlock(n.wire.x,n.wire.y - 1,n.wire.z,Blocks.stone,0);
    }
    if (n.wire.isRepeater) {
      buffer.setBlock(n.wire.x,n.wire.y,n.wire.z,Blocks.unpowered_repeater,0);
    }
 else {
      buffer.setBlock(n.wire.x,n.wire.y,n.wire.z,Blocks.redstone_wire,0);
    }
  }
}
Program: 35754
Project: 35754
Buggy source:
/** 
 * It looks like servers like Tomcat will decode the stream so we should not forward it. It is not described in servlet API specification but according to RFC 2616 it is mandatory for servers: "All HTTP/1.1 applications MUST be able to receive and decode the chunked transfer-coding" (<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6.1">RFC 2616 sec 3.6.1</a>) In this test, we send a POST request with a chunked body. The application server will decode it and the target server will receive the data unchunked. If EsiGate was forwarding the "Transfer-Encoding" header, it would break the request as it is not chunked anymore when it arrives to final destination.
 */
public void testTransferEncoding(){
}

Fixed version (ground truth):
/** 
 * It looks like servers like Tomcat will decode the stream so we should not forward it. It is not described in servlet API specification but according to RFC 2616 it is mandatory for servers: "All HTTP/1.1 applications MUST be able to receive and decode the chunked transfer-coding" (<a href= "http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6.1">RFC 2616 sec 3.6.1</a>) In this test, we send a POST request with a chunked body. The application server will decode it and the target server will receive the data unchunked. If EsiGate was forwarding the "Transfer-Encoding" header, it would break the request as it is not chunked anymore when it arrives to final destination.
 */
public void testTransferEncoding(){
}
Program: 35755
Project: 35755
Buggy source:
HttpServletRequestEntity(HttpServletRequest request){
  this.request=request;
  String contentLengthHeader=request.getHeader(HttpHeaders.CONTENT_LENGTH);
  if (contentLengthHeader != null) {
    length=Long.parseLong(contentLengthHeader);
  }
 else {
    length=-1;
  }
  String contentTypeHeader=request.getContentType();
  if (contentTypeHeader != null) {
    this.setContentType(contentTypeHeader);
  }
  String contentEncodingHeader=request.getCharacterEncoding();
  if (contentEncodingHeader != null) {
    this.setContentEncoding(contentEncodingHeader);
  }
}

Fixed version (ground truth):
HttpServletRequestEntity(HttpServletRequest request){
  this.request=request;
  String contentLengthHeader=request.getHeader(HttpHeaders.CONTENT_LENGTH);
  if (contentLengthHeader != null) {
    length=Long.parseLong(contentLengthHeader);
  }
 else {
    length=-1;
  }
  String contentTypeHeader=request.getHeader(HttpHeaders.CONTENT_TYPE);
  if (contentTypeHeader != null) {
    this.setContentType(contentTypeHeader);
  }
  String contentEncodingHeader=request.getHeader(HttpHeaders.CONTENT_ENCODING);
  if (contentEncodingHeader != null) {
    this.setContentEncoding(contentEncodingHeader);
  }
}
Program: 35756
Project: 35756
Buggy source:
@Override public void render(DriverRequest originalRequest,String content,Writer out) throws IOException, HttpErrorPage {
  if (name != null) {
    LOG.debug("String_Node_Str",name,page);
  }
  this.out=out;
  if (content == null) {
    return;
  }
  StringBuilder contentWithoutComments=new StringBuilder(Parameters.DEFAULT_BUFFER_SIZE);
  parserComments.setHttpRequest(originalRequest);
  parserComments.parse(content,contentWithoutComments);
  parser.setHttpRequest(originalRequest);
  parser.parse(contentWithoutComments,this);
  if (name != null && !this.found) {
    throw new HttpErrorPage(HttpStatus.SC_BAD_GATEWAY,"String_Node_Str" + name + "String_Node_Str","String_Node_Str" + name + "String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void render(DriverRequest originalRequest,String content,Writer pOut) throws IOException, HttpErrorPage {
  if (name != null) {
    LOG.debug("String_Node_Str",name,page);
  }
  this.out=pOut;
  if (content == null) {
    return;
  }
  StringBuilder contentWithoutComments=new StringBuilder(Parameters.DEFAULT_BUFFER_SIZE);
  parserComments.setHttpRequest(originalRequest);
  parserComments.parse(content,contentWithoutComments);
  parser.setHttpRequest(originalRequest);
  parser.parse(contentWithoutComments,this);
  if (name != null && !this.found) {
    throw new HttpErrorPage(HttpStatus.SC_BAD_GATEWAY,"String_Node_Str" + name + "String_Node_Str","String_Node_Str" + name + "String_Node_Str");
  }
}
Program: 35757
Project: 35757
Buggy source:
public String getAttribute(String name){
  return attributes.get(name);
}

Fixed version (ground truth):
public String getAttribute(String pName){
  return attributes.get(pName);
}
Program: 35758
Project: 35758
Buggy source:
public String getAttribute(String name){
  return attributes.get(name);
}

Fixed version (ground truth):
public String getAttribute(String pName){
  return attributes.get(pName);
}
Program: 35759
Project: 35759
Buggy source:
@Override public HttpClientHelperBuilder setDriver(Driver driver){
  this.driver=driver;
  return this;
}

Fixed version (ground truth):
@Override public HttpClientHelperBuilder setDriver(Driver pDriver){
  this.driver=pDriver;
  return this;
}
Program: 35760
Project: 35760
Buggy source:
@Override public HttpClientHelperBuilder setProperties(Properties properties){
  this.properties=properties;
  return this;
}

Fixed version (ground truth):
@Override public HttpClientHelperBuilder setProperties(Properties pProperties){
  this.properties=pProperties;
  return this;
}
Program: 35761
Project: 35761
Buggy source:
public HttpClientHelperBuilder setCookieManager(CookieManager cookieManager){
  this.cookieManager=cookieManager;
  return this;
}

Fixed version (ground truth):
public HttpClientHelperBuilder setCookieManager(CookieManager pCookieManager){
  this.cookieManager=pCookieManager;
  return this;
}
Program: 35762
Project: 35762
Buggy source:
public HttpClientHelperBuilder setConnectionManager(HttpClientConnectionManager connectionManager){
  this.connectionManager=connectionManager;
  return this;
}

Fixed version (ground truth):
public HttpClientHelperBuilder setConnectionManager(HttpClientConnectionManager pConnectionManager){
  this.connectionManager=pConnectionManager;
  return this;
}
Program: 35763
Project: 35763
Buggy source:
@Override public HttpClientHelperBuilder setEventManager(EventManager eventManager){
  this.eventManager=eventManager;
  return this;
}

Fixed version (ground truth):
@Override public HttpClientHelperBuilder setEventManager(EventManager pEventManager){
  this.eventManager=pEventManager;
  return this;
}
Program: 35764
Project: 35764
Buggy source:
/** 
 * Applies the replace rules to the final String to be rendered and returns it. If there is no replace rule, returns the original string.
 * @param charSequence The original charSequence to apply the replacements to
 * @param replaceRules the replace rules
 * @return the result of the replace rules
 */
private CharSequence replace(CharSequence charSequence,Map<String,String> replaceRules){
  CharSequence result=charSequence;
  if (replaceRules != null && replaceRules.size() > 0) {
    for (    Entry<String,String> replaceRule : replaceRules.entrySet()) {
      result=Pattern.compile(replaceRule.getKey()).matcher(result).replaceAll(replaceRule.getValue());
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Applies the replace rules to the final String to be rendered and returns it. If there is no replace rule, returns the original string.
 * @param charSequence The original charSequence to apply the replacements to
 * @param replaceRules the replace rules
 * @return the result of the replace rules
 */
private CharSequence replace(CharSequence charSequence,Map<String,String> pReplaceRules){
  CharSequence result=charSequence;
  if (pReplaceRules != null && pReplaceRules.size() > 0) {
    for (    Entry<String,String> replaceRule : pReplaceRules.entrySet()) {
      result=Pattern.compile(replaceRule.getKey()).matcher(result).replaceAll(replaceRule.getValue());
    }
  }
  return result;
}
Program: 35765
Project: 35765
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override public void render(DriverRequest httpRequest,String content,Writer out) throws IOException, HttpErrorPage {
  LOG.debug("String_Node_Str" + name + "String_Node_Str"+ page);
  this.out=out;
  if (content == null) {
    return;
  }
  if (name == null) {
    out.write(content);
  }
 else {
    parser.parse(content,this);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
@Override public void render(DriverRequest httpRequest,String content,Writer pOut) throws IOException, HttpErrorPage {
  LOG.debug("String_Node_Str" + name + "String_Node_Str"+ page);
  this.out=pOut;
  if (content == null) {
    return;
  }
  if (name == null) {
    out.write(content);
  }
 else {
    parser.parse(content,this);
  }
}
Program: 35766
Project: 35766
Buggy source:
public String getParam(String name){
  return params.get(name);
}

Fixed version (ground truth):
public String getParam(String pName){
  return params.get(pName);
}
Program: 35767
Project: 35767
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override public void render(DriverRequest httpRequest,String content,Writer out) throws IOException, HttpErrorPage {
  LOG.debug("String_Node_Str" + name + "String_Node_Str"+ page);
  this.out=out;
  if (content == null) {
    if (params != null) {
      for (      String value : params.values()) {
        out.write(value);
      }
    }
  }
 else {
    parser.parse(content,this);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
@Override public void render(DriverRequest httpRequest,String content,Writer pOut) throws IOException, HttpErrorPage {
  LOG.debug("String_Node_Str" + name + "String_Node_Str"+ page);
  this.out=pOut;
  if (content == null) {
    if (params != null) {
      for (      String value : params.values()) {
        out.write(value);
      }
    }
  }
 else {
    parser.parse(content,this);
  }
}
Program: 35768
Project: 35768
Buggy source:
@Override public void doFilter(ServletRequest request,ServletResponse response,FilterChain chain) throws IOException, ServletException {
  HttpServletRequest httpServletRequest=(HttpServletRequest)request;
  HttpServletResponse httpServletResponse=(HttpServletResponse)response;
  String relUrl=httpServletRequest.getRequestURI();
  HttpServletMediator mediator=new HttpServletMediator(httpServletRequest,httpServletResponse,config.getServletContext());
  for (int i=0; i < mappings.length; i++) {
    if (mappings[i].matcher(relUrl).matches()) {
      LOG.debug("String_Node_Str" + relUrl);
      try {
        providers[i].proxy(relUrl,mediator.getHttpRequest(),new EsiRenderer());
      }
 catch (      HttpErrorPage e) {
        mediator.sendResponse(e.getHttpResponse());
      }
      return;
    }
  }
  LOG.debug("String_Node_Str" + relUrl);
  ResponseCapturingWrapper wrappedResponse=new ResponseCapturingWrapper(httpServletResponse);
  chain.doFilter(httpServletRequest,wrappedResponse);
  String result=wrappedResponse.getResult();
  if (result != null) {
    try {
      new EsiRenderer().render(mediator.getHttpRequest(),result,response.getWriter());
    }
 catch (    HttpErrorPage e) {
      mediator.sendResponse(e.getHttpResponse());
    }
  }
}

Fixed version (ground truth):
@Override public void doFilter(ServletRequest request,ServletResponse response,FilterChain chain) throws IOException, ServletException {
  HttpServletRequest httpServletRequest=(HttpServletRequest)request;
  HttpServletResponse httpServletResponse=(HttpServletResponse)response;
  String relUrl=httpServletRequest.getRequestURI();
  HttpServletMediator mediator=new HttpServletMediator(httpServletRequest,httpServletResponse,config.getServletContext());
  for (int i=0; i < mappings.length; i++) {
    if (mappings[i].matcher(relUrl).matches()) {
      LOG.debug("String_Node_Str" + relUrl);
      try {
        providers[i].proxy(relUrl,mediator.getHttpRequest(),new EsiRenderer());
      }
 catch (      HttpErrorPage e) {
        mediator.sendResponse(e.getHttpResponse());
      }
      return;
    }
  }
  LOG.debug("String_Node_Str" + relUrl);
  ResponseCapturingWrapper wrappedResponse=new ResponseCapturingWrapper(httpServletResponse);
  chain.doFilter(httpServletRequest,wrappedResponse);
  String result=wrappedResponse.getResult();
  StringWriter stringWriter=new StringWriter();
  if (result != null) {
    try {
      new EsiRenderer().render(mediator.getHttpRequest(),result,stringWriter);
      response.getWriter().write(stringWriter.toString());
    }
 catch (    HttpErrorPage e) {
      mediator.sendResponse(e.getHttpResponse());
    }
  }
}
Program: 35770
Project: 35770
Buggy source:
public final static HttpClient addCache(EventManager d,Properties properties,HttpClient backend){
  String cacheStorageClass=Parameters.CACHE_STORAGE.getValueString(properties);
  Object cacheStorage;
  try {
    cacheStorage=Class.forName(cacheStorageClass).newInstance();
  }
 catch (  Exception e) {
    throw new ConfigurationException("String_Node_Str",e);
  }
  if (!(cacheStorage instanceof CacheStorage))   throw new ConfigurationException("String_Node_Str");
  ((CacheStorage)cacheStorage).init(properties);
  CacheConfig cacheConfig=createCacheConfig(properties);
  cacheConfig.setSharedCache(true);
  CacheAdapter cacheAdapter=new CacheAdapter();
  cacheAdapter.init(properties);
  HttpClient cachingHttpClient=cacheAdapter.wrapBackendHttpClient(d,backend);
  cachingHttpClient=PatchedCachingHttpClientFactory.buildCachingHttpClient(cachingHttpClient,(HttpCacheStorage)cacheStorage,cacheConfig);
  cachingHttpClient=cacheAdapter.wrapCachingHttpClient(cachingHttpClient);
  return cachingHttpClient;
}

Fixed version (ground truth):
public final static HttpClient addCache(EventManager d,Properties properties,HttpClient backend){
  String cacheStorageClass=Parameters.CACHE_STORAGE.getValueString(properties);
  Object cacheStorage;
  try {
    cacheStorage=Class.forName(cacheStorageClass).newInstance();
  }
 catch (  Exception e) {
    throw new ConfigurationException("String_Node_Str",e);
  }
  if (!(cacheStorage instanceof CacheStorage))   throw new ConfigurationException("String_Node_Str");
  ((CacheStorage)cacheStorage).init(properties);
  CacheConfig cacheConfig=createCacheConfig(properties);
  cacheConfig.setSharedCache(true);
  CacheAdapter cacheAdapter=new CacheAdapter();
  cacheAdapter.init(properties);
  HttpClient cachingHttpClient=cacheAdapter.wrapBackendHttpClient(d,backend);
  cachingHttpClient=new CachingHttpClient(cachingHttpClient,(HttpCacheStorage)cacheStorage,cacheConfig);
  cachingHttpClient=cacheAdapter.wrapCachingHttpClient(cachingHttpClient);
  return cachingHttpClient;
}
Program: 35772
Project: 35772
Buggy source:
/** 
 * This method returns the content of an url as a String. The result is cached into the request scope in order not to send several requests if you need several blocks in the same page to build the final page.
 * @param page Address of the page containing the template
 * @param ctx target resource
 * @throws HttpErrorPage If an Exception occurs while retrieving the template
 * @return the content of the url
 * @throws HttpErrorPage
 */
public String getResourceAsString(String page,ResourceContext ctx) throws HttpErrorPage {
  String actualPage=VariablesResolver.replaceAllVariables(page,ctx.getOriginalRequest());
  ResourceContext resourceContext=new ResourceContext(this,actualPage,null,ctx.getOriginalRequest(),ctx.getOriginalResponse());
  resourceContext.setPreserveHost(getConfiguration().isPreserveHost());
  StringOutput stringOutput=getResourceAsString(resourceContext);
  String currentValue=stringOutput.toString();
  return currentValue;
}

Fixed version (ground truth):
/** 
 * This method returns the content of an url as a String. The result is cached into the request scope in order not to send several requests if you need several blocks in the same page to build the final page.
 * @param page Address of the page containing the template
 * @param ctx target resource
 * @throws HttpErrorPage If an Exception occurs while retrieving the template
 * @return the content of the url
 * @throws HttpErrorPage
 * @throws IOException
 */
public String getResourceAsString(String page,ResourceContext ctx) throws HttpErrorPage, IOException {
  String actualPage=VariablesResolver.replaceAllVariables(page,ctx.getOriginalRequest());
  ResourceContext resourceContext=new ResourceContext(this,actualPage,null,ctx.getOriginalRequest(),ctx.getOriginalResponse());
  resourceContext.setPreserveHost(getConfiguration().isPreserveHost());
  StringOutput stringOutput=getResourceAsString(resourceContext);
  String currentValue=stringOutput.toString();
  return currentValue;
}
Program: 35773
Project: 35773
Buggy source:
protected void renderResource(ResourceContext resourceContext,Output output) throws HttpErrorPage {
  Resource resource=null;
  try {
    resource=this.resourceFactory.getResource(resourceContext);
    try {
      Rfc2616.renderResource(config,resource,output);
    }
 catch (    ResponseOutputStreamException e) {
      if (LOG.isInfoEnabled()) {
        Throwable t=e.getCause();
        LOG.info("String_Node_Str",t.getClass().getName(),t.getMessage());
      }
    }
catch (    IOException e) {
      StringWriter out=new StringWriter();
      e.printStackTrace(new PrintWriter(out));
      HttpErrorPage httpErrorPage=new HttpErrorPage(HttpStatusConstants.SC_BAD_GATEWAY,e.getMessage(),out.toString());
      httpErrorPage.initCause(e);
      throw httpErrorPage;
    }
  }
  finally {
    if (null != resource) {
      resource.release();
    }
  }
}

Fixed version (ground truth):
protected void renderResource(ResourceContext resourceContext,Output output) throws HttpErrorPage, IOException {
  Resource resource=null;
  try {
    resource=this.resourceFactory.getResource(resourceContext);
    if (resource.isError()) {
      String errorPageContent;
      StringOutput stringOutput=new StringOutput();
      resource.render(stringOutput);
      errorPageContent=stringOutput.toString();
      throw new HttpErrorPage(resource.getStatusCode(),resource.getStatusMessage(),errorPageContent);
    }
 else {
      resource.render(output);
    }
  }
  finally {
    if (null != resource) {
      resource.release();
    }
  }
}
Program: 35774
Project: 35774
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override public void close(){
  if (outputStream != null) {
    try {
      outputStream.close();
    }
 catch (    IOException e) {
      throw new OutputException(e);
    }
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 * @throws IOException
 */
@Override public void close() throws IOException {
  if (outputStream != null) {
    outputStream.close();
  }
}
Program: 35775
Project: 35775
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override public void open(){
  response.setStatus(getStatusCode());
  try {
    copyHeaders();
    outputStream=new ResponseOutputStream(response.getOutputStream());
  }
 catch (  IOException e) {
    throw new OutputException(e);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 * @throws IOException 
 */
@Override public void open() throws IOException {
  response.setStatus(getStatusCode());
  copyHeaders();
  outputStream=new ResponseOutputStream(response.getOutputStream());
}
Program: 35776
Project: 35776
Buggy source:
@Override public void flush(){
  try {
    parent.flush();
  }
 catch (  IOException e) {
    throw new ResponseOutputStreamException(e);
  }
}

Fixed version (ground truth):
@Override public void flush() throws IOException {
  parent.flush();
}
Program: 35777
Project: 35777
Buggy source:
@Override public void write(byte[] b){
  try {
    parent.write(b);
  }
 catch (  IOException e) {
    throw new ResponseOutputStreamException(e);
  }
}

Fixed version (ground truth):
@Override public void write(byte[] b) throws IOException {
  parent.write(b);
}
Program: 35778
Project: 35778
Buggy source:
@Override public void close(){
  try {
    parent.close();
  }
 catch (  IOException e) {
    throw new ResponseOutputStreamException(e);
  }
}

Fixed version (ground truth):
@Override public void close() throws IOException {
  parent.close();
}
Program: 35779
Project: 35779
Buggy source:
@Override public void render(Output output) throws IOException {
  output.setStatus(httpClientResponse.getStatusCode(),httpClientResponse.getStatusText());
  Rfc2616.copyHeaders(target.getDriver().getConfiguration(),this,output);
  target.getDriver().getFilter().postRequest(httpClientResponse,target);
  copyHeaderAndRewriteUri(HttpHeaders.LOCATION,output);
  copyHeaderAndRewriteUri(HttpHeaders.CONTENT_LOCATION,output);
  copyHeaderAndRewriteUri(HttpHeaders.LINK,output);
  copyHeaderAndRewriteUri(HttpHeaders.P3P,output);
  String charset=httpClientResponse.getContentCharset();
  if (charset != null) {
    output.setCharsetName(charset);
  }
  try {
    output.open();
    InputStream inputStream=httpClientResponse.openStream();
    if (inputStream != null) {
      removeSessionId(inputStream,output);
    }
  }
  finally {
    output.close();
  }
}

Fixed version (ground truth):
@Override public void render(Output output) throws IOException {
  output.setStatus(httpClientResponse.getStatusCode(),httpClientResponse.getStatusText());
  Resource.copyHeaders(target.getDriver().getConfiguration(),this,output);
  target.getDriver().getFilter().postRequest(httpClientResponse,target);
  copyHeaderAndRewriteUri(HttpHeaders.LOCATION,output);
  copyHeaderAndRewriteUri(HttpHeaders.CONTENT_LOCATION,output);
  copyHeaderAndRewriteUri(HttpHeaders.LINK,output);
  copyHeaderAndRewriteUri(HttpHeaders.P3P,output);
  String charset=httpClientResponse.getContentCharset();
  if (charset != null) {
    output.setCharsetName(charset);
  }
  try {
    output.open();
    InputStream inputStream=httpClientResponse.openStream();
    if (inputStream != null) {
      removeSessionId(inputStream,output);
    }
  }
  finally {
    output.close();
  }
}
Program: 35780
Project: 35780
Buggy source:
/** 
 * Closes underlying output stream
 * @throws OutputException in case of error
 */
public abstract void close();

Fixed version (ground truth):
/** 
 * Closes underlying output stream
 * @throws OutputException in case of error
 */
public abstract void close() throws IOException ;
Program: 35781
Project: 35781
Buggy source:
public final void write(String string){
  try {
    if (charsetName != null) {
      getOutputStream().write(string.getBytes(charsetName));
    }
 else {
      getOutputStream().write(string.getBytes("String_Node_Str"));
    }
  }
 catch (  UnsupportedEncodingException e) {
    throw new OutputException(e);
  }
catch (  IOException e) {
    throw new OutputException(e);
  }
}

Fixed version (ground truth):
public final void write(String string) throws IOException {
  try {
    if (charsetName != null) {
      getOutputStream().write(string.getBytes(charsetName));
    }
 else {
      getOutputStream().write(string.getBytes("String_Node_Str"));
    }
  }
 catch (  UnsupportedEncodingException e) {
    throw new OutputException(e);
  }
}
Program: 35782
Project: 35782
Buggy source:
/** 
 * Opens the OutputStreams that may be needed by the OutPut.<br /> The headers and charset may be ignored if not defined before calling this method.<br /> Any opened Output should be closed in order to release the resources.
 */
public abstract void open();

Fixed version (ground truth):
/** 
 * Opens the OutputStreams that may be needed by the OutPut.<br /> The headers and charset may be ignored if not defined before calling this method.<br /> Any opened Output should be closed in order to release the resources.
 */
public abstract void open() throws IOException ;
Program: 35783
Project: 35783
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override public void close(){
  try {
    byteArrayOutputStream.close();
  }
 catch (  IOException e) {
    throw new OutputException(e);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 * @throws IOException 
 */
@Override public void close() throws IOException {
  byteArrayOutputStream.close();
}
Program: 35785
Project: 35785
Buggy source:
/** 
 * Add a response to the cache. <p> Be sure to check CacheEntry#isDirty() on return. Entry content will probably be updated thus need to be persisted.
 * @param resourceContext must be the resourceContext used to get resource. Not the one of this cache entry.
 * @param resource the new response.
 */
public void put(ResourceContext resourceContext,CachedResponse resource){
  if (resource != null && resource.getStatusCode() != HttpStatusConstants.SC_NOT_MODIFIED) {
    resource.setRequestHeadersFromRequest(resourceContext.getOriginalRequest());
    String key=getCacheKey(resourceContext,resource);
    CachedResponseSummary summary=resource.getSummary(key);
    responseSummaries.remove(summary);
    responseSummaries.add(summary);
    storage.put(key,resource);
    dirty=true;
    if (LOG.isDebugEnabled()) {
      LOG.debug("String_Node_Str" + key + "String_Node_Str");
    }
  }
  if (System.currentTimeMillis() - lastClean > CLEAN_DELAY) {
synchronized (this) {
      if (System.currentTimeMillis() - lastClean > CLEAN_DELAY) {
        for (        CachedResponseSummary summary : responseSummaries) {
          getCacheResponseAndClean(summary);
        }
        lastClean=System.currentTimeMillis();
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Add a response to the cache. <p> Be sure to check CacheEntry#isDirty() on return. Entry content will probably be updated thus need to be persisted.
 * @param resourceContext must be the resourceContext used to get resource. Not the one of this cache entry.
 * @param resource the new response.
 */
public void put(ResourceContext resourceContext,CachedResponse resource){
  if (resource != null && resource.getStatusCode() != HttpStatusConstants.SC_NOT_MODIFIED) {
    resource.setRequestHeadersFromRequest(resourceContext.getOriginalRequest());
    String key=getCacheKey(resourceContext,resource);
    CachedResponseSummary summary=resource.getSummary(key);
    responseSummaries.remove(summary);
    responseSummaries.add(summary);
    storage.put(key,resource);
    dirty=true;
    if (LOG.isDebugEnabled()) {
      LOG.debug("String_Node_Str" + key + "String_Node_Str");
    }
  }
synchronized (this) {
    if (System.currentTimeMillis() - lastClean > CLEAN_DELAY) {
      for (      CachedResponseSummary summary : responseSummaries) {
        getCacheResponseAndClean(summary);
      }
      lastClean=System.currentTimeMillis();
    }
  }
}
Program: 35786
Project: 35786
Buggy source:
/** 
 * Returns true if the content written did not reach maxSize.
 * @return true if content size exceeds maxSize
 */
public boolean isTooBig(){
  return tooBig;
}

Fixed version (ground truth):
/** 
 * Returns true if the content written did not reach maxSize.
 * @return true if content size exceeds maxSize
 */
public synchronized boolean isTooBig(){
  return tooBig;
}
Program: 35787
Project: 35787
Buggy source:
/** 
 * {@inheritDoc}
 * @see org.esigate.resource.Resource#getRequestHeader(String)
 */
@Override public String getRequestHeader(String key){
  for (  Entry<String,String> entry : requestHeaders.entrySet()) {
    if (key.equalsIgnoreCase(entry.getKey().toString())) {
      return entry.getValue().toString();
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 * @see org.esigate.resource.Resource#getRequestHeader(String)
 */
@Override public String getRequestHeader(String key){
  for (  Entry<String,String> entry : requestHeaders.entrySet()) {
    if (key.equalsIgnoreCase(entry.getKey())) {
      return entry.getValue();
    }
  }
  return null;
}
Program: 35788
Project: 35788
Buggy source:
public CachedResponseSummary(String cacheKey,Map<String,Set<String>> headers,int statusCode,String statusMessage){
  super(headers,statusCode,statusMessage);
  this.cacheKey=cacheKey;
}

Fixed version (ground truth):
public CachedResponseSummary(String cacheKey,Map<String,Set<String>> headers,int statusCode,String statusMessage){
  super(headers,statusCode,statusMessage);
  this.cacheKey=cacheKey;
  this.requestHeaders=new HashMap<String,String>();
}
Program: 35789
Project: 35789
Buggy source:
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  CacheEntry other=(CacheEntry)obj;
  if (key == null) {
    if (other.key != null) {
      return false;
    }
  }
 else   if (!key.equals(other.key)) {
    return false;
  }
  if (ttl != other.ttl) {
    return false;
  }
  if (value == null) {
    if (other.value != null) {
      return false;
    }
  }
 else   if (!value.equals(other.value)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (!(obj instanceof CacheEntry)) {
    return false;
  }
  CacheEntry other=(CacheEntry)obj;
  return new EqualsBuilder().append(key,other.key).append(ttl,other.ttl).append(value,other.value).isEquals();
}
Program: 35790
Project: 35790
Buggy source:
@Override public void onTagEnd(String tag,ParserContext ctx) throws IOException {
  IncludeElement parent=ctx.findAncestor(IncludeElement.class);
  String result=VariablesResolver.replaceAllVariables(buf.toString(),ctx.getResourceContext().getOriginalRequest());
  if (fragment != null) {
    parent.addFragmentReplacement(fragment,(CharSequence)result);
  }
 else   if (regexp != null) {
    parent.addRegexpReplacement(regexp,(CharSequence)result);
  }
 else {
    parent.characters(result,0,result.length());
  }
  parent=null;
  buf=null;
}

Fixed version (ground truth):
@Override public void onTagEnd(String tag,ParserContext ctx) throws IOException {
  IncludeElement parent=ctx.findAncestor(IncludeElement.class);
  String result=VariablesResolver.replaceAllVariables(buf.toString(),ctx.getResourceContext().getOriginalRequest());
  if (fragment != null) {
    parent.addFragmentReplacement(fragment,(CharSequence)result);
  }
 else   if (regexp != null) {
    parent.addRegexpReplacement(regexp,(CharSequence)result);
  }
 else {
    parent.characters(result,0,result.length());
  }
  buf=null;
}
Program: 35791
Project: 35791
Buggy source:
public static Cookie toCustomCookie(org.apache.http.cookie.Cookie cookie){
  Cookie newCookie=new BasicClientCookie(cookie.getName(),cookie.getValue());
  if (cookie != null) {
    ((BasicClientCookie)newCookie).setComment(cookie.getComment());
    ((BasicClientCookie)newCookie).setCommentURL(cookie.getCommentURL());
    ((BasicClientCookie)newCookie).setDomain(cookie.getDomain());
    ((BasicClientCookie)newCookie).setExpiryDate(cookie.getExpiryDate());
    ((BasicClientCookie)newCookie).setPath(cookie.getPath());
    ((BasicClientCookie)newCookie).setPorts(cookie.getPorts());
    ((BasicClientCookie)newCookie).setSecure(cookie.isSecure());
    ((BasicClientCookie)newCookie).setVersion(cookie.getVersion());
  }
  return newCookie;
}

Fixed version (ground truth):
public static Cookie toCustomCookie(org.apache.http.cookie.Cookie cookie){
  BasicClientCookie newCookie=new BasicClientCookie(cookie.getName(),cookie.getValue());
  newCookie.setComment(cookie.getComment());
  newCookie.setCommentURL(cookie.getCommentURL());
  newCookie.setDomain(cookie.getDomain());
  newCookie.setExpiryDate(cookie.getExpiryDate());
  newCookie.setPath(cookie.getPath());
  newCookie.setPorts(cookie.getPorts());
  newCookie.setSecure(cookie.isSecure());
  newCookie.setVersion(cookie.getVersion());
  return newCookie;
}
Program: 35792
Project: 35792
Buggy source:
public static org.apache.http.cookie.Cookie toApacheCookie(Cookie cookie){
  org.apache.http.cookie.Cookie newCookie=new BasicClientCookie2(cookie.getName(),cookie.getValue());
  if (cookie != null) {
    ((BasicClientCookie2)newCookie).setComment(cookie.getComment());
    ((BasicClientCookie2)newCookie).setCommentURL(cookie.getCommentURL());
    ((BasicClientCookie2)newCookie).setDomain(cookie.getDomain());
    ((BasicClientCookie2)newCookie).setExpiryDate(cookie.getExpiryDate());
    ((BasicClientCookie2)newCookie).setPath(cookie.getPath());
    ((BasicClientCookie2)newCookie).setPorts(cookie.getPorts());
    ((BasicClientCookie2)newCookie).setSecure(cookie.isSecure());
    ((BasicClientCookie2)newCookie).setVersion(cookie.getVersion());
  }
  return newCookie;
}

Fixed version (ground truth):
public static org.apache.http.cookie.Cookie toApacheCookie(Cookie cookie){
  BasicClientCookie2 newCookie=new BasicClientCookie2(cookie.getName(),cookie.getValue());
  newCookie.setComment(cookie.getComment());
  newCookie.setCommentURL(cookie.getCommentURL());
  newCookie.setDomain(cookie.getDomain());
  newCookie.setExpiryDate(cookie.getExpiryDate());
  newCookie.setPath(cookie.getPath());
  newCookie.setPorts(cookie.getPorts());
  newCookie.setSecure(cookie.isSecure());
  newCookie.setVersion(cookie.getVersion());
  return newCookie;
}
Program: 35794
Project: 35794
Buggy source:
public static Tag create(String tag){
  Matcher nameMatcher=TAG_NAME_PATTERN.matcher(tag);
  String name=(nameMatcher.find()) ? nameMatcher.group(1) : null;
  Map<String,String> attributes=new HashMap<String,String>();
  Matcher attributesMatcher=ATTRIBUTE_PATTERN.matcher(tag);
  while (attributesMatcher.find()) {
    attributes.put(attributesMatcher.group(1),attributesMatcher.group(3));
  }
  boolean closing=CLOSE_TAG.matcher(tag).find();
  boolean openClosed=AUTO_CLOSE_TAG.matcher(tag).find();
  return new Tag(name,closing,openClosed,attributes);
}

Fixed version (ground truth):
public static Tag create(String tag){
  Matcher closeMatcher=TAG_CLOSE_PATTERN.matcher(tag);
  if (closeMatcher.find()) {
    String name=closeMatcher.group(1);
    Map<String,String> attributes=Collections.emptyMap();
    return new Tag(name,true,false,attributes);
  }
  Matcher startMatcher=TAG_START_PATTERN.matcher(tag);
  if (startMatcher.find()) {
    String name=startMatcher.group(1);
    Map<String,String> attributes=new HashMap<String,String>();
    Matcher attributesMatcher=ATTRIBUTE_PATTERN.matcher(tag);
    while (attributesMatcher.find()) {
      attributes.put(attributesMatcher.group(1),tag.substring(attributesMatcher.start(2) + 1,attributesMatcher.end(2) - 1));
    }
    boolean openClosed=AUTO_CLOSE_TAG.matcher(tag).find();
    return new Tag(name,false,openClosed,attributes);
  }
  throw new IllegalArgumentException("String_Node_Str" + tag + "String_Node_Str");
}
Program: 35795
Project: 35795
Buggy source:
public void testCreate(){
  Tag tag=Tag.create("String_Node_Str");
  assertEquals("String_Node_Str",tag.getName());
  assertEquals("String_Node_Str",tag.getAttribute("String_Node_Str"));
  assertEquals("String_Node_Str",tag.getAttribute("String_Node_Str"));
  assertFalse(tag.isClosing());
  assertTrue(tag.isOpenClosed());
  tag=Tag.create("String_Node_Str");
  assertEquals("String_Node_Str",tag.getName());
  assertEquals("String_Node_Str",tag.getAttribute("String_Node_Str"));
  assertEquals("String_Node_Str",tag.getAttribute("String_Node_Str"));
  assertFalse(tag.isClosing());
  assertFalse(tag.isOpenClosed());
  tag=Tag.create("String_Node_Str");
  assertNull(tag.getName());
  assertTrue(tag.isClosing());
  assertFalse(tag.isOpenClosed());
}

Fixed version (ground truth):
public void testCreate(){
  Tag tag=Tag.create("String_Node_Str");
  assertEquals("String_Node_Str",tag.getName());
  assertEquals("String_Node_Str",tag.getAttribute("String_Node_Str"));
  assertEquals("String_Node_Str",tag.getAttribute("String_Node_Str"));
  assertFalse(tag.isClosing());
  assertTrue(tag.isOpenClosed());
  tag=Tag.create("String_Node_Str");
  assertEquals("String_Node_Str",tag.getName());
  assertEquals("String_Node_Str",tag.getAttribute("String_Node_Str"));
  assertEquals("String_Node_Str",tag.getAttribute("String_Node_Str"));
  assertFalse(tag.isClosing());
  assertFalse(tag.isOpenClosed());
  tag=Tag.create("String_Node_Str");
  assertEquals("String_Node_Str",tag.getName());
  assertFalse(tag.isClosing());
  assertFalse(tag.isOpenClosed());
  tag=Tag.create("String_Node_Str");
  assertEquals("String_Node_Str",tag.getName());
  assertTrue(tag.isClosing());
  assertFalse(tag.isOpenClosed());
}
Program: 35799
Project: 35799
Buggy source:
private String getIfModifiedSince(ResourceContext resourceContext,CachedResponse cachedResponse){
  Date requestedIfModifiedSinceDate=Rfc2616.getDateHeader(resourceContext,"String_Node_Str");
  Date cacheLastModifiedDate=null;
  if (cachedResponse != null && cachedResponse.hasResponseBody()) {
    cacheLastModifiedDate=Rfc2616.getDateHeader(cachedResponse,"String_Node_Str");
    if (resourceContext.isNeededForTransformation() || requestedIfModifiedSinceDate == null || (cacheLastModifiedDate != null && cacheLastModifiedDate.after(requestedIfModifiedSinceDate)))     return cachedResponse.getHeader("String_Node_Str");
  }
  return resourceContext.getOriginalRequest().getHeader("String_Node_Str");
}

Fixed version (ground truth):
private String getIfModifiedSince(ResourceContext resourceContext,CachedResponse cachedResponse){
  String requestedIfModifiedSinceString=resourceContext.getOriginalRequest().getHeader("String_Node_Str");
  Date requestedIfModifiedSinceDate=Rfc2616.getDateHeader(resourceContext,"String_Node_Str");
  String cacheLastModifiedString=null;
  Date cacheLastModifiedDate=null;
  if (cachedResponse != null && cachedResponse.hasResponseBody()) {
    cacheLastModifiedString=cachedResponse.getHeader("String_Node_Str");
    cacheLastModifiedDate=Rfc2616.getDateHeader(cachedResponse,"String_Node_Str");
  }
  if (resourceContext.isNeededForTransformation() || requestedIfModifiedSinceDate == null || (cacheLastModifiedDate != null && cacheLastModifiedDate.after(requestedIfModifiedSinceDate)))   return cacheLastModifiedString;
  return requestedIfModifiedSinceString;
}
Program: 35800
Project: 35800
Buggy source:
void setProvider(String provider){
  this.provider=provider;
}

Fixed version (ground truth):
public void setProvider(String provider){
  this.provider=provider;
}
Program: 35801
Project: 35801
Buggy source:
String getProvider(){
  return provider;
}

Fixed version (ground truth):
public String getProvider(){
  return provider;
}
Program: 35804
Project: 35804
Buggy source:
/** 
 * Selects the response to the request between a cache entry (if return code is 304) and the resource sent by the server (if return code is 200). Updates the cache.
 * @param resourceContext
 * @param cachedResponse
 * @param newResource
 * @return The response to send to the client
 * @throws HttpErrorPage
 */
public Resource select(ResourceContext resourceContext,CachedResponse cachedResponse,Resource newResource) throws HttpErrorPage {
  Resource result;
  if (newResource.getStatusCode() == HttpServletResponse.SC_NOT_MODIFIED) {
    String etag=newResource.getHeader("String_Node_Str");
    if (etag == null)     result=cachedResponse;
 else {
      result=findByEtag(etag);
      if (result == null)       throw new HttpErrorPage(HttpServletResponse.SC_PRECONDITION_FAILED,"String_Node_Str","String_Node_Str");
    }
    updateHeaders(cachedResponse,newResource);
  }
 else {
    result=newResource;
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Selects the response to the request between a cache entry (if return code is 304) and the resource sent by the server (if return code is 200). Updates the cache.
 * @param resourceContext
 * @param cachedResponse
 * @param newResource
 * @return The response to send to the client
 * @throws HttpErrorPage
 */
public Resource select(ResourceContext resourceContext,CachedResponse cachedResponse,Resource newResource) throws HttpErrorPage {
  Resource result=null;
  if (newResource.getStatusCode() == HttpServletResponse.SC_NOT_MODIFIED) {
    String etag=Rfc2616.getEtag(newResource);
    if (etag == null) {
      String sentIfModifiedSince=getIfModifiedSince(resourceContext,cachedResponse);
      if (sentIfModifiedSince != null) {
        if (!resourceContext.isNeededForTransformation() && sentIfModifiedSince.equals(resourceContext.getOriginalRequest().getHeader("String_Node_Str")))         result=newResource;
 else         result=cachedResponse;
      }
    }
 else {
      if (!resourceContext.isNeededForTransformation() && Rfc2616.etagMatches(resourceContext,newResource))       result=newResource;
 else       result=findByEtag(etag);
    }
    if (cachedResponse != null)     updateHeaders(cachedResponse,newResource);
    if (result == null) {
      LOG.warn("String_Node_Str" + resourceContext.isNeededForTransformation() + "String_Node_Str"+ etag);
      throw new HttpErrorPage(HttpServletResponse.SC_PRECONDITION_FAILED,"String_Node_Str","String_Node_Str");
    }
  }
 else {
    result=newResource;
  }
  return result;
}
Program: 35805
Project: 35805
Buggy source:
/** 
 * Returns the first matching cache entry for this request, this entry may be valid or stale but Etag must match If-None-Match header from the request and vary headers must be the same in the request and in the original request that caused this entry to get cached.
 * @param resourceContext
 * @return the first matching cache entry for this request
 */
public CachedResponse get(ResourceContext resourceContext){
  CachedResponse result=null;
  for (Iterator<CachedResponse> iterator=cachedResponses.values().iterator(); iterator.hasNext(); ) {
    CachedResponse cachedResponse=iterator.next();
    if (Rfc2616.matches(resourceContext,cachedResponse)) {
      result=cachedResponse;
      String key=getCacheKey(resourceContext,result);
      storage.touch(key);
      LOG.debug("String_Node_Str" + key + "String_Node_Str"+ result);
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Returns the first matching cache entry for this request, this entry may be valid or stale but Etag must match If-None-Match header from the request and vary headers must be the same in the request and in the original request that caused this entry to get cached.
 * @param resourceContext
 * @return the first matching cache entry for this request
 */
public CachedResponse get(ResourceContext resourceContext){
  CachedResponse result=null;
  for (Iterator<CachedResponse> iterator=cachedResponses.values().iterator(); iterator.hasNext(); ) {
    CachedResponse cachedResponse=iterator.next();
    if (Rfc2616.matches(resourceContext,cachedResponse)) {
      result=cachedResponse;
      String key=getCacheKey(resourceContext,result);
      storage.touch(key);
      if (LOG.isDebugEnabled()) {
        LOG.debug("String_Node_Str" + key + "String_Node_Str"+ result);
      }
    }
  }
  return result;
}
Program: 35806
Project: 35806
Buggy source:
private CachedResponse findByEtag(String etag){
  for (Iterator<CachedResponse> iterator=cachedResponses.values().iterator(); iterator.hasNext(); ) {
    CachedResponse cachedResponse=iterator.next();
    if (etag.equals(cachedResponse.getHeader("String_Node_Str")))     return cachedResponse;
  }
  return null;
}

Fixed version (ground truth):
private CachedResponse findByEtag(String etag){
  LOG.debug("String_Node_Str" + etag + "String_Node_Str");
  for (Iterator<CachedResponse> iterator=cachedResponses.values().iterator(); iterator.hasNext(); ) {
    CachedResponse cachedResponse=iterator.next();
    if (etag.equals(cachedResponse.getHeader("String_Node_Str")))     return cachedResponse;
  }
  return null;
}