nus-yam/ex-repair huggingface dataset:
Program: 16804
Project: 16804
Buggy source:
/** 
 * Create an   {@code HttpException} instance based on the given response.
 * @param response The HTTP response that returned an error code.
 * @return A new {@code HttpException) instance.}
 */
static HttpException create(ResponseMessage response){
  int status=response.getStatus();
  StringBuilder s=new StringBuilder();
  InputStreamReader r;
  try {
    r=new InputStreamReader(response.getContent(),"String_Node_Str");
  }
 catch (  UnsupportedEncodingException e1) {
    throw new AssertionError("String_Node_Str");
  }
  int c=-1;
  while (true) {
    try {
      c=r.read();
    }
 catch (    IOException e1) {
    }
    if (c == -1)     break;
    s.appendCodePoint(c);
  }
  String detail="String_Node_Str";
  try {
    Document document=Xml.parse(new ByteArrayInputStream(detail.getBytes()));
    NodeList msgs=document.getElementsByTagName("String_Node_Str");
    if (msgs.getLength() > 0)     detail=msgs.item(0).getTextContent();
  }
 catch (  Exception e) {
    detail=s.toString();
  }
  String message=String.format("String_Node_Str",status);
  if (detail != null && detail.length() > 0)   message=message + "String_Node_Str" + detail;
  return new HttpException(status,message,detail);
}

Fixed version (ground truth):
/** 
 * Create an   {@code HttpException} instance based on the given response.
 * @param response The HTTP response that returned an error code.
 * @return A new {@code HttpException) instance.}
 */
static HttpException create(ResponseMessage response){
  int status=response.getStatus();
  StringBuilder s=new StringBuilder();
  InputStreamReader r;
  try {
    r=new InputStreamReader(response.getContent(),"String_Node_Str");
  }
 catch (  UnsupportedEncodingException e1) {
    throw new AssertionError("String_Node_Str");
  }
  int c=-1;
  while (true) {
    try {
      c=r.read();
    }
 catch (    IOException e1) {
    }
    if (c == -1)     break;
    s.appendCodePoint(c);
  }
  String detail=s.toString();
  try {
    Document document=Xml.parse(new ByteArrayInputStream(detail.getBytes()));
    NodeList msgs=document.getElementsByTagName("String_Node_Str");
    if (msgs.getLength() > 0)     detail=msgs.item(0).getTextContent();
  }
 catch (  Exception e) {
  }
  String message=String.format("String_Node_Str",status);
  if (detail != null && detail.length() > 0)   message=message + "String_Node_Str" + detail;
  return new HttpException(status,message,detail);
}
Program: 16805
Project: 16805
Buggy source:
/** 
 * @return a JSON serialization of this object.
 */
JsonObject toJson(){
  JsonObject root=new JsonObject();
  DataModelField f=this.dataModelObject.getField(fieldName);
  root.addProperty("String_Node_Str",this.fieldName);
  root.addProperty("String_Node_Str",f.getOwnerName());
  root.addProperty("String_Node_Str",f.getType().toString());
  root.addProperty("String_Node_Str",this.label);
  root.addProperty("String_Node_Str",this.generateSparkline);
  root.addProperty("String_Node_Str",this.statsFunction.toString());
  return root;
}

Fixed version (ground truth):
/** 
 * @return a JSON serialization of this object.
 */
JsonObject toJson(){
  JsonObject root=new JsonObject();
  DataModelField f=this.dataModelObject.getField(fieldName);
  root.addProperty("String_Node_Str",this.fieldName);
  root.addProperty("String_Node_Str",Util.join("String_Node_Str",f.getOwnerLineage()));
  root.addProperty("String_Node_Str",f.getType().toString());
  root.addProperty("String_Node_Str",this.label);
  root.addProperty("String_Node_Str",this.generateSparkline);
  root.addProperty("String_Node_Str",this.statsFunction.toString());
  return root;
}
Program: 16806
Project: 16806
Buggy source:
@Test public void testAccelerationWorks(){
  DataModel model=dataModelObject.getDataModel();
  model.setAcceleration(true);
  model.setEarliestAcceleratedTime("String_Node_Str");
  model.setAccelerationCronSchedule("String_Node_Str");
  model.update();
  PivotSpecification pivotArgs=dataModelObject.createPivotSpecification();
  Assert.assertEquals(dataModelObject.getDataModel().getName(),pivotArgs.getAccelerationNamespace());
  String sid=createTemporaryName();
  pivotArgs.setAccelerationJob(sid);
  Assert.assertEquals("String_Node_Str" + sid,pivotArgs.getAccelerationNamespace());
  String namespace=createTemporaryName();
  pivotArgs.setAccelerationNamespace(namespace);
  Assert.assertEquals(namespace,pivotArgs.getAccelerationNamespace());
}

Fixed version (ground truth):
@Test public void testAccelerationWorks(){
  DataModel model=dataModelObject.getDataModel();
  Args postArgs=new Args();
  postArgs.put("String_Node_Str","String_Node_Str");
  postArgs.put("String_Node_Str",model.getService().username);
  model.getService().post(model.path + "String_Node_Str",postArgs);
  model.setAcceleration(true);
  model.setEarliestAcceleratedTime("String_Node_Str");
  model.setAccelerationCronSchedule("String_Node_Str");
  model.update();
  PivotSpecification pivotArgs=dataModelObject.createPivotSpecification();
  Assert.assertEquals(dataModelObject.getDataModel().getName(),pivotArgs.getAccelerationNamespace());
  String sid=createTemporaryName();
  pivotArgs.setAccelerationJob(sid);
  Assert.assertEquals("String_Node_Str" + sid,pivotArgs.getAccelerationNamespace());
  String namespace=createTemporaryName();
  pivotArgs.setAccelerationNamespace(namespace);
  Assert.assertEquals(namespace,pivotArgs.getAccelerationNamespace());
}
Program: 16808
Project: 16808
Buggy source:
@Test public void testCreateDelete() throws Exception {
  EntityCollection<License> licenses=service.getLicenses();
  if (licenses.containsKey("String_Node_Str")) {
    licenses.remove("String_Node_Str");
  }
  Assert.assertFalse(licenses.containsKey("String_Node_Str"));
  String licenseKey;
  String licenseFilename;
  if (service.versionIsAtLeast("String_Node_Str")) {
    licenseKey="String_Node_Str";
    licenseFilename="String_Node_Str";
  }
 else {
    licenseKey="String_Node_Str";
    licenseFilename="String_Node_Str";
  }
  if (licenses.containsKey(licenseKey)) {
    licenses.remove(licenseKey);
  }
  Assert.assertFalse(licenses.containsKey(licenseKey));
  byte[] licensePayload=new byte[2048];
  InputStream licenseStream=SDKTestCase.openResource(licenseFilename);
  Assert.assertNotNull("String_Node_Str" + licenseFilename,licenseStream);
  try {
    licenseStream.read(licensePayload);
  }
  finally {
    licenseStream.close();
  }
  licenses.create("String_Node_Str",new Args("String_Node_Str",new String(licensePayload)));
  Assert.assertTrue(licenses.containsKey(licenseKey));
  licenses.remove(licenseKey);
  Assert.assertFalse(licenses.containsKey(licenseKey));
  clearRestartMessage();
}

Fixed version (ground truth):
@Test public void testCreateDelete() throws Exception {
  EntityCollection<License> licenses=service.getLicenses();
  String activeGroup=null;
  EntityCollection<Entity> licenseGroups=new EntityCollection<Entity>(service,"String_Node_Str");
  for (  Entity entity : licenseGroups.values()) {
    if (entity.getBoolean("String_Node_Str",false)) {
      activeGroup=entity.getName();
      break;
    }
  }
  try {
    Args args=new Args();
    args.put("String_Node_Str","String_Node_Str");
    service.post("String_Node_Str",args);
    splunkRestart();
    String licenseKey;
    String licenseFilename;
    if (service.versionIsAtLeast("String_Node_Str")) {
      licenseKey="String_Node_Str";
      licenseFilename="String_Node_Str";
    }
 else {
      licenseKey="String_Node_Str";
      licenseFilename="String_Node_Str";
    }
    if (licenses.containsKey(licenseKey)) {
      licenses.remove(licenseKey);
    }
    Assert.assertFalse(licenses.containsKey(licenseKey));
    byte[] licensePayload=new byte[2048];
    InputStream licenseStream=SDKTestCase.openResource(licenseFilename);
    try {
      licenseStream.read(licensePayload);
    }
  finally {
      licenseStream.close();
    }
    licenses.create(licenseKey,new Args("String_Node_Str",new String(licensePayload)));
    Assert.assertTrue(licenses.containsKey(licenseKey));
    licenses.remove(licenseKey);
    Assert.assertFalse(licenses.containsKey(licenseKey));
  }
  finally {
    if (activeGroup != null) {
      Args args=new Args();
      args.put("String_Node_Str","String_Node_Str");
      service.post("String_Node_Str" + activeGroup,args);
      splunkRestart();
    }
  }
}
Program: 16809
Project: 16809
Buggy source:
/** 
 * Constructs a fully-qualified URL for this service using a given path.
 * @param path The path to qualify.
 * @return The fully-qualified URL for the service.
 */
public URL getUrl(String path){
  try {
    if (getScheme() == HTTPS_SCHEME && httpsHandler != null) {
      return new URL(getScheme(),getHost(),getPort(),path,httpsHandler);
    }
 else {
      return new URL(getScheme(),getHost(),getPort(),path);
    }
  }
 catch (  MalformedURLException e) {
    throw new RuntimeException(e.getMessage(),e);
  }
}

Fixed version (ground truth):
/** 
 * Constructs a fully-qualified URL for this service using a given path.
 * @param path The path to qualify.
 * @return The fully-qualified URL for the service.
 */
public URL getUrl(String path){
  try {
    if (HTTPS_SCHEME.equals(getScheme()) && httpsHandler != null) {
      return new URL(getScheme(),getHost(),getPort(),path,httpsHandler);
    }
 else {
      return new URL(getScheme(),getHost(),getPort(),path);
    }
  }
 catch (  MalformedURLException e) {
    throw new RuntimeException(e.getMessage(),e);
  }
}
Program: 16810
Project: 16810
Buggy source:
/** 
 * Logs an event to this index through HTTP POST.
 * @param indexName The index to write to.
 * @param data A string containing event data.
 * @param args Optional arguments for this stream. Valid parameters are: "host", "host_regex", "source", and "sourcetype".
 */
public void submit(String indexName,Args args,String data){
  String sendString="String_Node_Str";
  RequestMessage request=new RequestMessage("String_Node_Str");
  request.setContent(data);
  if (indexName != null) {
    sendString=String.format("String_Node_Str",indexName);
  }
  if (args != null && args.size() > 0) {
    sendString=sendString + ((indexName == null) ? "String_Node_Str" : "String_Node_Str");
    sendString=sendString + args.encode();
  }
  service.send(service.simpleReceiverEndPoint + sendString,request);
}

Fixed version (ground truth):
/** 
 * Logs an event to this index through HTTP POST.
 * @param indexName The index to write to.
 * @param data A string containing event data.
 * @param args Optional arguments for this stream. Valid parameters are: "host", "host_regex", "source", and "sourcetype".
 */
public void submit(String indexName,Args args,String data){
  String sendString="String_Node_Str";
  RequestMessage request=new RequestMessage("String_Node_Str");
  request.setContent(data);
  if (indexName != null) {
    sendString=String.format("String_Node_Str",indexName);
  }
  if (args != null && args.size() > 0) {
    sendString=sendString + ((indexName == null) ? "String_Node_Str" : "String_Node_Str");
    sendString=sendString + args.encode();
  }
  ResponseMessage response=service.send(service.simpleReceiverEndPoint + sendString,request);
  try {
    response.getContent().close();
  }
 catch (  IOException e) {
  }
}
Program: 16811
Project: 16811
Buggy source:
protected static String locateSystemLog(){
  final String filename;
  String osName=service.getInfo().getOsName();
  if (osName.equals("String_Node_Str"))   filename="String_Node_Str";
 else   if (osName.equals("String_Node_Str")) {
    String[] filenames={"String_Node_Str","String_Node_Str"};
    for (    String candidate : filenames) {
      if (new File(candidate).exists()) {
        filename=candidate;
      }
    }
  }
 else   if (osName.equals("String_Node_Str")) {
    filename="String_Node_Str";
  }
 else {
    throw new RuntimeException("String_Node_Str" + osName + "String_Node_Str");
  }
  return filename;
}

Fixed version (ground truth):
protected static String locateSystemLog(){
  String filename=null;
  String osName=service.getInfo().getOsName();
  if (osName.equals("String_Node_Str"))   filename="String_Node_Str";
 else   if (osName.equals("String_Node_Str")) {
    String[] filenames={"String_Node_Str","String_Node_Str"};
    for (    String candidate : filenames) {
      if (new File(candidate).exists()) {
        filename=candidate;
      }
    }
  }
 else   if (osName.equals("String_Node_Str")) {
    filename="String_Node_Str";
  }
 else {
    throw new RuntimeException("String_Node_Str" + osName + "String_Node_Str");
  }
  return filename;
}
Program: 16812
Project: 16812
Buggy source:
/** 
 * Open a resource from the Splunk SDK for Java project and parse it into an org.w3c.dom.Document object.
 * @param path a path relative to the test directory of the SDK.
 * @return an org.w3c.dom.Document object containing the parsed XML.
 */
public Document resourceToXmlDocument(String path){
  DocumentBuilderFactory documentBuilderFactory=DocumentBuilderFactory.newInstance();
  documentBuilderFactory.setIgnoringElementContentWhitespace(true);
  DocumentBuilder documentBuilder=null;
  try {
    documentBuilder=documentBuilderFactory.newDocumentBuilder();
  }
 catch (  ParserConfigurationException e) {
    throw new AssertionError("String_Node_Str" + e.toString(),e);
  }
  InputStream resource=SDKTestCase.openResource(path);
  try {
    Document doc=documentBuilder.parse(resource);
    return doc;
  }
 catch (  SAXException e) {
    throw new AssertionError("String_Node_Str" + path,e);
  }
catch (  IOException e) {
    throw new AssertionError("String_Node_Str" + path,e);
  }
}

Fixed version (ground truth):
/** 
 * Open a resource from the Splunk SDK for Java project and parse it into an org.w3c.dom.Document object.
 * @param path a path relative to the test directory of the SDK.
 * @return an org.w3c.dom.Document object containing the parsed XML.
 */
public Document resourceToXmlDocument(String path){
  DocumentBuilderFactory documentBuilderFactory=DocumentBuilderFactory.newInstance();
  documentBuilderFactory.setIgnoringElementContentWhitespace(true);
  DocumentBuilder documentBuilder=null;
  try {
    documentBuilder=documentBuilderFactory.newDocumentBuilder();
  }
 catch (  ParserConfigurationException e) {
    throw new AssertionError("String_Node_Str" + e.toString());
  }
  InputStream resource=SDKTestCase.openResource(path);
  try {
    Document doc=documentBuilder.parse(resource);
    return doc;
  }
 catch (  SAXException e) {
    throw new AssertionError("String_Node_Str" + path);
  }
catch (  IOException e) {
    throw new AssertionError("String_Node_Str" + path);
  }
}
Program: 16813
Project: 16813
Buggy source:
/** 
 * Parse XML in a string into an org.w3c.dom.Document object.
 * @param xml a String containing XML.
 * @return an org.w3c.dom.Document object.
 */
public Document stringToXmlDocument(String xml){
  DocumentBuilderFactory documentBuilderFactory=DocumentBuilderFactory.newInstance();
  documentBuilderFactory.setIgnoringElementContentWhitespace(true);
  DocumentBuilder documentBuilder=null;
  try {
    documentBuilder=documentBuilderFactory.newDocumentBuilder();
  }
 catch (  ParserConfigurationException e) {
    throw new AssertionError("String_Node_Str" + e.toString());
  }
  Document generatedDoc=null;
  try {
    generatedDoc=documentBuilder.parse(new ByteArrayInputStream(xml.getBytes("String_Node_Str")));
    return generatedDoc;
  }
 catch (  SAXException e) {
    e.printStackTrace();
    throw new AssertionError("String_Node_Str" + e.toString(),e);
  }
catch (  IOException e) {
    e.printStackTrace();
    throw new AssertionError("String_Node_Str" + e.toString(),e);
  }
}

Fixed version (ground truth):
/** 
 * Parse XML in a string into an org.w3c.dom.Document object.
 * @param xml a String containing XML.
 * @return an org.w3c.dom.Document object.
 */
public Document stringToXmlDocument(String xml){
  DocumentBuilderFactory documentBuilderFactory=DocumentBuilderFactory.newInstance();
  documentBuilderFactory.setIgnoringElementContentWhitespace(true);
  DocumentBuilder documentBuilder=null;
  try {
    documentBuilder=documentBuilderFactory.newDocumentBuilder();
  }
 catch (  ParserConfigurationException e) {
    throw new AssertionError("String_Node_Str" + e.toString());
  }
  Document generatedDoc=null;
  try {
    generatedDoc=documentBuilder.parse(new ByteArrayInputStream(xml.getBytes("String_Node_Str")));
    return generatedDoc;
  }
 catch (  SAXException e) {
    e.printStackTrace();
    throw new AssertionError("String_Node_Str" + e.toString());
  }
catch (  IOException e) {
    e.printStackTrace();
    throw new AssertionError("String_Node_Str" + e.toString());
  }
}
Program: 16814
Project: 16814
Buggy source:
/** 
 * Write this event to the given XMLStreamWriter.
 * @param out The XMLStreamWriter to append to.
 * @throws XMLStreamException if there is a problem in the XMLStreamWriter.
 * @throws MalformedDataException if you have not specified data for this event.
 */
public void writeTo(XMLStreamWriter out) throws XMLStreamException, MalformedDataException {
  if (data == null) {
    throw new MalformedDataException("String_Node_Str");
  }
  out.writeStartElement("String_Node_Str");
  if (getStanza() != null) {
    out.writeAttribute("String_Node_Str",getStanza());
  }
  out.writeAttribute("String_Node_Str",isUnbroken() ? "String_Node_Str" : "String_Node_Str");
  long epoch_time=time != null ? time.getTime() : System.currentTimeMillis();
  writeFieldTo(out,"String_Node_Str",Long.toString(epoch_time / 1000));
  writeFieldTo(out,"String_Node_Str",getSource());
  writeFieldTo(out,"String_Node_Str",getSourceType());
  writeFieldTo(out,"String_Node_Str",getIndex());
  writeFieldTo(out,"String_Node_Str",getHost());
  writeFieldTo(out,"String_Node_Str",getData());
  if (!isUnbroken() && isDone()) {
    out.writeStartElement("String_Node_Str");
    out.writeEndElement();
  }
  out.writeEndElement();
}

Fixed version (ground truth):
/** 
 * Write this event to the given XMLStreamWriter.
 * @param out The XMLStreamWriter to append to.
 * @throws XMLStreamException if there is a problem in the XMLStreamWriter.
 * @throws MalformedDataException if you have not specified data for this event.
 */
public void writeTo(XMLStreamWriter out) throws XMLStreamException, MalformedDataException {
  if (data == null) {
    throw new MalformedDataException("String_Node_Str");
  }
  out.writeStartElement("String_Node_Str");
  if (getStanza() != null) {
    out.writeAttribute("String_Node_Str",getStanza());
  }
  out.writeAttribute("String_Node_Str",isUnbroken() ? "String_Node_Str" : "String_Node_Str");
  long epoch_time;
  if (this.time == null) {
    epoch_time=System.currentTimeMillis();
  }
 else {
    epoch_time=this.time.getTime();
  }
  writeFieldTo(out,"String_Node_Str",String.format("String_Node_Str",epoch_time / 1000D));
  writeFieldTo(out,"String_Node_Str",getSource());
  writeFieldTo(out,"String_Node_Str",getSourceType());
  writeFieldTo(out,"String_Node_Str",getIndex());
  writeFieldTo(out,"String_Node_Str",getHost());
  writeFieldTo(out,"String_Node_Str",getData());
  if (!isUnbroken() && isDone()) {
    out.writeStartElement("String_Node_Str");
    out.writeEndElement();
  }
  out.writeEndElement();
}
Program: 16815
Project: 16815
Buggy source:
InputDefinition(){
  inputs=new HashMap<String,List<Parameter>>();
}

Fixed version (ground truth):
InputDefinition(){
  inputs=new HashMap<String,List<Parameter>>();
  metadata=new HashMap<String,String>();
}
Program: 16816
Project: 16816
Buggy source:
/** 
 * @return the name of the server on which this modular input is being run.
 */
public String getServerHost(){
  return serverHost;
}

Fixed version (ground truth):
/** 
 * @return the name of the server on which this modular input is being run.
 */
public String getServerHost(){
  return this.metadata.get(serverHostField);
}
Program: 16818
Project: 16818
Buggy source:
/** 
 * Set the name of the server on which this modular input is being run.
 */
public void setServerHost(String serverHost){
  this.serverHost=serverHost;
}

Fixed version (ground truth):
/** 
 * Set the name of the server on which this modular input is being run.
 */
public void setServerHost(String serverHost){
  this.metadata.put(serverHostField,serverHost);
}
Program: 16819
Project: 16819
Buggy source:
/** 
 * @return A session key providing access to splunkd's REST API on this host.
 */
public String getSessionKey(){
  return sessionKey;
}

Fixed version (ground truth):
/** 
 * @return A session key providing access to splunkd's REST API on this host.
 */
public String getSessionKey(){
  return this.metadata.get(sessionKeyField);
}
Program: 16820
Project: 16820
Buggy source:
/** 
 * @param checkpointDir The path to write checkpoint files in.
 */
public void setCheckpointDir(String checkpointDir){
  this.checkpointDir=checkpointDir;
}

Fixed version (ground truth):
/** 
 * @param checkpointDir The path to write checkpoint files in.
 */
public void setCheckpointDir(String checkpointDir){
  this.metadata.put(checkpointDirField,checkpointDir);
}
Program: 16821
Project: 16821
Buggy source:
/** 
 * @return the path to write checkpoint files for restarting inputs in.
 */
public String getCheckpointDir(){
  return checkpointDir;
}

Fixed version (ground truth):
/** 
 * @return the path to write checkpoint files for restarting inputs in.
 */
public String getCheckpointDir(){
  return this.metadata.get(checkpointDirField);
}
Program: 16822
Project: 16822
Buggy source:
@Override public boolean equals(Object other){
  if (!(other instanceof InputDefinition)) {
    return false;
  }
  InputDefinition that=(InputDefinition)other;
  return this.getServerUri().equals(that.getServerUri()) && this.getServerHost().equals(that.getServerHost()) && this.getCheckpointDir().equals(that.getCheckpointDir())&& this.getSessionKey().equals(that.getSessionKey())&& this.getInputs().equals(that.getInputs());
}

Fixed version (ground truth):
@Override public boolean equals(Object other){
  if (!(other instanceof InputDefinition)) {
    return false;
  }
  InputDefinition that=(InputDefinition)other;
  return this.metadata.equals(that.metadata) && this.inputs.equals(that.inputs);
}
Program: 16823
Project: 16823
Buggy source:
/** 
 * @param sessionKey A session key that can be used to access splunkd's REST API.
 */
public void setSessionKey(String sessionKey){
  this.sessionKey=sessionKey;
}

Fixed version (ground truth):
/** 
 * @param sessionKey A session key that can be used to access splunkd's REST API.
 */
public void setSessionKey(String sessionKey){
  this.metadata.put(sessionKeyField,sessionKey);
}
Program: 16824
Project: 16824
Buggy source:
/** 
 * @param serverUri The URI to reach the server on which this modular input is being run.
 */
public void setServerUri(String serverUri){
  this.serverUri=serverUri;
}

Fixed version (ground truth):
/** 
 * @param serverUri The URI to reach the server on which this modular input is being run.
 */
public void setServerUri(String serverUri){
  this.metadata.put(serverUriField,serverUri);
}
Program: 16825
Project: 16825
Buggy source:
/** 
 * @return the URI to the server on which this modular input is being run.
 */
public String getServerUri(){
  return serverUri;
}

Fixed version (ground truth):
/** 
 * @return the URI to the server on which this modular input is being run.
 */
public String getServerUri(){
  return this.metadata.get(serverUriField);
}
Program: 16826
Project: 16826
Buggy source:
@Test public void testArgumentGeneration() throws ParserConfigurationException, TransformerException {
  Argument argument=new Argument("String_Node_Str");
  argument.setDescription("String_Node_Str");
  argument.setDataType(Argument.DataType.NUMBER);
  argument.setRequiredOnCreate(true);
  argument.setRequiredOnEdit(true);
  argument.setValidation("String_Node_Str");
  Document generatedDoc=DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
  argument.addToDocument(generatedDoc,generatedDoc);
  Document expectedDoc=resourceToXmlDocument("String_Node_Str");
  assertXmlEqual(expectedDoc,generatedDoc);
}

Fixed version (ground truth):
@Test public void testArgumentGeneration() throws ParserConfigurationException, TransformerException {
  Argument argument=new Argument("String_Node_Str");
  argument.setDescription("String_Node_Str");
  argument.setDataType(Argument.DataType.BOOLEAN);
  argument.setValidation("String_Node_Str");
  argument.setRequiredOnEdit(true);
  argument.setRequiredOnCreate(true);
  Document generatedDoc=DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
  argument.addToDocument(generatedDoc,generatedDoc);
  Document expectedDoc=resourceToXmlDocument("String_Node_Str");
  assertXmlEqual(expectedDoc,generatedDoc);
}
Program: 16827
Project: 16827
Buggy source:
@Test public void testMinimalEvent() throws XMLStreamException, MalformedDataException, TransformerException, ParserConfigurationException {
  StringBufferOutputStream sb=new StringBufferOutputStream();
  XMLStreamWriter writer=XMLOutputFactory.newInstance().createXMLStreamWriter(sb);
  Event event=new Event();
  event.setStanza("String_Node_Str");
  event.setData("String_Node_Str");
  event.writeTo(writer);
  Document found=stringToXmlDocument(sb.toString());
  Document expected=resourceToXmlDocument("String_Node_Str");
  assertXmlEqual(expected,found);
}

Fixed version (ground truth):
@Test public void testMinimalEvent() throws XMLStreamException, MalformedDataException, TransformerException, ParserConfigurationException {
  StringBufferOutputStream sb=new StringBufferOutputStream();
  XMLStreamWriter writer=XMLOutputFactory.newInstance().createXMLStreamWriter(sb);
  Event event=new Event();
  event.setTime(new Date(1372187084000L));
  event.setStanza("String_Node_Str");
  event.setData("String_Node_Str");
  event.writeTo(writer);
  Document found=stringToXmlDocument(sb.toString());
  Document expected=resourceToXmlDocument("String_Node_Str");
  assertXmlEqual(expected,found);
}
Program: 16828
Project: 16828
Buggy source:
@Test public void testEventWriterWithMaximalEvents() throws XMLStreamException, TransformerException, ParserConfigurationException, MalformedDataException {
  StringBufferOutputStream out=new StringBufferOutputStream();
  StringBufferOutputStream err=new StringBufferOutputStream();
  EventWriter ew=new EventWriter(out,err);
  Event event=new Event();
  event.setStanza("String_Node_Str");
  event.setData("String_Node_Str");
  event.setHost("String_Node_Str");
  event.setIndex("String_Node_Str");
  event.setSource("String_Node_Str");
  event.setSourceType("String_Node_Str");
  event.setTime(new Date());
  event.setDone(true);
  event.setUnbroken(true);
  ew.writeEvent(event);
  Document found=stringToXmlDocument(out.toString() + "String_Node_Str");
  Document expected=resourceToXmlDocument("String_Node_Str");
  assertXmlEqual(expected,found);
  Assert.assertEquals("String_Node_Str",err.toString());
  err.clear();
  ew.writeEvent(event);
  ew.close();
  found=stringToXmlDocument(out.toString());
  expected=resourceToXmlDocument("String_Node_Str");
  assertXmlEqual(expected,found);
}

Fixed version (ground truth):
@Test public void testEventWriterWithMaximalEvents() throws XMLStreamException, TransformerException, ParserConfigurationException, MalformedDataException {
  StringBufferOutputStream out=new StringBufferOutputStream();
  StringBufferOutputStream err=new StringBufferOutputStream();
  EventWriter ew=new EventWriter(out,err);
  Event event=new Event();
  event.setTime(new Date(1372275124466L));
  event.setStanza("String_Node_Str");
  event.setData("String_Node_Str");
  event.setHost("String_Node_Str");
  event.setIndex("String_Node_Str");
  event.setSource("String_Node_Str");
  event.setSourceType("String_Node_Str");
  event.setDone(true);
  event.setUnbroken(true);
  ew.writeEvent(event);
  Document found=stringToXmlDocument(out.toString() + "String_Node_Str");
  Document expected=resourceToXmlDocument("String_Node_Str");
  assertXmlEqual(expected,found);
  Assert.assertEquals("String_Node_Str",err.toString());
  err.clear();
  ew.writeEvent(event);
  ew.close();
  found=stringToXmlDocument(out.toString());
  expected=resourceToXmlDocument("String_Node_Str");
  assertXmlEqual(expected,found);
}
Program: 16829
Project: 16829
Buggy source:
@Test public void testMaximalEvent() throws MalformedDataException, XMLStreamException, TransformerException, ParserConfigurationException {
  StringBufferOutputStream sb=new StringBufferOutputStream();
  XMLStreamWriter writer=XMLOutputFactory.newInstance().createXMLStreamWriter(sb);
  Event event=new Event();
  event.setStanza("String_Node_Str");
  event.setData("String_Node_Str");
  event.setHost("String_Node_Str");
  event.setIndex("String_Node_Str");
  event.setSource("String_Node_Str");
  event.setSourceType("String_Node_Str");
  event.setTime(new Date());
  event.setDone(true);
  event.setUnbroken(true);
  event.writeTo(writer);
  Document found=stringToXmlDocument(sb.toString());
  Document expected=resourceToXmlDocument("String_Node_Str");
  assertXmlEqual(expected,found);
}

Fixed version (ground truth):
@Test public void testMaximalEvent() throws MalformedDataException, XMLStreamException, TransformerException, ParserConfigurationException {
  StringBufferOutputStream sb=new StringBufferOutputStream();
  XMLStreamWriter writer=XMLOutputFactory.newInstance().createXMLStreamWriter(sb);
  Event event=new Event();
  event.setTime(new Date(1372274622493L));
  event.setStanza("String_Node_Str");
  event.setData("String_Node_Str");
  event.setHost("String_Node_Str");
  event.setIndex("String_Node_Str");
  event.setSource("String_Node_Str");
  event.setSourceType("String_Node_Str");
  event.setDone(true);
  event.setUnbroken(true);
  event.writeTo(writer);
  Document found=stringToXmlDocument(sb.toString());
  Document expected=resourceToXmlDocument("String_Node_Str");
  assertXmlEqual(expected,found);
}
Program: 16830
Project: 16830
Buggy source:
/** 
 * Constructs a fully-qualified URL for this service using a given path.
 * @param path The path to qualify.
 * @return The fully-qualified URL for the service.
 */
public URL getUrl(String path){
  try {
    return new URL(getPrefix() + path);
  }
 catch (  MalformedURLException e) {
    throw new RuntimeException(e.getMessage(),e);
  }
}

Fixed version (ground truth):
/** 
 * Constructs a fully-qualified URL for this service using a given path.
 * @param path The path to qualify.
 * @return The fully-qualified URL for the service.
 */
public URL getUrl(String path){
  try {
    if (getScheme() == HTTPS_SCHEME && httpsHandler != null) {
      return new URL(getScheme(),getHost(),getPort(),path,httpsHandler);
    }
 else {
      return new URL(getScheme(),getHost(),getPort(),path);
    }
  }
 catch (  MalformedURLException e) {
    throw new RuntimeException(e.getMessage(),e);
  }
}
Program: 16831
Project: 16831
Buggy source:
/** 
 * Constructs a new   {@code HttpService} instance using the given host,port, and scheme.
 * @param host The host name of the service.
 * @param port The port number of the service.
 * @param scheme Scheme for accessing the service ({@code http} or {@code https}).
 */
public HttpService(String host,int port,String scheme){
  this.host=host;
  this.port=port;
  this.scheme=scheme;
}

Fixed version (ground truth):
/** 
 * Constructs a new   {@code HttpService} instance using the given host,port, and scheme, and instructing it to use the specified HTTPS handler.
 * @param host The host name of the service.
 * @param port The port number of the service.
 * @param scheme Scheme for accessing the service ({@code http} or {@code https}).
 */
public HttpService(String host,int port,String scheme,URLStreamHandler httpsHandler){
  this.host=host;
  this.port=port;
  this.scheme=scheme;
  this.httpsHandler=httpsHandler;
}
Program: 16832
Project: 16832
Buggy source:
/** 
 * Creates a new   {@code Service} instance using a map of arguments.
 * @param args A {@code Map} of arguments to initialize the service.
 */
public Service(Map<String,Object> args){
  super();
  this.app=Args.<String>get(args,"String_Node_Str",null);
  this.host=Args.<String>get(args,"String_Node_Str",DEFAULT_HOST);
  this.owner=Args.<String>get(args,"String_Node_Str",null);
  this.port=Args.<Integer>get(args,"String_Node_Str",DEFAULT_PORT);
  this.scheme=Args.<String>get(args,"String_Node_Str",DEFAULT_SCHEME);
  this.token=Args.<String>get(args,"String_Node_Str",null);
  this.username=(String)args.get("String_Node_Str");
  this.password=(String)args.get("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Creates a new   {@code Service} instance using a map of arguments.
 * @param args A {@code Map} of arguments to initialize the service.
 */
public Service(Map<String,Object> args){
  super();
  this.app=Args.<String>get(args,"String_Node_Str",null);
  this.host=Args.<String>get(args,"String_Node_Str",DEFAULT_HOST);
  this.owner=Args.<String>get(args,"String_Node_Str",null);
  this.port=Args.<Integer>get(args,"String_Node_Str",DEFAULT_PORT);
  this.scheme=Args.<String>get(args,"String_Node_Str",DEFAULT_SCHEME);
  this.token=Args.<String>get(args,"String_Node_Str",null);
  this.username=(String)args.get("String_Node_Str");
  this.password=(String)args.get("String_Node_Str");
  this.httpsHandler=Args.<URLStreamHandler>get(args,"String_Node_Str",null);
}
Program: 16833
Project: 16833
Buggy source:
/** 
 * Sets the wildcard argument that accepts any saved search template argument, such as "args.username=foobar" when the search is "search $username$".
 * @param wildcard The wildcard argument.
 */
public void setArgsWildcard(String wildcard){
  setCacheValue("String_Node_Str",wildcard);
}

Fixed version (ground truth):
/** 
 * Sets the wildcard argument that accepts any saved search template argument, such as "args.username=foobar" when the search is "search $username$".
 * @param wildcard The wildcard argument.
 * @deprecated This method probably does not work correctly. See DVPL-1266.Use  {@link #update(Map)} with a manual map instead.
 */
public void setArgsWildcard(String wildcard){
  setCacheValue("String_Node_Str",wildcard);
}
Program: 16834
Project: 16834
Buggy source:
/** 
 * Returns how frequently Splunk runs the MapReduce reduce phase on accumulated map values.
 * @return The reduce frequency.
 */
public int getDispatchReduceFreq(){
  return getInteger("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Returns how frequently Splunk runs the MapReduce reduce phase on accumulated map values.
 * @return The reduce frequency.
 * @deprecated Use {@link #getDispatchReduceFrequency()} instead.
 */
public int getDispatchReduceFreq(){
  return getDispatchReduceFrequency();
}
Program: 16835
Project: 16835
Buggy source:
/** 
 * Sets whether a real-time search managed by the scheduler is restarted when a search peer becomes available for this saved search. <p> <b>Note:</b> The peer can be one that is newly added or one that has become available after being down.
 * @param restart {@code true} to restart a real-time search, {@code false}if not.
 */
public void setRestartOnSearchpeerAdd(boolean restart){
  setCacheValue("String_Node_Str",restart);
}

Fixed version (ground truth):
/** 
 * Sets whether a real-time search managed by the scheduler is restarted when a search peer becomes available for this saved search. <p> <b>Note:</b> The peer can be one that is newly added or one that has become available after being down.
 * @param restart {@code true} to restart a real-time search, {@code false}if not.
 * @deprecated Use {@link #setRestartOnSearchPeerAdd(boolean)} instead.
 */
public void setRestartOnSearchpeerAdd(boolean restart){
  setRestartOnSearchPeerAdd(restart);
}
Program: 16836
Project: 16836
Buggy source:
/** 
 * Sets the maximum number of timeline buckets.
 * @param buckets The maximum number of timeline buckets.
 */
public void setDispatchBuckets(String buckets){
  setCacheValue("String_Node_Str",buckets);
}

Fixed version (ground truth):
/** 
 * Sets the maximum number of timeline buckets.
 * @param buckets The maximum number of timeline buckets.
 */
public void setDispatchBuckets(int buckets){
  setCacheValue("String_Node_Str",buckets);
}
Program: 16837
Project: 16837
Buggy source:
/** 
 * Indicates whether to back fill the real-time window for this search. This attribute only applies to real-time searches.
 * @return {@code true} if Splunk back fills the real-time window,{@code false} if not.
 */
public boolean getDispatchRtBackfill(){
  return getBoolean("String_Node_Str",false);
}

Fixed version (ground truth):
/** 
 * Indicates whether to back fill the real-time window for this search. This attribute only applies to real-time searches.
 * @return {@code true} if Splunk back fills the real-time window,{@code false} if not.
 * @deprecated Use {@link #getDispatchRealTimeBackfill()} instead.
 */
public boolean getDispatchRtBackfill(){
  return getDispatchRealTimeBackfill();
}
Program: 16839
Project: 16839
Buggy source:
/** 
 * Returns the list of slaves for this license pool.
 * @return A comma-separated list of slaves by ID, or {@code null} if notspecified.
 */
public String[] getSlaves(){
  return getStringArray("String_Node_Str",null);
}

Fixed version (ground truth):
/** 
 * Returns the list of slaves for this license pool.
 * @return A comma-separated list of slaves by ID, or {@code null} if notspecified.
 */
public String[] getSlaves(){
  if (toUpdate.containsKey("String_Node_Str")) {
    String value=(String)toUpdate.get("String_Node_Str");
    return value.split("String_Node_Str");
  }
 else {
    return getStringArray("String_Node_Str",null);
  }
}
Program: 16840
Project: 16840
Buggy source:
/** 
 * Sets the list of slaves that are members of this license pool.
 * @param slaves The comma-separated list of slaves. Use an asterisk ("*") to accept all slaves.
 */
public void setSlaves(String slaves){
  setCacheValue("String_Node_Str",slaves);
}

Fixed version (ground truth):
/** 
 * Sets the list of slaves that are members of this license pool.
 * @param slaves The array of slaves. Use an array with a single elementthat is an asterisk ("*") to accept all slaves.
 */
public void setSlaves(String[] slaves){
  StringBuilder sb=new StringBuilder();
  for (int i=0; i < slaves.length; i++) {
    sb.append(slaves[i]);
    if (i < slaves.length - 1) {
      sb.append("String_Node_Str");
    }
  }
  setSlaves(sb.toString());
}
Program: 16841
Project: 16841
Buggy source:
@Test public void testLicensePoolSetters() throws Exception {
  LicensePoolCollection licensePoolCollection=service.getLicensePools();
  boolean foundAnUpdatablePool=false;
  for (  LicensePool licensePool : licensePoolCollection.values()) {
    if (licensePool.getStackId().equals("String_Node_Str"))     continue;
    if (licensePool.getStackId().equals("String_Node_Str"))     continue;
    if (licensePool.getStackId().equals("String_Node_Str"))     continue;
    foundAnUpdatablePool=true;
    String originalDescription=licensePool.getDescription();
{
      licensePool.setDescription("String_Node_Str");
      licensePool.setQuota("String_Node_Str");
      licensePool.update();
      assertEquals("String_Node_Str",licensePool.getDescription());
      assertEquals("String_Node_Str",licensePool.getQuota());
    }
    licensePool.update(new Args("String_Node_Str",originalDescription));
    licensePool.update(new Args("String_Node_Str","String_Node_Str"));
  }
  if (!foundAnUpdatablePool) {
    System.out.println("String_Node_Str");
  }
}

Fixed version (ground truth):
@Test public void testLicensePoolSetters() throws Exception {
  LicensePoolCollection licensePoolCollection=service.getLicensePools();
  boolean foundAnUpdatablePool=false;
  for (  LicensePool licensePool : licensePoolCollection.values()) {
    if (licensePool.getStackId().equals("String_Node_Str"))     continue;
    if (licensePool.getStackId().equals("String_Node_Str"))     continue;
    if (licensePool.getStackId().equals("String_Node_Str"))     continue;
    foundAnUpdatablePool=true;
    String originalDescription=licensePool.getDescription();
{
      licensePool.setDescription("String_Node_Str");
      licensePool.setQuota("String_Node_Str");
      licensePool.update();
      assertEquals("String_Node_Str",licensePool.getDescription());
      assertEquals("String_Node_Str",licensePool.getQuota());
    }
    String[] originalSlaves=licensePool.getSlaves();
{
      licensePool.setSlaves("String_Node_Str");
      String[] slaves=licensePool.getSlaves();
      assertEquals(slaves[0],"String_Node_Str");
      assertEquals(slaves[1],"String_Node_Str");
      licensePool.setSlaves(new String[]{"String_Node_Str","String_Node_Str"});
      String[] slaves2=licensePool.getSlaves();
      assertEquals(slaves2[0],"String_Node_Str");
      assertEquals(slaves2[1],"String_Node_Str");
      licensePool.update();
      String[] slaves3=licensePool.getSlaves();
      assertEquals(slaves3.length,2);
      assertTrue(Arrays.asList(slaves3).contains("String_Node_Str"));
      assertTrue(Arrays.asList(slaves3).contains("String_Node_Str"));
      licensePool.setSlaves(originalSlaves);
      String[] slaves4=licensePool.getSlaves();
      assertEquals(slaves4.length,originalSlaves.length);
      for (int i=0; i < originalSlaves.length; i++) {
        assertTrue(Arrays.asList(slaves4).contains(originalSlaves[i]));
      }
    }
    licensePool.update(new Args("String_Node_Str",originalDescription));
    licensePool.update(new Args("String_Node_Str","String_Node_Str"));
  }
  if (!foundAnUpdatablePool) {
    System.out.println("String_Node_Str");
  }
}
Program: 16842
Project: 16842
Buggy source:
/** 
 * Returns the string array value associated with the specified key, or the default value if the key does not exist.
 * @param key The key to look up.
 * @param defaultValue The default value.
 * @return The string array value associated with the specified key.
 */
String[] getStringArray(String key,String[] defaultValue){
  if (toUpdate.containsKey(key))   return getStringArray(toUpdate.get(key).toString());
  return getContent().getStringArray(key,defaultValue);
}

Fixed version (ground truth):
/** 
 * Returns the string array value associated with the specified key, or the default value if the key does not exist.
 * @param key The key to look up.
 * @param defaultValue The default value.
 * @return The string array value associated with the specified key.
 */
String[] getStringArray(String key,String[] defaultValue){
  if (toUpdate.containsKey(key))   return getStringArray(key);
  return getContent().getStringArray(key,defaultValue);
}
Program: 16843
Project: 16843
Buggy source:
@Test public void testForEmptySetup(){
}

Fixed version (ground truth):
@Test public void testForEmptySetup(){
  try {
    assertNull(application.setup().getSetupXml());
  }
 catch (  Exception e) {
    fail(e.toString());
  }
}
Program: 16844
Project: 16844
Buggy source:
@Before public void setUp() throws Exception {
  super.setUp();
  indexName=createTemporaryName();
  index=service.getIndexes().create(indexName);
  tcpPort=findNextUnusedTcpPort(10000);
  Args args=new Args();
  args.add("String_Node_Str",indexName);
  tcpInput=service.getInputs().create(String.valueOf(tcpPort),InputKind.Tcp,args);
}

Fixed version (ground truth):
@Before public void setUp() throws Exception {
  super.setUp();
  indexName=createTemporaryName();
  index=service.getIndexes().create(indexName);
  tcpPort=findNextUnusedPort(10000);
  tcpInput=service.getInputs().create(String.valueOf(tcpPort),InputKind.Tcp,new Args("String_Node_Str",indexName));
}
Program: 16845
Project: 16845
Buggy source:
@After public void tearDown() throws Exception {
  super.tearDown();
  if (index != null && service.versionCompare("String_Node_Str") >= 0) {
    index.remove();
  }
  if (tcpPort != -1) {
    service.getInputs().get(String.valueOf(tcpPort)).remove();
  }
}

Fixed version (ground truth):
@After public void tearDown() throws Exception {
  if (index != null && service.versionCompare("String_Node_Str") >= 0) {
    index.remove();
  }
  if (tcpInput != null) {
    tcpInput.remove();
  }
  super.tearDown();
}
Program: 16846
Project: 16846
Buggy source:
@Before public void setUp() throws Exception {
  super.setUp();
  indexName=createTemporaryName();
  index=service.getIndexes().create(indexName);
  udpPort=findNextUnusedUdpPort(10000);
  Args args=new Args();
  args.add("String_Node_Str",indexName);
  udpInput=service.getInputs().create(String.valueOf(udpPort),InputKind.Udp,args);
}

Fixed version (ground truth):
@Before public void setUp() throws Exception {
  super.setUp();
  indexName=createTemporaryName();
  index=service.getIndexes().create(indexName);
  udpPort=findNextUnusedPort(10000);
  udpInput=service.getInputs().create(String.valueOf(udpPort),InputKind.Udp,new Args("String_Node_Str",indexName));
}
Program: 16847
Project: 16847
Buggy source:
@After public void tearDown() throws Exception {
  super.tearDown();
  if (index != null && service.versionCompare("String_Node_Str") >= 0) {
    index.remove();
  }
  if (udpInput != null) {
    udpInput.remove();
  }
}

Fixed version (ground truth):
@After public void tearDown() throws Exception {
  if (index != null && service.versionCompare("String_Node_Str") >= 0) {
    index.remove();
  }
  if (udpInput != null) {
    udpInput.remove();
  }
  super.tearDown();
}
Program: 16848
Project: 16848
Buggy source:
/** 
 * Returns an   {@code InputKind} representing this input's kind.The kind is inferred from the input's path.
 * @return Unknown input kind.
 */
public InputKind getKind(){
  String[] pathComponents=this.path.split("String_Node_Str");
  int offset=0;
  while (!pathComponents[offset].equals("String_Node_Str")) {
    offset+=1;
  }
  List<String> toJoin=new ArrayList<String>();
  for (int i=offset + 1; i < pathComponents.length; i++) {
    toJoin.add(pathComponents[i]);
  }
  String relpath=Util.join("String_Node_Str",toJoin);
  return InputKind.create(relpath);
}

Fixed version (ground truth):
/** 
 * Returns an   {@code InputKind} representing this input's kind.The kind is inferred from the input's path.
 * @return Unknown input kind.
 */
public InputKind getKind(){
  String[] pathComponents=this.path.split("String_Node_Str");
  int offset=0;
  while (!pathComponents[offset].equals("String_Node_Str")) {
    offset+=1;
  }
  List<String> relpathComponents=new ArrayList<String>();
  for (int i=offset + 1; i < pathComponents.length - 1; i++) {
    relpathComponents.add(pathComponents[i]);
  }
  String relpath=Util.join("String_Node_Str",relpathComponents);
  return InputKind.createFromRelativePath(relpath);
}
Program: 16849
Project: 16849
Buggy source:
/** 
 * Returns the path's   {@code InputKind} value.
 * @param path The input path.
 * @return The kind of input.
 */
protected InputKind itemKind(String path){
  for (  InputKind kind : this.inputKinds) {
    if (path.indexOf("String_Node_Str" + kind.getRelativePath()) > 0)     return kind;
  }
  return InputKind.Unknown;
}

Fixed version (ground truth):
/** 
 * Returns the path's   {@code InputKind} value.
 * @param path The input path.
 * @return The kind of input.
 */
protected InputKind itemKind(String path){
  String relpathWithInputName=Util.substringAfter(path,"String_Node_Str",null);
  for (  InputKind kind : inputKinds) {
    if (relpathWithInputName.startsWith(kind.getRelativePath())) {
      return kind;
    }
  }
  return InputKind.Unknown;
}
Program: 16850
Project: 16850
Buggy source:
/** 
 * Refresh the   {@code inputKinds} field on this object.
 */
private void refreshInputKinds(){
  List<String> basePath=new ArrayList<String>();
  Set<InputKind> kinds=assembleInputKindSet(basePath);
  this.inputKinds.clear();
  this.inputKinds.addAll(kinds);
}

Fixed version (ground truth):
/** 
 * Refresh the   {@code inputKinds} field on this object.
 */
private void refreshInputKinds(){
  Set<InputKind> kinds=assembleInputKindSet(new ArrayList<String>());
  this.inputKinds.clear();
  this.inputKinds.addAll(kinds);
}