nus-yam/ex-repair huggingface dataset:
Program: 51218
Project: 51218
Buggy source:
public static XMLStreamWriter createWriter(Writer writer,JSONConfiguration config,boolean writingList) throws IOException {
switch (config.getNotation()) {
case NATURAL:
    final JsonGenerator rawGenerator=new JsonFactory().createJsonGenerator(writer);
  final JsonGenerator bodyGenerator=writingList ? JacksonArrayWrapperGenerator.createArrayWrapperGenerator(rawGenerator) : rawGenerator;
if (config.isRootUnwrapping()) {
  return new Stax2JacksonWriter(JacksonRootStrippingGenerator.createRootStrippingGenerator(bodyGenerator));
}
 else {
  return new Stax2JacksonWriter(bodyGenerator);
}
case MAPPED:
return JsonXmlStreamWriter.createWriter(writer,config);
case BADGERFISH:
return new BadgerFishXMLStreamWriter(writer);
case MAPPED_JETTISON:
Configuration jmConfig;
if (null == config.getXml2JsonNs()) {
jmConfig=new Configuration();
}
 else {
jmConfig=new Configuration(config.getXml2JsonNs());
}
return new MappedXMLStreamWriter(new MappedNamespaceConvention(jmConfig),writer);
default :
return null;
}
}

Fixed version (ground truth):
public static XMLStreamWriter createWriter(Writer writer,JSONConfiguration config,boolean writingList) throws IOException {
switch (config.getNotation()) {
case NATURAL:
    final JsonGenerator rawGenerator=new JsonFactory().createJsonGenerator(writer);
  if (config.isHumanReadableFormatting()) {
    rawGenerator.useDefaultPrettyPrinter();
  }
final JsonGenerator bodyGenerator=writingList ? JacksonArrayWrapperGenerator.createArrayWrapperGenerator(rawGenerator) : rawGenerator;
if (config.isRootUnwrapping()) {
return new Stax2JacksonWriter(JacksonRootStrippingGenerator.createRootStrippingGenerator(bodyGenerator));
}
 else {
return new Stax2JacksonWriter(bodyGenerator);
}
case MAPPED:
return JsonXmlStreamWriter.createWriter(writer,config);
case BADGERFISH:
return new BadgerFishXMLStreamWriter(writer);
case MAPPED_JETTISON:
Configuration jmConfig;
if (null == config.getXml2JsonNs()) {
jmConfig=new Configuration();
}
 else {
jmConfig=new Configuration(config.getXml2JsonNs());
}
return new MappedXMLStreamWriter(new MappedNamespaceConvention(jmConfig),writer);
default :
return null;
}
}
Program: 51219
Project: 51219
Buggy source:
/** 
 * Creates a new HTTP Basic Authentication filter using provided username and password credentials
 * @param username
 * @param password
 */
public HTTPBasicAuthFilter(final String username,final String password){
  authentication="String_Node_Str" + Base64.encode(username + "String_Node_Str" + password);
}

Fixed version (ground truth):
/** 
 * Creates a new HTTP Basic Authentication filter using provided username and password credentials
 * @param username
 * @param password
 */
public HTTPBasicAuthFilter(final String username,final String password){
  try {
    authentication="String_Node_Str" + new String(Base64.encode(username + "String_Node_Str" + password),"String_Node_Str");
  }
 catch (  UnsupportedEncodingException ex) {
    throw new RuntimeException(ex);
  }
}
Program: 51220
Project: 51220
Buggy source:
private void generateEEEvent(String name){
  if (!"String_Node_Str".equals(name)) {
    eventQueue.add(new EndElementEvent(createQName(name),new StaxLocation(lexer)));
  }
}

Fixed version (ground truth):
private void generateEEEvent(String name){
  if ((null != name) && !"String_Node_Str".equals(name)) {
    eventQueue.add(new EndElementEvent(createQName(name),new StaxLocation(lexer)));
  }
}
Program: 51222
Project: 51222
Buggy source:
private void pushPropInfo(String elementName){
  ProcessingInfo parentPI=peek(processingStack);
  if ((elementName != null) && (parentPI != null) && (parentPI.lastUnderlyingPI != null)&& (elementName.equals(parentPI.lastUnderlyingPI.elementName))) {
    processingStack.add(new ProcessingInfo(parentPI.lastUnderlyingPI));
    return;
  }
  final XMLSerializer xs=XMLSerializer.getInstance();
  final Property cp=(xs == null) ? null : xs.getCurrentProperty();
  final RuntimePropertyInfo ri=(cp == null) ? null : cp.getInfo();
  final Type rt=(ri == null) ? null : ri.getRawType();
  final String dn=(ri == null) ? null : ri.getName();
  if (null == rt) {
    if (writingAttr) {
      processingStack.add(new ProcessingInfo(elementName,ri,false,null));
      return;
    }
 else {
      processingStack.add(new ProcessingInfo(elementName,ri,false,null));
      return;
    }
  }
  if (primitiveTypes.contains(rt)) {
    processingStack.add(new ProcessingInfo(elementName,ri,false,rt));
    return;
  }
  if (ri.isCollection()) {
    if (!((parentPI != null) && (parentPI.isArray) && (parentPI.rpi == ri))) {
      processingStack.add(new ProcessingInfo(elementName,ri,true,rt));
      return;
    }
  }
  processingStack.add(new ProcessingInfo(elementName,ri,false,rt));
  return;
}

Fixed version (ground truth):
private void pushPropInfo(String elementName){
  ProcessingInfo parentPI=peek(processingStack);
  if ((elementName != null) && (parentPI != null) && (parentPI.lastUnderlyingPI != null)&& (elementName.equals(parentPI.lastUnderlyingPI.elementName))) {
    processingStack.add(new ProcessingInfo(parentPI.lastUnderlyingPI));
    return;
  }
  final XMLSerializer xs=XMLSerializer.getInstance();
  final Property cp=(xs == null) ? null : xs.getCurrentProperty();
  final RuntimePropertyInfo ri=(cp == null) ? null : cp.getInfo();
  final Type rt=(ri == null) ? null : ri.getRawType();
  final String dn=(ri == null) ? null : ri.getName();
  if (null == rt) {
    if (writingAttr) {
      processingStack.add(new ProcessingInfo(elementName,ri,false,null));
      return;
    }
 else {
      processingStack.add(new ProcessingInfo(elementName,ri,false,null));
      return;
    }
  }
  if (primitiveTypes.contains(rt)) {
    processingStack.add(new ProcessingInfo(elementName,ri,false,rt));
    return;
  }
  if (ri.isCollection() && !isWildcardElement(ri)) {
    if (!((parentPI != null) && (parentPI.isArray) && (parentPI.rpi == ri))) {
      processingStack.add(new ProcessingInfo(elementName,ri,true,rt));
      return;
    }
  }
  processingStack.add(new ProcessingInfo(elementName,ri,false,rt));
  return;
}
Program: 51223
Project: 51223
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + currentName + "String_Node_Str"+ ((writer != null) ? writer.getContent() : null)+ "String_Node_Str"+ lastName+ "String_Node_Str"+ ((lastElementWriter != null) ? lastElementWriter.getContent() : null)+ "String_Node_Str";
}

Fixed version (ground truth):
@Override public String toString(){
  return String.format("String_Node_Str",currentName,((writer != null) ? writer.getContent() : null),lastName,((lastElementWriter != null) ? lastElementWriter.getContent() : null));
}
Program: 51225
Project: 51225
Buggy source:
/** 
 * This is only a sample main method, you can experiment on your own by using above implemented methods.
 */
public static void main(String[] args){
  String uri, username, password;
  if (args.length < 3) {
    uri=BASE_URI.toString();
    username="String_Node_Str";
    password="String_Node_Str";
  }
 else {
    uri=args[0];
    username=args[1];
    password=args[2];
  }
  ContactsClient client=new ContactsClient(uri,username,password);
  User bob=new User();
  bob.setUsername("String_Node_Str");
  bob.setPassword("String_Node_Str");
  client.createUser(bob);
  Contact c=new Contact();
  c.setName("String_Node_Str");
  c.setContent("String_Node_Str");
  EmailAddress email=new EmailAddress("String_Node_Str","String_Node_Str",true,"String_Node_Str");
  c.getEmailAddresses().add(email);
  client.createContact(bob.getUsername(),c);
}

Fixed version (ground truth):
/** 
 * This is only a sample main method, you can experiment on your own by using above implemented methods.
 */
public static void main(String[] args){
  String uri, username, password;
  if (args.length < 3) {
    uri=BASE_URI.toString();
    username="String_Node_Str";
    password="String_Node_Str";
  }
 else {
    uri=args[0];
    username=args[1];
    password=args[2];
  }
  ContactsClient client=new ContactsClient(uri,username,password);
  User bob=new User();
  bob.setUsername("String_Node_Str");
  bob.setPassword("String_Node_Str");
  if (client.doesUserExist(bob.getUsername())) {
    System.out.println("String_Node_Str");
    return;
  }
 else {
    System.out.println("String_Node_Str");
  }
  client.createUser(bob);
  Contact c=new Contact();
  c.setName("String_Node_Str");
  c.setContent("String_Node_Str");
  EmailAddress email=new EmailAddress("String_Node_Str","String_Node_Str",true,"String_Node_Str");
  c.getEmailAddresses().add(email);
  client.createContact(bob.getUsername(),c);
}
Program: 51227
Project: 51227
Buggy source:
private User authenticate(ContainerRequest request){
  String authentication=request.getHeaderValue(ContainerRequest.AUTHORIZATION);
  if (authentication == null) {
    throw new MappableContainerException(new AuthenticationException("String_Node_Str",REALM));
  }
  if (!authentication.startsWith("String_Node_Str")) {
    return null;
  }
  authentication=authentication.substring("String_Node_Str".length());
  String[] values=new String(Base64.base64Decode(authentication)).split("String_Node_Str");
  if (values.length < 2) {
    return null;
  }
  String username=values[0];
  String password=values[1];
  if ((username == null) || (password == null)) {
    return null;
  }
  User user=null;
  if (username.equals("String_Node_Str") && password.trim().equals("String_Node_Str")) {
    user=new User("String_Node_Str","String_Node_Str");
    System.out.println("String_Node_Str");
  }
 else {
    System.out.println("String_Node_Str");
    throw new MappableContainerException(new AuthenticationException("String_Node_Str",REALM));
  }
  return user;
}

Fixed version (ground truth):
private User authenticate(ContainerRequest request){
  String authentication=request.getHeaderValue(ContainerRequest.AUTHORIZATION);
  if (authentication == null) {
    throw new MappableContainerException(new AuthenticationException("String_Node_Str",REALM));
  }
  if (!authentication.startsWith("String_Node_Str")) {
    return null;
  }
  authentication=authentication.substring("String_Node_Str".length());
  String[] values=new String(Base64.base64Decode(authentication)).split("String_Node_Str");
  if (values.length < 2) {
    return null;
  }
  String username=values[0];
  String password=values[1];
  if ((username == null) || (password == null)) {
    return null;
  }
  User user=null;
  if (username.equals("String_Node_Str") && password.equals("String_Node_Str")) {
    user=new User("String_Node_Str","String_Node_Str");
    System.out.println("String_Node_Str");
  }
 else {
    System.out.println("String_Node_Str");
    throw new MappableContainerException(new AuthenticationException("String_Node_Str",REALM));
  }
  return user;
}
Program: 51228
Project: 51228
Buggy source:
/** 
 * Creates a new HTTP Basic Authentication filter using provided username and password credentials
 * @param username
 * @param password
 */
public HTTPBasicAuthFilter(final String username,final String password){
  authentication="String_Node_Str" + encodeCredentialsBasic(username,password);
}

Fixed version (ground truth):
/** 
 * Creates a new HTTP Basic Authentication filter using provided username and password credentials
 * @param username
 * @param password
 */
public HTTPBasicAuthFilter(final String username,final String password){
  authentication="String_Node_Str" + Base64.encode(username + "String_Node_Str" + password);
}
Program: 51229
Project: 51229
Buggy source:
/** 
 * Set the status code.
 * @param status the status code.
 */
public void setStatus(int status){
  this.status=status;
}

Fixed version (ground truth):
/** 
 * Set the status code.
 * @param status the status code.
 */
public void setStatus(Response.StatusType status){
  setStatus(status.getStatusCode());
}
Program: 51230
Project: 51230
Buggy source:
/** 
 * Set the status code.
 * @param status the status code.
 */
public void setResponseStatus(Response.Status status){
  setStatus(status.getStatusCode());
}

Fixed version (ground truth):
/** 
 * Set the status code.
 * @param status the status code.
 * @deprecated see {@link #setStatus(javax.ws.rs.core.Response.StatusType) }
 */
@Deprecated public void setResponseStatus(Response.StatusType status){
  setStatus(status);
}
Program: 51231
Project: 51231
Buggy source:
/** 
 * Get the status code.
 * @return the status code, or null if the underlying status code was setusing the method  {@link #setStatus(int)} and there is nomapping between the the integer value and the Response.Status enumeration value.
 */
public Response.Status getResponseStatus(){
  return Response.Status.fromStatusCode(status);
}

Fixed version (ground truth):
/** 
 * Get the status code.
 * @return the status code, or null if the underlying status code was setusing the method  {@link #setStatus(int)} and there is nomapping between the the integer value and the Response.Status enumeration value.
 * @deprecated use {@link #getClientResponseStatus()}
 */
@Deprecated public Response.Status getResponseStatus(){
  return Response.Status.fromStatusCode(status);
}
Program: 51232
Project: 51232
Buggy source:
@Override public UriBuilder replaceQueryParam(String name,Object... values){
  checkSsp();
  if (queryParams == null) {
    queryParams=UriComponent.decodeQuery(query.toString(),false);
    query.setLength(0);
  }
  queryParams.remove(name);
  for (  Object value : values) {
    queryParams.add(name,value.toString());
  }
  return this;
}

Fixed version (ground truth):
@Override public UriBuilder replaceQueryParam(String name,Object... values){
  checkSsp();
  if (queryParams == null) {
    queryParams=UriComponent.decodeQuery(query.toString(),false);
    query.setLength(0);
  }
  queryParams.remove(name);
  if (values == null)   return this;
  for (  Object value : values) {
    if (value != null && !value.equals("String_Node_Str"))     queryParams.add(name,value.toString());
  }
  return this;
}
Program: 51233
Project: 51233
Buggy source:
public void testReplaceQueryParams(){
  UriBuilder ubu=UriBuilder.fromUri("String_Node_Str").replaceQueryParam("String_Node_Str","String_Node_Str","String_Node_Str").queryParam("String_Node_Str","String_Node_Str");
{
    URI bu=ubu.build();
    MultivaluedMap<String,String> qps=UriComponent.decodeQuery(bu,true);
    List<String> a=qps.get("String_Node_Str");
    assertEquals(2,a.size());
    assertEquals("String_Node_Str",a.get(0));
    assertEquals("String_Node_Str",a.get(1));
    List<String> b=qps.get("String_Node_Str");
    assertEquals(1,b.size());
    assertEquals("String_Node_Str",b.get(0));
    List<String> c=qps.get("String_Node_Str");
    assertEquals(1,c.size());
    assertEquals("String_Node_Str",c.get(0));
  }
{
    URI bu=ubu.replaceQueryParam("String_Node_Str","String_Node_Str","String_Node_Str").build();
    MultivaluedMap<String,String> qps=UriComponent.decodeQuery(bu,true);
    List<String> a=qps.get("String_Node_Str");
    assertEquals(2,a.size());
    assertEquals("String_Node_Str",a.get(0));
    assertEquals("String_Node_Str",a.get(1));
    List<String> b=qps.get("String_Node_Str");
    assertEquals(1,b.size());
    assertEquals("String_Node_Str",b.get(0));
    List<String> c=qps.get("String_Node_Str");
    assertEquals(1,c.size());
    assertEquals("String_Node_Str",c.get(0));
  }
}

Fixed version (ground truth):
public void testReplaceQueryParams(){
  UriBuilder ubu=UriBuilder.fromUri("String_Node_Str").replaceQueryParam("String_Node_Str","String_Node_Str","String_Node_Str").queryParam("String_Node_Str","String_Node_Str");
{
    URI bu=ubu.build();
    MultivaluedMap<String,String> qps=UriComponent.decodeQuery(bu,true);
    List<String> a=qps.get("String_Node_Str");
    assertEquals(2,a.size());
    assertEquals("String_Node_Str",a.get(0));
    assertEquals("String_Node_Str",a.get(1));
    List<String> b=qps.get("String_Node_Str");
    assertEquals(1,b.size());
    assertEquals("String_Node_Str",b.get(0));
    List<String> c=qps.get("String_Node_Str");
    assertEquals(1,c.size());
    assertEquals("String_Node_Str",c.get(0));
  }
{
    URI bu=ubu.replaceQueryParam("String_Node_Str","String_Node_Str","String_Node_Str").build();
    MultivaluedMap<String,String> qps=UriComponent.decodeQuery(bu,true);
    List<String> a=qps.get("String_Node_Str");
    assertEquals(2,a.size());
    assertEquals("String_Node_Str",a.get(0));
    assertEquals("String_Node_Str",a.get(1));
    List<String> b=qps.get("String_Node_Str");
    assertEquals(1,b.size());
    assertEquals("String_Node_Str",b.get(0));
    List<String> c=qps.get("String_Node_Str");
    assertEquals(1,c.size());
    assertEquals("String_Node_Str",c.get(0));
  }
{
    URI u=UriBuilder.fromPath("String_Node_Str").queryParam("String_Node_Str","String_Node_Str").replaceQueryParam("String_Node_Str",null).build();
    assertTrue(u.toString().equals("String_Node_Str"));
  }
{
    URI u=UriBuilder.fromPath("String_Node_Str").queryParam("String_Node_Str","String_Node_Str").replaceQueryParam("String_Node_Str","String_Node_Str",null,"String_Node_Str").build();
    assertTrue(u.toString().equals("String_Node_Str"));
  }
}
Program: 51236
Project: 51236
Buggy source:
private void checkParameters(Method m){
  Annotation[][] pas=m.getParameterAnnotations();
  int paramCount=0;
  for (  Annotation[] pa : pas) {
    paramCount++;
    int annotCount=0;
    for (    Annotation a : pa) {
      if (ParamAnnotationSET.contains(a.annotationType())) {
        annotCount++;
        if (annotCount > 1) {
          issueList.add(new ResourceModelIssue(m,ImplMessages.AMBIGUOUS_PARAMETER(m.toString(),Integer.toString(paramCount)),false));
          break;
        }
      }
    }
  }
}

Fixed version (ground truth):
private void checkParameters(Method m){
  Annotation[][] pas=m.getParameterAnnotations();
  int paramCount=0;
  for (  Annotation[] pa : pas) {
    paramCount++;
    checkParameter(m,m.toString(),Integer.toString(paramCount),pa);
  }
}
Program: 51238
Project: 51238
Buggy source:
public void testAmbiguousParams() throws Exception {
  System.out.println("String_Node_Str");
  AbstractResource ar=IntrospectionModeller.createResource(TestAmbiguousParams.class);
  BasicValidator validator=new BasicValidator();
  validator.validate(ar);
  printIssueList(validator);
  assertTrue(!validator.fatalIssuesFound());
  assertEquals(4,validator.getIssueList().size());
}

Fixed version (ground truth):
public void testAmbiguousParams() throws Exception {
  System.out.println("String_Node_Str");
  AbstractResource ar=IntrospectionModeller.createResource(TestAmbiguousParams.class);
  BasicValidator validator=new BasicValidator();
  validator.validate(ar);
  printIssueList(validator);
  assertTrue(!validator.fatalIssuesFound());
  assertEquals(6,validator.getIssueList().size());
}
Program: 51239
Project: 51239
Buggy source:
/** 
 * Create ConnectionListener filter.
 * @param listenerFactory {@link BytesTransferredListenerFactory} instance
 */
public ConnectionListenerFilter(OnStartConnectionListener listenerFactory){
  if (listenerFactory == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.listenerFactory=listenerFactory;
}

Fixed version (ground truth):
/** 
 * Creates ConnectionListenerFilter.
 * @param listenerFactory {@link OnStartConnectionListener} instance
 */
public ConnectionListenerFilter(OnStartConnectionListener listenerFactory){
  if (listenerFactory == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.listenerFactory=listenerFactory;
}
Program: 51240
Project: 51240
Buggy source:
public boolean accept(CharSequence path,Object resource,UriRuleContext context){
  pushMatch(context);
  resource=invokeSubLocator(resource,context);
  if (resource instanceof Class) {
    resource=context.getResource((Class)resource);
  }
  context.pushResource(resource);
  final Iterator<UriRule> matches=context.getRules(resource.getClass()).match(path,context);
  while (matches.hasNext())   if (matches.next().accept(path,resource,context))   return true;
  return false;
}

Fixed version (ground truth):
public boolean accept(CharSequence path,Object resource,UriRuleContext context){
  pushMatch(context);
  resource=invokeSubLocator(resource,context);
  if (resource == null)   return false;
  if (resource instanceof Class) {
    resource=context.getResource((Class)resource);
  }
  context.pushResource(resource);
  final Iterator<UriRule> matches=context.getRules(resource.getClass()).match(path,context);
  while (matches.hasNext())   if (matches.next().accept(path,resource,context))   return true;
  return false;
}
Program: 51241
Project: 51241
Buggy source:
private static int createURIComponent(final UriComponent.Type t,String template,final String[] values,final int offset,final boolean encode,final Map<String,String> mapValues,final StringBuilder b){
  if (template.indexOf('{') == -1) {
    b.append(template);
    return offset;
  }
  template=new UriTemplateParser(template).getNormalizedTemplate();
  final Matcher m=TEMPLATE_NAMES_PATTERN.matcher(template);
  int v=offset;
  int i=0;
  while (m.find()) {
    b.append(template,i,m.start());
    final String tVariable=m.group(1);
    String tValue=mapValues.get(tVariable);
    if (tValue != null) {
      b.append(tValue);
    }
 else {
      if (v < values.length) {
        tValue=values[v++];
        if (tValue != null) {
          mapValues.put(tVariable,tValue);
          if (encode)           tValue=UriComponent.encode(tValue,t);
 else           tValue=UriComponent.contextualEncode(tValue,t);
          b.append(tValue);
        }
 else {
          throw new IllegalArgumentException("String_Node_Str" + tVariable + "String_Node_Str");
        }
      }
    }
    i=m.end();
  }
  b.append(template,i,template.length());
  return v;
}

Fixed version (ground truth):
private static int createURIComponent(final UriComponent.Type t,String template,final String[] values,final int offset,final boolean encode,final Map<String,String> mapValues,final StringBuilder b){
  if (template.indexOf('{') == -1) {
    b.append(template);
    return offset;
  }
  template=new UriTemplateParser(template).getNormalizedTemplate();
  final Matcher m=TEMPLATE_NAMES_PATTERN.matcher(template);
  int v=offset;
  int i=0;
  while (m.find()) {
    b.append(template,i,m.start());
    final String tVariable=m.group(1);
    String tValue=mapValues.get(tVariable);
    if (tValue != null) {
      b.append(tValue);
    }
 else     if (v < values.length) {
      tValue=values[v++];
      if (tValue != null) {
        if (encode)         tValue=UriComponent.encode(tValue,t);
 else         tValue=UriComponent.contextualEncode(tValue,t);
        mapValues.put(tVariable,tValue);
        b.append(tValue);
      }
 else {
        throw templateVariableHasNoValue(tVariable);
      }
    }
 else {
      throw templateVariableHasNoValue(tVariable);
    }
    i=m.end();
  }
  b.append(template,i,template.length());
  return v;
}
Program: 51242
Project: 51242
Buggy source:
public void testBuildEncodedQuery(){
  URI u=UriBuilder.fromPath("String_Node_Str").queryParam("String_Node_Str","String_Node_Str").build();
  assertEquals(URI.create("String_Node_Str"),u);
}

Fixed version (ground truth):
public void testBuildEncodedQuery(){
  URI u=UriBuilder.fromPath("String_Node_Str").queryParam("String_Node_Str","String_Node_Str").build();
  assertEquals(URI.create("String_Node_Str"),u);
  u=UriBuilder.fromPath("String_Node_Str").path("String_Node_Str").buildFromEncoded("String_Node_Str","String_Node_Str","String_Node_Str");
  assertEquals(URI.create("String_Node_Str"),u);
}
Program: 51243
Project: 51243
Buggy source:
public EntityTag fromString(String header){
  if (header == null)   throw new IllegalArgumentException("String_Node_Str");
  boolean weak=false;
  if (header.startsWith("String_Node_Str")) {
    header=header.substring(2);
    weak=true;
  }
  HttpHeaderReader reader=HttpHeaderReader.newInstance(header);
  try {
    EntityTag eTag=new EntityTag(reader.nextQuotedString(),weak);
    return eTag;
  }
 catch (  ParseException ex) {
    throw new IllegalArgumentException("String_Node_Str" + header + "String_Node_Str",ex);
  }
}

Fixed version (ground truth):
public EntityTag fromString(String header){
  if (header == null)   throw new IllegalArgumentException("String_Node_Str");
  try {
    HttpHeaderReader reader=HttpHeaderReader.newInstance(header);
    Event e=reader.next(false);
    if (e == Event.QuotedString) {
      return new EntityTag(reader.getEventValue());
    }
 else     if (e == Event.Token) {
      if (reader.getEventValue().equals("String_Node_Str")) {
        reader.nextSeparator('/');
        return new EntityTag(reader.nextQuotedString(),true);
      }
    }
  }
 catch (  ParseException ex) {
    throw new IllegalArgumentException("String_Node_Str" + header + "String_Node_Str",ex);
  }
  throw new IllegalArgumentException("String_Node_Str" + header + "String_Node_Str");
}
Program: 51244
Project: 51244
Buggy source:
/** 
 * Specify the property value for the current   {@link WadlGenerator}.<br/> The   {@link WadlGenerator} property can be of type {@link String},   {@link File} or any other type that providesa  {@link String} constructor.If the  {@link WadlGenerator} property is of type {@link File}, then the specified property value can start with the prefix <em>classpath:</em> to denote, that the File shall be loaded from the classpath like this: <pre><code>new File( generator.getClass().getResource( strippedFilename ).toURI() )</code></pre> Notice that the file is loaded as a resource from the classpath in this case, therefore <em>classpath:test.xml</em> refers to a file in the package of the specified <code>&lt;classname&gt;</code>. The file reference <em>classpath:/test.xml</em> refers to a file that is in the root of the classpath.
 * @param propName the property name
 * @param propValue the stringified property value
 * @return this builder instance
 */
public WadlGeneratorConfigDescriptionBuilder prop(String propName,String propValue){
  if (_description.getProperties() == null) {
    _description.setProperties(new Properties());
  }
  _description.getProperties().put(propName,propValue);
  return this;
}

Fixed version (ground truth):
/** 
 * Specify the property value for the current   {@link WadlGenerator}. <p> The   {@link WadlGenerator} property can be of type {@link String},   {@link File},   {@link InputStream}or any type that provides a   {@link String} constructor.</p> <p> If the  {@link WadlGenerator} property is of type {@link File}, then the specified property value can start with the prefix <em>classpath:</em> to denote, that the File shall be loaded from the classpath like this: <pre><code>new File( generator.getClass().getResource( strippedFilename ).toURI() )</code></pre> Notice that the file is loaded as a resource from the classpath in this case, therefore <em>classpath:test.xml</em> refers to a file in the package of the specified <code>&lt;classname&gt;</code>. The file reference <em>classpath:/test.xml</em> refers to a file that is in the root of the classpath. </p> <p> If the   {@link WadlGenerator} property is of type {@link InputStream}, then the specified property value is loaded with   {@link ClassLoader#getResourceAsStream(String)} using the current threads context classloader.The  {@link InputStream} will be closed after {@link WadlGenerator#init()} was called and therefore must not be closedby the  {@link WadlGenerator} using this stream.</p>
 * @param propName the property name
 * @param propValue the stringified property value
 * @return this builder instance
 */
public WadlGeneratorConfigDescriptionBuilder prop(String propName,String propValue){
  if (_description.getProperties() == null) {
    _description.setProperties(new Properties());
  }
  _description.getProperties().put(propName,propValue);
  return this;
}
Program: 51245
Project: 51245
Buggy source:
static WadlGenerator loadWadlGeneratorDescriptions(List<WadlGeneratorDescription> wadlGeneratorDescriptions) throws Exception {
  WadlGenerator wadlGenerator=new WadlGeneratorImpl();
  if (wadlGeneratorDescriptions != null && !wadlGeneratorDescriptions.isEmpty()) {
    for (    WadlGeneratorDescription wadlGeneratorDescription : wadlGeneratorDescriptions) {
      wadlGenerator=loadWadlGenerator(wadlGeneratorDescription,wadlGenerator);
    }
  }
  wadlGenerator.init();
  return wadlGenerator;
}

Fixed version (ground truth):
static WadlGenerator loadWadlGeneratorDescriptions(List<WadlGeneratorDescription> wadlGeneratorDescriptions) throws Exception {
  WadlGenerator wadlGenerator=new WadlGeneratorImpl();
  final CallbackList callbacks=new CallbackList();
  try {
    if (wadlGeneratorDescriptions != null && !wadlGeneratorDescriptions.isEmpty()) {
      for (      WadlGeneratorDescription wadlGeneratorDescription : wadlGeneratorDescriptions) {
        final WadlGeneratorControl control=loadWadlGenerator(wadlGeneratorDescription,wadlGenerator);
        wadlGenerator=control.wadlGenerator;
        callbacks.add(control.callback);
      }
    }
    wadlGenerator.init();
  }
  finally {
    callbacks.callback();
  }
  return wadlGenerator;
}
Program: 51247
Project: 51247
Buggy source:
private static WadlGenerator loadWadlGenerator(WadlGeneratorDescription wadlGeneratorDescription,com.sun.jersey.server.wadl.WadlGenerator wadlGeneratorDelegate) throws Exception {
  LOGGER.info("String_Node_Str" + wadlGeneratorDescription.getGeneratorClass().getName());
  final WadlGenerator generator=wadlGeneratorDescription.getGeneratorClass().newInstance();
  generator.setWadlGeneratorDelegate(wadlGeneratorDelegate);
  if (wadlGeneratorDescription.getProperties() != null && !wadlGeneratorDescription.getProperties().isEmpty()) {
    for (    Entry<Object,Object> entry : wadlGeneratorDescription.getProperties().entrySet()) {
      setProperty(generator,entry.getKey().toString(),entry.getValue());
    }
  }
  return generator;
}

Fixed version (ground truth):
private static WadlGeneratorControl loadWadlGenerator(WadlGeneratorDescription wadlGeneratorDescription,com.sun.jersey.server.wadl.WadlGenerator wadlGeneratorDelegate) throws Exception {
  LOGGER.info("String_Node_Str" + wadlGeneratorDescription.getGeneratorClass().getName());
  final WadlGenerator generator=wadlGeneratorDescription.getGeneratorClass().newInstance();
  generator.setWadlGeneratorDelegate(wadlGeneratorDelegate);
  CallbackList callbacks=null;
  if (wadlGeneratorDescription.getProperties() != null && !wadlGeneratorDescription.getProperties().isEmpty()) {
    callbacks=new CallbackList();
    for (    Entry<Object,Object> entry : wadlGeneratorDescription.getProperties().entrySet()) {
      final Callback callback=setProperty(generator,entry.getKey().toString(),entry.getValue());
      callbacks.add(callback);
    }
  }
  return new WadlGeneratorControl(generator,callbacks);
}
Program: 51248
Project: 51248
Buggy source:
public Collection<String> getNonStrings(){
  return (nonStrings != null) ? Collections.unmodifiableCollection(nonStrings) : null;
}

Fixed version (ground truth):
/** 
 * Returns names of JSON objects, which will be serialized out as non-strings, i.e. without delimiting their values with double quotes
 * @return name of non-string JSON objects
 * @see Builder#nonStrings(java.lang.String[])
 */
public Collection<String> getNonStrings(){
  return (nonStrings != null) ? Collections.unmodifiableCollection(nonStrings) : null;
}
Program: 51249
Project: 51249
Buggy source:
public Collection<String> getArrays(){
  return (arrays != null) ? Collections.unmodifiableCollection(arrays) : null;
}

Fixed version (ground truth):
/** 
 * Returns JSON array names property
 * @return collection of array names
 * @see Builder#arrays(java.lang.String[]) 
 */
public Collection<String> getArrays(){
  return (arrays != null) ? Collections.unmodifiableCollection(arrays) : null;
}
Program: 51250
Project: 51250
Buggy source:
public boolean isRootUnwrapping(){
  return rootUnwrapping;
}

Fixed version (ground truth):
/** 
 * Says if the root element will be stripped off
 * @return true, if root element has to be stripped off
 * @see Builder#rootUnwrapping(boolean) 
 */
public boolean isRootUnwrapping(){
  return rootUnwrapping;
}
Program: 51251
Project: 51251
Buggy source:
public Notation getNotation(){
  return notation;
}

Fixed version (ground truth):
/** 
 * Returns JSON notation selected for this configuration
 * @return JSON notation
 */
public Notation getNotation(){
  return notation;
}
Program: 51253
Project: 51253
Buggy source:
/** 
 * Scans packages for matching Java classes.
 * @param packages An array of packages to search.
 * @return The set of matching classes that are annotated with one or more ofthe specified annotations.
 */
public Set<Class<?>> scan(String[] packages){
  this.classes=new HashSet<Class<?>>();
  for (  String p : packages) {
    try {
      String fileP=p.replace('.','/');
      Enumeration<URL> urls=classloader.getResources(fileP);
      while (urls.hasMoreElements()) {
        URL url=urls.nextElement();
        try {
          URI uri=url.toURI();
          index(uri,fileP);
        }
 catch (        URISyntaxException e) {
          LOGGER.warning("String_Node_Str" + url + "String_Node_Str");
        }
      }
    }
 catch (    IOException ex) {
      String s="String_Node_Str" + p + "String_Node_Str";
      LOGGER.severe(s);
      throw new RuntimeException(s,ex);
    }
  }
  return classes;
}

Fixed version (ground truth):
/** 
 * Scans packages for matching Java classes.
 * @param packages An array of packages to search.
 * @return The set of matching classes that are annotated with one or more ofthe specified annotations.
 */
public Set<Class<?>> scan(String[] packages){
  this.classes=new HashSet<Class<?>>();
  for (  String p : packages) {
    try {
      String fileP=p.replace('.','/');
      Enumeration<URL> urls=classloader.getResources(fileP);
      while (urls.hasMoreElements()) {
        URL url=urls.nextElement();
        try {
          URI uri=getURI(url);
          index(uri,fileP);
        }
 catch (        URISyntaxException e) {
          LOGGER.warning("String_Node_Str" + url + "String_Node_Str");
        }
      }
    }
 catch (    IOException ex) {
      String s="String_Node_Str" + p + "String_Node_Str";
      LOGGER.severe(s);
      throw new RuntimeException(s,ex);
    }
  }
  return classes;
}
Program: 51254
Project: 51254
Buggy source:
@Override public int hashCode(){
  return u.hashCode();
}

Fixed version (ground truth):
/** 
 * Returns a hash code for this <code>WebResource</code>. <p> The hash code is the hash code of URI of this <code>WebResource</code>.
 * @return a hash code for this <code>WebResource</code>.
 */
@Override public int hashCode(){
  return u.hashCode();
}
Program: 51255
Project: 51255
Buggy source:
@Override public boolean equals(Object obj){
  if (this == obj)   return true;
  if (obj instanceof WebResource) {
    final AsyncWebResource that=(AsyncWebResource)obj;
    return that.u.equals(this.u);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Compares this resource to the specified object. <p> The result is true if and only if the argument is not null and is a <code>WebResource</code> object whose URI is equal to the URI of this <code>WebResource</code>.
 * @param obj the object to compare this <code>WebResource</code> against.
 * @return true if the <code>WebResource</code> are equal; false otherwise.
 */
@Override public boolean equals(Object obj){
  if (this == obj)   return true;
  if (obj instanceof WebResource) {
    final AsyncWebResource that=(AsyncWebResource)obj;
    return that.u.equals(this.u);
  }
  return false;
}
Program: 51256
Project: 51256
Buggy source:
@Override public int hashCode(){
  return u.hashCode();
}

Fixed version (ground truth):
/** 
 * Returns a hash code for this <code>WebResource</code>. <p> The hash code is the hash code of URI of this <code>WebResource</code>.
 * @return a hash code for this <code>WebResource</code>.
 */
@Override public int hashCode(){
  return u.hashCode();
}
Program: 51257
Project: 51257
Buggy source:
@Override public boolean equals(Object obj){
  if (this == obj)   return true;
  if (obj instanceof WebResource) {
    final WebResource that=(WebResource)obj;
    return that.u.equals(this.u);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Compares this resource to the specified object. <p> The result is true if and only if the argument is not null and is a <code>WebResource</code> object whose URI is equal to the URI of this <code>WebResource</code>.
 * @param obj the object to compare this <code>WebResource</code> against.
 * @return true if the <code>WebResource</code> are equal; false otherwise.
 */
@Override public boolean equals(Object obj){
  if (this == obj)   return true;
  if (obj instanceof WebResource) {
    final WebResource that=(WebResource)obj;
    return that.u.equals(this.u);
  }
  return false;
}
Program: 51258
Project: 51258
Buggy source:
public void onReload(){
  application=application.clone();
}

Fixed version (ground truth):
public void onReload(){
  WebApplication oldApplication=application;
  application=application.clone();
  oldApplication.destroy();
}
Program: 51259
Project: 51259
Buggy source:
public void onReload(){
  application=application.clone();
}

Fixed version (ground truth):
public void onReload(){
  WebApplication oldApplication=application;
  application=application.clone();
  oldApplication.destroy();
}
Program: 51260
Project: 51260
Buggy source:
/** 
 * Reload the Web application. This will create and initiate the web application using the same   {@link ResourceConfig} implementationthat was used to load the Web application. <p> This method may be called at runtime, more than once, to reload the Web application. For example, if a  {@link ResourceConfig} implementationis capable of detecting changes to resource classes (addition or removal) or providers then this method may be invoked to reload the web application for such changes to take effect. <p> If this method is called when there are pending requests then such requests will be processed using the previously loaded web application.
 */
public final void reload(){
  WebApplication _application=create();
  initiate(resourceConfig,_application);
  application=_application;
}

Fixed version (ground truth):
/** 
 * Reload the Web application. This will create and initiate the web application using the same   {@link ResourceConfig} implementationthat was used to load the Web application. <p> This method may be called at runtime, more than once, to reload the Web application. For example, if a  {@link ResourceConfig} implementationis capable of detecting changes to resource classes (addition or removal) or providers then this method may be invoked to reload the web application for such changes to take effect. <p> If this method is called when there are pending requests then such requests will be processed using the previously loaded web application.
 */
public final void reload(){
  WebApplication oldApplication=application;
  WebApplication newApplication=create();
  initiate(resourceConfig,newApplication);
  application=newApplication;
  oldApplication.destroy();
}
Program: 51261
Project: 51261
Buggy source:
public Locale getLanguage(){
  final String localeString=this.getRequestHeaders().getFirst(HttpHeaders.CONTENT_LANGUAGE);
  if (localeString == null)   return null;
  return new Locale(localeString);
}

Fixed version (ground truth):
public Locale getLanguage(){
  return HttpHelper.getContentLanguageAsLocale(this);
}
Program: 51262
Project: 51262
Buggy source:
private Request generateRequest(AbstractResource r,final AbstractResourceMethod m,Map<String,Param> wadlResourceParams){
  if (m.getParameters().size() == 0)   return null;
  Request wadlRequest=_wadlGenerator.createRequest(r,m);
  for (  Parameter p : m.getParameters()) {
    if (p.getSource() == Parameter.Source.ENTITY) {
      for (      MediaType mediaType : m.getSupportedInputTypes()) {
        RepresentationType wadlRepresentation=_wadlGenerator.createRequestRepresentation(r,m,mediaType);
        wadlRequest.getRepresentation().add(wadlRepresentation);
      }
    }
 else {
      Param wadlParam=generateParam(r,m,p);
      if (wadlParam == null)       continue;
      if (wadlParam.getStyle() == ParamStyle.TEMPLATE)       wadlResourceParams.put(wadlParam.getName(),wadlParam);
 else       wadlRequest.getParam().add(wadlParam);
    }
  }
  if (wadlRequest.getRepresentation().size() + wadlRequest.getParam().size() == 0)   return null;
 else   return wadlRequest;
}

Fixed version (ground truth):
private Request generateRequest(AbstractResource r,final AbstractResourceMethod m,Map<String,Param> wadlResourceParams){
  if (m.getParameters().size() == 0)   return null;
  Request wadlRequest=_wadlGenerator.createRequest(r,m);
  for (  Parameter p : m.getParameters()) {
    if (p.getSource() == Parameter.Source.ENTITY) {
      for (      MediaType mediaType : m.getSupportedInputTypes()) {
        setRepresentationForMediaType(r,m,mediaType,wadlRequest);
      }
    }
 else     if (p.getAnnotation().annotationType() == FormParam.class) {
      for (      MediaType mediaType : m.getSupportedInputTypes()) {
        final RepresentationType wadlRepresentation=setRepresentationForMediaType(r,m,mediaType,wadlRequest);
        if (getParamByName(wadlRepresentation.getParam(),p.getSourceName()) == null) {
          final Param wadlParam=generateParam(r,m,p);
          if (wadlParam != null) {
            wadlRepresentation.getParam().add(wadlParam);
          }
        }
      }
    }
 else {
      Param wadlParam=generateParam(r,m,p);
      if (wadlParam == null)       continue;
      if (wadlParam.getStyle() == ParamStyle.TEMPLATE)       wadlResourceParams.put(wadlParam.getName(),wadlParam);
 else       wadlRequest.getParam().add(wadlParam);
    }
  }
  if (wadlRequest.getRepresentation().size() + wadlRequest.getParam().size() == 0)   return null;
 else   return wadlRequest;
}
Program: 51264
Project: 51264
Buggy source:
private <T extends AbstractResourceMethod>void findOutMTAmbiguities(AbstractResource resource,List<T> methods,ResourceMethodAmbiguityErrMsgGenerator generator){
  for (int i=0; i < methods.size(); i++) {
    T arm1=methods.get(i);
    for (int j=i + 1; j < methods.size(); j++) {
      T arm2=methods.get(j);
      if (arm1.getHttpMethod().equalsIgnoreCase(arm2.getHttpMethod())) {
        if (!"String_Node_Str".equalsIgnoreCase(arm1.getHttpMethod())) {
          for (          MediaType mt1 : arm1.getSupportedInputTypes()) {
            for (            MediaType mt2 : arm2.getSupportedInputTypes()) {
              if (mt1.isCompatible(mt2) && (!(mt1.isWildcardType() || mt1.isWildcardSubtype() || mt2.isWildcardType()|| mt2.isWildcardSubtype()))) {
                generator.generateInErrMsg(resource,arm1,arm2,mt1);
              }
            }
          }
        }
        for (        MediaType mt1 : arm1.getSupportedOutputTypes()) {
          for (          MediaType mt2 : arm2.getSupportedOutputTypes()) {
            if (mt1.isCompatible(mt2) && (!(mt1.isWildcardType() || mt1.isWildcardSubtype() || mt2.isWildcardType()|| mt2.isWildcardSubtype()))) {
              generator.generateOutErrMsg(resource,arm1,arm2,mt1);
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
private <T extends AbstractResourceMethod>void findOutMTAmbiguities(AbstractResource resource,List<T> methods,ResourceMethodAmbiguityErrMsgGenerator generator){
  for (int i=0; i < methods.size(); i++) {
    T arm1=methods.get(i);
    for (int j=i + 1; j < methods.size(); j++) {
      T arm2=methods.get(j);
      if (arm1.getHttpMethod().equalsIgnoreCase(arm2.getHttpMethod())) {
        if (!"String_Node_Str".equalsIgnoreCase(arm1.getHttpMethod())) {
          for (          MediaType mt1 : arm1.getSupportedInputTypes()) {
            for (            MediaType mt2 : arm2.getSupportedInputTypes()) {
              if (mt1.isCompatible(mt2) && (!(mt1.isWildcardType() || mt1.isWildcardSubtype() || mt2.isWildcardType()|| mt2.isWildcardSubtype()))) {
                generator.generateInErrMsg(resource,arm1,arm2,mt1);
              }
            }
          }
        }
        for (        MediaType outmt1 : arm1.getSupportedOutputTypes()) {
          for (          MediaType outmt2 : arm2.getSupportedOutputTypes()) {
            if (outmt1.isCompatible(outmt2) && (!(outmt1.isWildcardType() || outmt1.isWildcardSubtype() || outmt2.isWildcardType()|| outmt2.isWildcardSubtype()))) {
              for (              MediaType inmt1 : arm1.getSupportedInputTypes()) {
                for (                MediaType inmt2 : arm2.getSupportedInputTypes()) {
                  if (outmt1.isCompatible(inmt2) && (!(inmt1.isWildcardType() || inmt1.isWildcardSubtype() || inmt2.isWildcardType()|| inmt2.isWildcardSubtype()))) {
                    generator.generateOutErrMsg(resource,arm1,arm2,outmt1);
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
Program: 51265
Project: 51265
Buggy source:
public void testWithApplicationPropertyName(){
  Map<String,String> initParams=new HashMap<String,String>();
  initParams.put(ServletContainer.APPLICATION_CONFIG_CLASS,App.class.getName());
  startServer(initParams);
  WebResource r=Client.create().resource(getUri().path("String_Node_Str").build());
  assertEquals("String_Node_Str",r.get(String.class));
}

Fixed version (ground truth):
public void testWithApplicationPropertyName(){
  Map<String,String> initParams=new HashMap<String,String>();
  initParams.put("String_Node_Str",App.class.getName());
  startServer(initParams);
  WebResource r=Client.create().resource(getUri().path("String_Node_Str").build());
  assertEquals("String_Node_Str",r.get(String.class));
}
Program: 51266
Project: 51266
Buggy source:
@Override public UriBuilder replaceMatrixParam(String name,Object... values){
  checkSsp();
  if (matrixParams == null) {
    int i=path.lastIndexOf("String_Node_Str");
    if (i != -1)     i=0;
    i=path.indexOf("String_Node_Str",i);
    matrixParams=UriComponent.decodeMatrix((i != -1) ? path.substring(i + 1) : "String_Node_Str",false);
    if (i != -1)     path.setLength(i);
  }
  matrixParams.remove(name);
  for (  Object value : values) {
    matrixParams.add(name,value.toString());
  }
  return this;
}

Fixed version (ground truth):
@Override public UriBuilder replaceMatrixParam(String name,Object... values){
  checkSsp();
  if (matrixParams == null) {
    int i=path.lastIndexOf("String_Node_Str");
    if (i != -1)     i=0;
    matrixParams=UriComponent.decodeMatrix((i != -1) ? path.substring(i) : "String_Node_Str",false);
    i=path.indexOf("String_Node_Str",i);
    if (i != -1)     path.setLength(i);
  }
  matrixParams.remove(name);
  for (  Object value : values) {
    matrixParams.add(name,value.toString());
  }
  return this;
}
Program: 51267
Project: 51267
Buggy source:
private boolean match(byte[] search,String container,String item){
  byte[] b=MemoryStore.MS.getItemData(container,item);
  OUTER:   for (int i=0; i < b.length - search.length; i++) {
    int j=0;
    for (; j < search.length; j++) {
      if (b[i + j] != search[j])       continue OUTER;
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
private boolean match(byte[] search,String container,String item){
  byte[] b=MemoryStore.MS.getItemData(container,item);
  OUTER:   for (int i=0; i < b.length - search.length + 1; i++) {
    for (int j=0; j < search.length; j++) {
      if (b[i + j] != search[j])       continue OUTER;
    }
    return true;
  }
  return false;
}
Program: 51268
Project: 51268
Buggy source:
private void encodeQuery(){
  if (queryParams == null || queryParams.isEmpty())   return;
  for (  Map.Entry<String,List<String>> e : queryParams.entrySet()) {
    String name=encode(e.getKey(),UriComponent.Type.QUERY_PARAM);
    for (    String value : e.getValue()) {
      if (query.length() > 0)       query.append('&');
      query.append(name);
      if (value.length() > 0)       query.append('=').append(encode(value,UriComponent.Type.QUERY_PARAM));
    }
  }
  queryParams.clear();
}

Fixed version (ground truth):
private void encodeQuery(){
  if (queryParams == null || queryParams.isEmpty())   return;
  for (  Map.Entry<String,List<String>> e : queryParams.entrySet()) {
    String name=encode(e.getKey(),UriComponent.Type.QUERY_PARAM);
    for (    String value : e.getValue()) {
      if (query.length() > 0)       query.append('&');
      query.append(name);
      if (value.length() > 0)       query.append('=').append(encode(value,UriComponent.Type.QUERY_PARAM));
    }
  }
  queryParams=null;
}