Program: 59558
Project: 59558
Buggy source:
@Override public void write(UriInfo uriInfo,Writer w,EntitiesResponse response){
  String baseUri=uriInfo.getBaseUri().toString();
  EdmEntitySet ees=response.getEntitySet();
  String entitySetName=ees.getName();
  DateTime utc=new DateTime().withZone(DateTimeZone.UTC);
  String updated=InternalUtil.toString(utc);
  XMLWriter2 writer=XMLFactoryProvider2.getInstance().newXMLWriterFactory2().createXMLWriter(w);
  writer.startDocument();
  writer.startElement(new QName2("String_Node_Str"),atom);
  writer.writeNamespace("String_Node_Str",m);
  writer.writeNamespace("String_Node_Str",d);
  writer.writeAttribute("String_Node_Str",baseUri);
  writeElement(writer,"String_Node_Str",entitySetName,"String_Node_Str","String_Node_Str");
  writeElement(writer,"String_Node_Str",baseUri + uriInfo.getPath());
  writeElement(writer,"String_Node_Str",updated);
  writeElement(writer,"String_Node_Str",null,"String_Node_Str","String_Node_Str","String_Node_Str",entitySetName,"String_Node_Str",entitySetName);
  Integer inlineCount=response.getInlineCount();
  if (inlineCount != null) {
    writeElement(writer,"String_Node_Str",inlineCount.toString());
  }
  for (  OEntity entity : response.getEntities()) {
    writer.startElement("String_Node_Str");
    writeEntry(writer,entity,entity.getProperties(),entity.getLinks(),baseUri,updated,ees,true);
    writer.endElement("String_Node_Str");
  }
  if (response.getSkipToken() != null) {
    String nextHref=uriInfo.getRequestUriBuilder().replaceQueryParam("String_Node_Str",response.getSkipToken()).build().toString();
    writeElement(writer,"String_Node_Str",null,"String_Node_Str","String_Node_Str","String_Node_Str",nextHref);
  }
  writer.endDocument();
}

Fixed version (ground truth):
@Override public void write(UriInfo uriInfo,Writer w,EntitiesResponse response){
  String baseUri=uriInfo.getBaseUri().toString();
  EdmEntitySet ees=response.getEntitySet();
  String entitySetName=ees.getName();
  DateTime utc=new DateTime().withZone(DateTimeZone.UTC);
  String updated=InternalUtil.toString(utc);
  XMLWriter2 writer=XMLFactoryProvider2.getInstance().newXMLWriterFactory2().createXMLWriter(w);
  writer.startDocument();
  writer.startElement(new QName2("String_Node_Str"),atom);
  writer.writeNamespace("String_Node_Str",m);
  writer.writeNamespace("String_Node_Str",d);
  writer.writeAttribute("String_Node_Str",baseUri);
  writeElement(writer,"String_Node_Str",entitySetName,"String_Node_Str","String_Node_Str");
  writeElement(writer,"String_Node_Str",baseUri + uriInfo.getPath());
  writeElement(writer,"String_Node_Str",updated);
  writeElement(writer,"String_Node_Str",null,"String_Node_Str","String_Node_Str","String_Node_Str",entitySetName,"String_Node_Str",entitySetName);
  Integer inlineCount=response.getInlineCount();
  if (inlineCount != null) {
    writeElement(writer,"String_Node_Str",inlineCount.toString());
  }
  for (  OEntity entity : response.getEntities()) {
    writer.startElement("String_Node_Str");
    writeEntry(writer,entity,entity.getProperties(),entity.getLinks(),baseUri,updated,ees,true);
    writer.endElement("String_Node_Str");
  }
  if (response.getSkipToken() != null) {
    UriBuilder builder=uriInfo.getRequestUriBuilder().replaceQueryParam("String_Node_Str",response.getSkipToken());
    List<String> topParam=uriInfo.getQueryParameters().get("String_Node_Str");
    if (topParam != null) {
      long top=Long.valueOf(topParam.get(0));
      top-=response.getEntities().size();
      if (top > 0) {
        builder.replaceQueryParam("String_Node_Str",top);
      }
 else {
        builder.replaceQueryParam("String_Node_Str");
      }
    }
    String nextHref=builder.build().toString();
    writeElement(writer,"String_Node_Str",null,"String_Node_Str","String_Node_Str","String_Node_Str",nextHref);
  }
  writer.endDocument();
}