nus-yam/ex-repair huggingface dataset:
Program: 51269
Project: 51269
Buggy source:
private void encodeMatrix(){
  if (matrixParams == null || matrixParams.isEmpty())   return;
  for (  Map.Entry<String,List<String>> e : matrixParams.entrySet()) {
    String name=encode(e.getKey(),UriComponent.Type.MATRIX_PARAM);
    for (    String value : e.getValue()) {
      path.append(';').append(name);
      if (value.length() > 0)       path.append('=').append(encode(value,UriComponent.Type.MATRIX_PARAM));
    }
  }
  matrixParams.clear();
}

Fixed version (ground truth):
private void encodeMatrix(){
  if (matrixParams == null || matrixParams.isEmpty())   return;
  for (  Map.Entry<String,List<String>> e : matrixParams.entrySet()) {
    String name=encode(e.getKey(),UriComponent.Type.MATRIX_PARAM);
    for (    String value : e.getValue()) {
      path.append(';').append(name);
      if (value.length() > 0)       path.append('=').append(encode(value,UriComponent.Type.MATRIX_PARAM));
    }
  }
  matrixParams=null;
}
Program: 51271
Project: 51271
Buggy source:
public void testReplaceQueryParams(){
  URI bu=UriBuilder.fromUri("String_Node_Str").replaceQueryParam("String_Node_Str","String_Node_Str","String_Node_Str").queryParam("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));
  }
}
Program: 51272
Project: 51272
Buggy source:
/** 
 * Need to create an element name for given base, the same name what jaxb would use for appropriate element
 */
public static final String getRootElementName(String baseName){
  StringBuffer result=new StringBuffer();
  Character lastChar=baseName.charAt(0);
  if (Character.isLowerCase(lastChar)) {
    return baseName;
  }
  boolean firstPart=true;
  for (int i=1; i < baseName.length(); i++) {
    if (firstPart) {
      if (Character.isUpperCase(baseName.charAt(i))) {
        result.append(Character.toLowerCase(lastChar));
        lastChar=baseName.charAt(i);
      }
 else {
        if (result.length() < 2) {
          result.append(Character.toLowerCase(lastChar));
        }
 else {
          result.append(lastChar);
        }
        result.append(baseName.charAt(i));
        firstPart=false;
      }
    }
 else {
      result.append(baseName.charAt(i));
    }
  }
  return result.toString();
}

Fixed version (ground truth):
/** 
 * calculating local name of an appropriate XML element, pretty much the same way as it is done by JAXB 2.1 impl (for situations when we want to pretend the element was present in an incoming stream amd all we have is the type information) TODO: work out with JAXB guys a better way of doing it, probably we could take it from an existing JAXBContext?
 */
public static final String getRootElementName(Class<Object> clazz){
  XmlRootElement e=clazz.getAnnotation(XmlRootElement.class);
  if (e == null) {
    return getVariableName(clazz.getSimpleName());
  }
  if ("String_Node_Str".equals(e.name())) {
    return getVariableName(clazz.getSimpleName());
  }
 else {
    return e.name();
  }
}
Program: 51273
Project: 51273
Buggy source:
/** 
 * Constructs a new JSONJAXBContext with a custom set of properties.
 * @param classesToBeBound
 * @throws javax.xml.bind.JAXBException
 */
public JSONJAXBContext(Class[] classesToBeBound,Map<String,Object> properties) throws JAXBException {
  Map<String,Object> workProperties=new HashMap<String,Object>();
  for (  Entry<String,Object> entry : properties.entrySet()) {
    workProperties.put(entry.getKey(),entry.getValue());
  }
  processProperties(workProperties);
  jaxbContext=JAXBContext.newInstance(classesToBeBound,workProperties);
}

Fixed version (ground truth):
/** 
 * Construct a new instance using a specified class loader and  a custom set of properties.
 * @param contextPath list of java package names that contain schemaderived class and/or java to schema (JAXB-annotated) mapped classes
 * @param classLoader 
 * @param properties the custom set of properties.
 * @throws JAXBException if an error was encountered while creating theunderlying JAXBContext.
 */
public JSONJAXBContext(String contextPath,ClassLoader classLoader,Map<String,Object> properties) throws JAXBException {
  jaxbContext=JAXBContext.newInstance(contextPath,classLoader,createProperties(properties));
}
Program: 51274
Project: 51274
Buggy source:
public ResponseBuilder evaluatePreconditions(Date lastModified,EntityTag eTag){
  ResponseBuilder r=evaluateIfMatch(eTag);
  if (r == null) {
    long lastModifiedTime=lastModified.getTime();
    r=evaluateIfUnmodifiedSince(lastModifiedTime);
    if (r == null)     r=evaluateIfNoneMatch(eTag);
    if (r == null)     r=evaluateIfModifiedSince(lastModifiedTime);
  }
  return r;
}

Fixed version (ground truth):
public ResponseBuilder evaluatePreconditions(Date lastModified,EntityTag eTag){
  ResponseBuilder r=evaluateIfMatch(eTag);
  if (r == null) {
    long lastModifiedTime=lastModified.getTime();
    r=evaluateIfUnmodifiedSince(lastModifiedTime);
    if (r == null)     r=evaluateIfNoneMatch(eTag);
    if (r == null)     return null;
    r=evaluateIfModifiedSince(lastModifiedTime);
    if (r != null)     r.tag(eTag);
  }
  return r;
}
Program: 51275
Project: 51275
Buggy source:
public void testIfMatchWithMatchingETag(){
  initiateWebApplication(EtagResource.class);
  resource("String_Node_Str").header("String_Node_Str","String_Node_Str").get(ClientResponse.class);
}

Fixed version (ground truth):
public void testIfMatchWithMatchingETag(){
  initiateWebApplication(EtagResource.class);
  ClientResponse response=resource("String_Node_Str").header("String_Node_Str","String_Node_Str").get(ClientResponse.class);
  assertEquals(200,response.getStatus());
}
Program: 51276
Project: 51276
Buggy source:
public void testIfNonMatchWithoutMatchingETag(){
  initiateWebApplication(EtagResource.class);
  resource("String_Node_Str").header("String_Node_Str","String_Node_Str").get(ClientResponse.class);
}

Fixed version (ground truth):
public void testIfNonMatchWithoutMatchingETag(){
  initiateWebApplication(EtagResource.class);
  ClientResponse response=resource("String_Node_Str").header("String_Node_Str","String_Node_Str").get(ClientResponse.class);
  assertEquals(200,response.getStatus());
}
Program: 51277
Project: 51277
Buggy source:
public void testIfModifiedSinceBeforeLastModified(){
  initiateWebApplication(LastModifiedResource.class);
  resource("String_Node_Str").header("String_Node_Str","String_Node_Str").get(ClientResponse.class);
}

Fixed version (ground truth):
public void testIfModifiedSinceBeforeLastModified(){
  initiateWebApplication(LastModifiedResource.class);
  ClientResponse response=resource("String_Node_Str").header("String_Node_Str","String_Node_Str").get(ClientResponse.class);
  assertEquals(200,response.getStatus());
}
Program: 51278
Project: 51278
Buggy source:
public void testIfUnmodifiedSinceAfterLastModified_IfModifiedSinceBeforeLastModified(){
  initiateWebApplication(LastModifiedResource.class);
  resource("String_Node_Str").header("String_Node_Str","String_Node_Str").header("String_Node_Str","String_Node_Str").get(ClientResponse.class);
}

Fixed version (ground truth):
public void testIfUnmodifiedSinceAfterLastModified_IfModifiedSinceBeforeLastModified(){
  initiateWebApplication(LastModifiedResource.class);
  ClientResponse response=resource("String_Node_Str").header("String_Node_Str","String_Node_Str").header("String_Node_Str","String_Node_Str").get(ClientResponse.class);
  assertEquals(200,response.getStatus());
}
Program: 51279
Project: 51279
Buggy source:
public void testIfMatchWildCard(){
  initiateWebApplication(EtagResource.class);
  resource("String_Node_Str").header("String_Node_Str","String_Node_Str").get(ClientResponse.class);
}

Fixed version (ground truth):
public void testIfMatchWildCard(){
  initiateWebApplication(EtagResource.class);
  ClientResponse response=resource("String_Node_Str").header("String_Node_Str","String_Node_Str").get(ClientResponse.class);
  assertEquals(200,response.getStatus());
}
Program: 51280
Project: 51280
Buggy source:
public void testIfMatchWithMatchingETag_IfNonMatchWithoutMatchingETag(){
  initiateWebApplication(EtagResource.class);
  resource("String_Node_Str").header("String_Node_Str","String_Node_Str").header("String_Node_Str","String_Node_Str").get(ClientResponse.class);
}

Fixed version (ground truth):
public void testIfMatchWithMatchingETag_IfNonMatchWithoutMatchingETag(){
  initiateWebApplication(EtagResource.class);
  ClientResponse response=resource("String_Node_Str").header("String_Node_Str","String_Node_Str").header("String_Node_Str","String_Node_Str").get(ClientResponse.class);
  assertEquals(200,response.getStatus());
}
Program: 51281
Project: 51281
Buggy source:
public void testIfUnmodifiedSinceAfterLastModified(){
  initiateWebApplication(LastModifiedResource.class);
  resource("String_Node_Str").header("String_Node_Str","String_Node_Str").get(ClientResponse.class);
}

Fixed version (ground truth):
public void testIfUnmodifiedSinceAfterLastModified(){
  initiateWebApplication(LastModifiedResource.class);
  ClientResponse response=resource("String_Node_Str").header("String_Node_Str","String_Node_Str").get(ClientResponse.class);
  assertEquals(200,response.getStatus());
}
Program: 51282
Project: 51282
Buggy source:
@GET public Response doGet(){
  ResponseBuilder rb=request.evaluatePreconditions(new EntityTag("String_Node_Str"));
  if (rb != null)   return rb.build();
  return Response.ok("String_Node_Str","String_Node_Str").build();
}

Fixed version (ground truth):
@GET public Response doGet(){
  GregorianCalendar lastModified=new GregorianCalendar(2007,0,0,0,0,0);
  ResponseBuilder rb=request.evaluatePreconditions(lastModified.getTime(),new EntityTag("String_Node_Str"));
  if (rb != null)   return rb.build();
  return Response.ok("String_Node_Str","String_Node_Str").build();
}
Program: 51283
Project: 51283
Buggy source:
public T type(String type){
  getMetadata().putSingle("String_Node_Str",type);
  return (T)this;
}

Fixed version (ground truth):
public T type(String type){
  getMetadata().putSingle("String_Node_Str",MediaType.valueOf(type));
  return (T)this;
}
Program: 51284
Project: 51284
Buggy source:
public Date fromString(String header){
  try {
    return HttpHeaderFactory.createDate(header);
  }
 catch (  ParseException ex) {
    throw new IllegalArgumentException(ex);
  }
}

Fixed version (ground truth):
public Date fromString(String header){
  try {
    return HttpHeaderFactory.createDate(header);
  }
 catch (  ParseException ex) {
    throw new IllegalArgumentException("String_Node_Str" + header + "String_Node_Str",ex);
  }
}
Program: 51285
Project: 51285
Buggy source:
public EntityTag fromString(String header){
  if (header == null)   throw new IllegalArgumentException();
  boolean weak=false;
  if (header.startsWith("String_Node_Str")) {
    header=header.substring(2);
    weak=true;
  }
  HttpHeaderReader reader=new HttpHeaderReaderImpl(header);
  try {
    EntityTag eTag=new EntityTag(reader.nextQuotedString(),weak);
    return eTag;
  }
 catch (  ParseException ex) {
    throw new IllegalArgumentException(ex);
  }
}

Fixed version (ground truth):
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=new HttpHeaderReaderImpl(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);
  }
}
Program: 51286
Project: 51286
Buggy source:
public MediaType fromString(String header){
  if (header == null)   throw new IllegalArgumentException();
  try {
    HttpHeaderReader reader=new HttpHeaderReaderImpl(header);
    reader.hasNext();
    String type=reader.nextToken();
    reader.nextSeparator('/');
    String subType=reader.nextToken();
    Map<String,String> params=null;
    if (reader.hasNext())     params=HttpHeaderReader.readParameters(reader);
    return new MediaType(type,subType,params);
  }
 catch (  ParseException ex) {
    throw new IllegalArgumentException(ex);
  }
}

Fixed version (ground truth):
public MediaType fromString(String header){
  if (header == null)   throw new IllegalArgumentException("String_Node_Str");
  try {
    HttpHeaderReader reader=new HttpHeaderReaderImpl(header);
    reader.hasNext();
    String type=reader.nextToken();
    reader.nextSeparator('/');
    String subType=reader.nextToken();
    Map<String,String> params=null;
    if (reader.hasNext())     params=HttpHeaderReader.readParameters(reader);
    return new MediaType(type,subType,params);
  }
 catch (  ParseException ex) {
    throw new IllegalArgumentException("String_Node_Str" + header + "String_Node_Str",ex);
  }
}
Program: 51287
Project: 51287
Buggy source:
public NewCookie fromString(String header){
  if (header == null)   throw new IllegalArgumentException();
  return HttpHeaderFactory.createNewCookie(header);
}

Fixed version (ground truth):
public NewCookie fromString(String header){
  if (header == null)   throw new IllegalArgumentException("String_Node_Str");
  return HttpHeaderFactory.createNewCookie(header);
}
Program: 51288
Project: 51288
Buggy source:
public URI fromString(String header){
  try {
    return new URI(header);
  }
 catch (  URISyntaxException e) {
    throw new IllegalArgumentException(e);
  }
}

Fixed version (ground truth):
public URI fromString(String header){
  try {
    return new URI(header);
  }
 catch (  URISyntaxException e) {
    throw new IllegalArgumentException("String_Node_Str" + header + "String_Node_Str",e);
  }
}
Program: 51289
Project: 51289
Buggy source:
@SuppressWarnings("String_Node_Str") private void writeEntity(MultivaluedMap<String,Object> metadata,Object entity,OutputStream out){
  if (entity == null)   return;
  try {
    MediaType mediaType=null;
    final Object mediaTypeHeader=metadata.getFirst("String_Node_Str");
    if (mediaTypeHeader instanceof MediaType) {
      mediaType=(MediaType)mediaType;
    }
 else {
      if (mediaTypeHeader != null) {
        mediaType=MediaType.valueOf(mediaTypeHeader.toString());
      }
 else {
        mediaType=MediaType.APPLICATION_OCTET_STREAM_TYPE;
      }
    }
    final MessageBodyWriter bw=bodyContext.getMessageBodyWriter(entity.getClass(),entity.getClass(),null,mediaType);
    if (bw == null) {
      throw new ClientHandlerException("String_Node_Str" + entity.getClass() + "String_Node_Str"+ mediaType+ "String_Node_Str");
    }
    bw.writeTo(entity,entity.getClass(),entity.getClass(),EMPTY_ANNOTATIONS,(MediaType)mediaType,metadata,out);
    out.flush();
    out.close();
  }
 catch (  IOException ex) {
    throw new ClientHandlerException(ex);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private void writeEntity(MultivaluedMap<String,Object> metadata,Object entity,OutputStream out){
  if (entity == null)   return;
  try {
    MediaType mediaType=null;
    final Object mediaTypeHeader=metadata.getFirst("String_Node_Str");
    if (mediaTypeHeader instanceof MediaType) {
      mediaType=(MediaType)mediaTypeHeader;
    }
 else {
      if (mediaTypeHeader != null) {
        mediaType=MediaType.valueOf(mediaTypeHeader.toString());
      }
 else {
        mediaType=MediaType.APPLICATION_OCTET_STREAM_TYPE;
      }
    }
    final MessageBodyWriter bw=bodyContext.getMessageBodyWriter(entity.getClass(),entity.getClass(),null,mediaType);
    if (bw == null) {
      throw new ClientHandlerException("String_Node_Str" + entity.getClass() + "String_Node_Str"+ mediaType+ "String_Node_Str");
    }
    bw.writeTo(entity,entity.getClass(),entity.getClass(),EMPTY_ANNOTATIONS,(MediaType)mediaType,metadata,out);
    out.flush();
    out.close();
  }
 catch (  IOException ex) {
    throw new ClientHandlerException(ex);
  }
}
Program: 51290
Project: 51290
Buggy source:
public void doTag() throws JspException, IOException {
  Object it=getJspContext().getAttribute("String_Node_Str",PageContext.REQUEST_SCOPE);
  final Object oldIt=it;
  if (this.it != null)   it=this.it;
  ServletConfig cfg=(ServletConfig)getPageObject(PageContext.CONFIG);
  ServletContext sc=cfg.getServletContext();
  for (Class c=it.getClass(); c != Object.class; c=c.getSuperclass()) {
    String name="String_Node_Str" + c.getName().replace('.','/') + '/'+ page;
    if (sc.getResource(name) != null) {
      RequestDispatcher disp=sc.getRequestDispatcher(name);
      if (disp != null) {
        getJspContext().setAttribute("String_Node_Str",it,PageContext.REQUEST_SCOPE);
        try {
          HttpServletRequest request=(HttpServletRequest)getPageObject(PageContext.REQUEST);
          disp.include(request,new Wrapper((HttpServletResponse)getPageObject(PageContext.RESPONSE),new PrintWriter(getJspContext().getOut())));
        }
 catch (        ServletException e) {
          throw new JspException(e);
        }
 finally {
          getJspContext().setAttribute("String_Node_Str",oldIt,PageContext.REQUEST_SCOPE);
        }
        return;
      }
    }
  }
  throw new JspException("String_Node_Str" + page + "String_Node_Str"+ it.getClass());
}

Fixed version (ground truth):
public void doTag() throws JspException, IOException {
  Object resource=getJspContext().getAttribute("String_Node_Str",PageContext.REQUEST_SCOPE);
  final Object oldResource=resource;
  if (this.resource != null) {
    resource=this.resource;
  }
  ServletConfig cfg=(ServletConfig)getPageObject(PageContext.CONFIG);
  ServletContext sc=cfg.getServletContext();
  for (Class c=resource.getClass(); c != Object.class; c=c.getSuperclass()) {
    String name="String_Node_Str" + c.getName().replace('.','/') + '/'+ page;
    if (sc.getResource(name) != null) {
      RequestDispatcher disp=sc.getRequestDispatcher(name);
      if (disp != null) {
        getJspContext().setAttribute("String_Node_Str",resource,PageContext.REQUEST_SCOPE);
        try {
          HttpServletRequest request=(HttpServletRequest)getPageObject(PageContext.REQUEST);
          disp.include(request,new Wrapper((HttpServletResponse)getPageObject(PageContext.RESPONSE),new PrintWriter(getJspContext().getOut())));
        }
 catch (        ServletException e) {
          throw new JspException(e);
        }
 finally {
          getJspContext().setAttribute("String_Node_Str",oldResource,PageContext.REQUEST_SCOPE);
        }
        return;
      }
    }
  }
  throw new JspException("String_Node_Str" + page + "String_Node_Str"+ resource.getClass());
}
Program: 51291
Project: 51291
Buggy source:
public void writeTo(String resolvedPath,Object model,OutputStream out) throws IOException {
  RequestDispatcher d=servletContext.getRequestDispatcher(resolvedPath);
  if (d == null) {
    throw new ContainerException("String_Node_Str" + resolvedPath);
  }
  d=new RequestDispatcherWrapper(d,model);
  try {
    d.forward(requestInvoker.get(),responseInvoker.get());
  }
 catch (  Exception e) {
    e.printStackTrace();
    throw new ContainerException(e);
  }
}

Fixed version (ground truth):
public void writeTo(String resolvedPath,Object model,OutputStream out) throws IOException {
  RequestDispatcher d=servletContext.getRequestDispatcher(resolvedPath);
  if (d == null) {
    throw new ContainerException("String_Node_Str" + resolvedPath);
  }
  d=new RequestDispatcherWrapper(d,ui.getMatchedResources().get(0),model);
  try {
    d.forward(requestInvoker.get(),responseInvoker.get());
  }
 catch (  Exception e) {
    e.printStackTrace();
    throw new ContainerException(e);
  }
}
Program: 51292
Project: 51292
Buggy source:
public RequestDispatcherWrapper(RequestDispatcher d,Object it){
  this.d=d;
  this.it=it;
}

Fixed version (ground truth):
public RequestDispatcherWrapper(RequestDispatcher d,Object resource,Object it){
  this.d=d;
  this.resource=resource;
  this.it=it;
}
Program: 51293
Project: 51293
Buggy source:
public void forward(ServletRequest req,ServletResponse rsp) throws ServletException, IOException {
  req.setAttribute("String_Node_Str",it);
  req.setAttribute("String_Node_Str",req);
  req.setAttribute("String_Node_Str",rsp);
  d.forward(req,rsp);
}

Fixed version (ground truth):
public void forward(ServletRequest req,ServletResponse rsp) throws ServletException, IOException {
  req.setAttribute("String_Node_Str",resource);
  req.setAttribute("String_Node_Str",it);
  req.setAttribute("String_Node_Str",req);
  req.setAttribute("String_Node_Str",rsp);
  d.forward(req,rsp);
}
Program: 51294
Project: 51294
Buggy source:
protected <T>void _test(T in,Class resource,boolean verify){
  initiateWebApplication(resource);
  WebResource r=resource("String_Node_Str");
  ClientResponse rib=r.post(ClientResponse.class,in);
  byte[] inBytes=(byte[])rib.getProperties().get("String_Node_Str");
  byte[] outBytes=(byte[])rib.getProperties().get("String_Node_Str");
  System.out.println("String_Node_Str" + new String(inBytes) + "String_Node_Str");
  System.out.println("String_Node_Str" + new String(outBytes) + "String_Node_Str");
  if (verify)   _verify(inBytes,outBytes);
}

Fixed version (ground truth):
protected <T>void _test(T in,Class resource,boolean verify){
  initiateWebApplication(resource);
  WebResource r=resource("String_Node_Str");
  ClientResponse rib=r.post(ClientResponse.class,in);
  byte[] inBytes=(byte[])rib.getProperties().get("String_Node_Str");
  byte[] outBytes=(byte[])rib.getProperties().get("String_Node_Str");
  if (verify)   _verify(inBytes,outBytes);
}
Program: 51295
Project: 51295
Buggy source:
public MultivaluedMap<String,Object> getMetadataOptimal(HttpRequestContext request,MediaType contentType){
  if (headers != null)   return headers;
  headers=new OutBoundHeaders();
  if (values.length == 0 && contentType != null) {
    headers.putSingle(ResponseBuilderImpl.getHeader(ResponseBuilderImpl.CONTENT_TYPE),contentType);
  }
  for (int i=0; i < values.length; i++) {
switch (i) {
case ResponseBuilderImpl.CONTENT_TYPE:
      if (values[i] != null)       headers.putSingle(ResponseBuilderImpl.getHeader(i),values[i]);
 else       if (contentType != null)       headers.putSingle(ResponseBuilderImpl.getHeader(i),contentType);
    break;
case ResponseBuilderImpl.LOCATION:
  Object location=values[i];
if (location != null) {
  if (location instanceof URI) {
    if (!((URI)location).isAbsolute()) {
      String path=((URI)location).getRawPath();
      if (status == 201)       location=UriBuilder.fromUri(request.getAbsolutePath()).encode(false).path(path).build();
 else       location=UriBuilder.fromUri(request.getBaseUri()).encode(false).path(path).build();
    }
  }
  headers.putSingle(ResponseBuilderImpl.getHeader(i),location);
}
break;
default :
if (values[i] != null) headers.putSingle(ResponseBuilderImpl.getHeader(i),values[i]);
}
}
Iterator i=nameValuePairs.iterator();
while (i.hasNext()) {
headers.add((String)i.next(),i.next());
}
return headers;
}

Fixed version (ground truth):
public MultivaluedMap<String,Object> getMetadataOptimal(HttpRequestContext request,MediaType contentType){
  if (headers != null)   return headers;
  headers=new OutBoundHeaders();
  if (values.length == 0 && contentType != null) {
    headers.putSingle(ResponseBuilderImpl.getHeader(ResponseBuilderImpl.CONTENT_TYPE),contentType);
  }
  for (int i=0; i < values.length; i++) {
switch (i) {
case ResponseBuilderImpl.CONTENT_TYPE:
      if (values[i] != null)       headers.putSingle(ResponseBuilderImpl.getHeader(i),values[i]);
 else       if (contentType != null)       headers.putSingle(ResponseBuilderImpl.getHeader(i),contentType);
    break;
case ResponseBuilderImpl.LOCATION:
  Object location=values[i];
if (location != null) {
  if (location instanceof URI) {
    final URI locationUri=(URI)location;
    if (!locationUri.isAbsolute()) {
      final URI base=(status == 201) ? request.getAbsolutePath() : request.getBaseUri();
      location=UriBuilder.fromUri(base).encode(false).path(locationUri.getRawPath()).replaceQueryParams(locationUri.getRawQuery()).fragment(locationUri.getRawFragment()).build();
    }
  }
  headers.putSingle(ResponseBuilderImpl.getHeader(i),location);
}
break;
default :
if (values[i] != null) headers.putSingle(ResponseBuilderImpl.getHeader(i),values[i]);
}
}
Iterator i=nameValuePairs.iterator();
while (i.hasNext()) {
headers.add((String)i.next(),i.next());
}
return headers;
}
Program: 51296
Project: 51296
Buggy source:
public ContainerRequest filter(ContainerRequest request){
  if (!request.getHttpMethod().equalsIgnoreCase("String_Node_Str"))   return request;
  String override=request.getRequestHeaders().getFirst("String_Node_Str");
  if (override == null)   return request;
  override.trim();
  if (override.length() == 0)   return request;
  request.setMethod(override);
  return request;
}

Fixed version (ground truth):
public ContainerRequest filter(ContainerRequest request){
  if (!request.getHttpMethod().equalsIgnoreCase("String_Node_Str"))   return request;
  String override=request.getRequestHeaders().getFirst("String_Node_Str");
  if (override == null)   return request;
  override=override.trim();
  if (override.length() == 0)   return request;
  request.setMethod(override);
  return request;
}
Program: 51297
Project: 51297
Buggy source:
protected final MediaType getAcceptableMediaType(HttpRequestContext requestContext){
  if (produceMime.size() == 1) {
    return mediaType;
  }
 else {
    MediaType m=requestContext.getAcceptableMediaType(produceMime);
    if (m != null) {
      if (m.getType().equals(MediaType.MEDIA_TYPE_WILDCARD) || m.getSubtype().equals(MediaType.MEDIA_TYPE_WILDCARD))       return null;
    }
    return m;
  }
}

Fixed version (ground truth):
protected final MediaType getAcceptableMediaType(HttpRequestContext requestContext){
  if (produceMime.size() == 1) {
    return mediaType;
  }
 else {
    MediaType m=requestContext.getAcceptableMediaType(produceMime);
    if (m != null) {
      if (m.isWildcardType() || m.isWildcardSubtype())       return null;
    }
    return m;
  }
}
Program: 51298
Project: 51298
Buggy source:
public MediaType getAcceptableMediaType(List<MediaType> mediaTypes){
  if (mediaTypes.isEmpty())   return getAcceptableMediaTypes().get(0);
  for (  MediaType a : getAcceptableMediaTypes()) {
    if (a.getType().equals(MediaType.MEDIA_TYPE_WILDCARD))     return mediaTypes.get(0);
    for (    MediaType m : mediaTypes)     if (m.isCompatible(a))     return m;
  }
  return null;
}

Fixed version (ground truth):
public MediaType getAcceptableMediaType(List<MediaType> mediaTypes){
  if (mediaTypes.isEmpty())   return getAcceptableMediaTypes().get(0);
  for (  MediaType a : getAcceptableMediaTypes()) {
    if (a.getType().equals(MediaType.MEDIA_TYPE_WILDCARD))     return mediaTypes.get(0);
    for (    MediaType m : mediaTypes)     if (m.isCompatible(a) && !m.isWildcardType() && !m.isWildcardSubtype())     return m;
  }
  return null;
}
Program: 51300
Project: 51300
Buggy source:
public void testAcceptMultiple(){
  initiateWebApplication(MultipleResource.class);
  WebResource r=resource("String_Node_Str");
  MediaType foo=MediaType.valueOf("String_Node_Str");
  MediaType bar=MediaType.valueOf("String_Node_Str");
  ClientResponse response=r.accept(foo).get(ClientResponse.class);
  assertEquals("String_Node_Str",response.getEntity(String.class));
  assertEquals(foo,response.getType());
  response=r.accept(bar).get(ClientResponse.class);
  assertEquals("String_Node_Str",response.getEntity(String.class));
  assertEquals(bar,response.getType());
  response=r.accept("String_Node_Str").get(ClientResponse.class);
  assertEquals("String_Node_Str",response.getEntity(String.class));
  assertEquals(foo,response.getType());
  response=r.accept("String_Node_Str").get(ClientResponse.class);
  assertEquals("String_Node_Str",response.getEntity(String.class));
  assertEquals(foo,response.getType());
}

Fixed version (ground truth):
public void testAcceptMultiple(){
  initiateWebApplication(MultipleResource.class);
  WebResource r=resource("String_Node_Str");
  MediaType foo=MediaType.valueOf("String_Node_Str");
  MediaType bar=MediaType.valueOf("String_Node_Str");
  ClientResponse response=r.accept(foo).get(ClientResponse.class);
  assertEquals("String_Node_Str",response.getEntity(String.class));
  assertEquals(foo,response.getType());
  response=r.accept(bar).get(ClientResponse.class);
  assertEquals("String_Node_Str",response.getEntity(String.class));
  assertEquals(bar,response.getType());
  response=r.accept("String_Node_Str").get(ClientResponse.class);
  assertEquals("String_Node_Str",response.getEntity(String.class));
  assertEquals(foo,response.getType());
  response=r.accept("String_Node_Str").get(ClientResponse.class);
  assertEquals("String_Node_Str",response.getEntity(String.class));
  assertEquals(foo,response.getType());
  response=r.accept("String_Node_Str").accept("String_Node_Str").get(ClientResponse.class);
  assertEquals("String_Node_Str",response.getEntity(String.class));
  assertEquals(bar,response.getType());
  response=r.accept("String_Node_Str").accept("String_Node_Str").get(ClientResponse.class);
  assertEquals("String_Node_Str",response.getEntity(String.class));
  assertEquals(foo,response.getType());
}
Program: 51301
Project: 51301
Buggy source:
private static void onException(Throwable e,Response r,HttpResponseContext response){
  response.setResponse(r);
  if (r.getStatus() >= 500) {
    e.printStackTrace();
  }
  if (r.getStatus() >= 500 && r.getEntity() == null) {
    StringWriter sw=new StringWriter();
    PrintWriter pw=new PrintWriter(sw);
    e.printStackTrace(pw);
    pw.flush();
    r=Response.status(r.getStatus()).entity(sw.toString()).type("String_Node_Str").build();
  }
}

Fixed version (ground truth):
private static void onException(Throwable e,Response r,HttpResponseContext response){
  if (r.getStatus() >= 500) {
    e.printStackTrace();
  }
  if (r.getStatus() >= 500 && r.getEntity() == null) {
    StringWriter sw=new StringWriter();
    PrintWriter pw=new PrintWriter(sw);
    e.printStackTrace(pw);
    pw.flush();
    r=Response.status(r.getStatus()).entity(sw.toString()).type("String_Node_Str").build();
  }
  response.setResponse(r);
}
Program: 51302
Project: 51302
Buggy source:
/** 
 * Create a new instance with a client configuration and a  compoenent provider.
 * @param root the root client handler for dispatching a request andreturning a response.
 * @param config the client configuration.
 * @param provider the component provider.
 */
public Client(ClientHandler root,ClientConfig config,ComponentProvider provider){
  super(root);
  this.injectableFactory=new InjectableProviderFactory();
  this.config=config;
  injectableFactory.add(new ContextInjectableProvider<ClientConfig>(ClientConfig.class,config));
  this.provider=(provider == null) ? new DefaultComponentProvider() : new AdaptingComponentProvider(provider);
  ComponentProviderCache cpc=new ComponentProviderCache(this.provider,config.getProviderClasses());
  ContextResolverFactory crf=new ContextResolverFactory(cpc,injectableFactory);
  this.bodyContext=new MessageBodyFactory(cpc);
  injectableFactory.add(new ContextInjectableProvider<MessageBodyContext>(MessageBodyContext.class,bodyContext));
  injectResources(root);
}

Fixed version (ground truth):
/** 
 * Create a new instance with a client configuration and a  compoenent provider.
 * @param root the root client handler for dispatching a request andreturning a response.
 * @param config the client configuration.
 * @param provider the component provider.
 */
public Client(ClientHandler root,ClientConfig config,ComponentProvider provider){
  super(root);
  this.injectableFactory=new InjectableProviderFactory();
  this.config=config;
  injectableFactory.add(new ContextInjectableProvider<ClientConfig>(ClientConfig.class,config));
  this.provider=(provider == null) ? new DefaultComponentProvider() : new AdaptingComponentProvider(provider);
  ComponentProviderCache cpc=new ComponentProviderCache(this.provider,config.getProviderClasses());
  new ContextResolverFactory(cpc,injectableFactory);
  this.bodyContext=new MessageBodyFactory(cpc);
  injectableFactory.add(new ContextInjectableProvider<MessageBodyContext>(MessageBodyContext.class,bodyContext));
  injectResources(root);
}
Program: 51303
Project: 51303
Buggy source:
public void add(InjectableProvider ip){
  Class<?> c=ip.getClass();
  Type[] args=getMetaArguments(ip.getClass());
  if (args != null) {
    MetaInjectableProvider mip=new MetaInjectableProvider(ip,(Class)args[0],(Class)args[1],(Class)args[2]);
    getList(mip.ac).add(mip);
  }
 else {
  }
}

Fixed version (ground truth):
public void add(InjectableProvider ip){
  Type[] args=getMetaArguments(ip.getClass());
  if (args != null) {
    MetaInjectableProvider mip=new MetaInjectableProvider(ip,(Class)args[0],(Class)args[1],(Class)args[2]);
    getList(mip.ac).add(mip);
  }
 else {
  }
}
Program: 51304
Project: 51304
Buggy source:
public void injectResources(final Object o){
  Class oClass=o.getClass();
  while (oClass != null) {
    for (    final Field f : oClass.getDeclaredFields()) {
      if (getFieldValue(o,f) != null)       continue;
      final Annotation[] as=f.getAnnotations();
      for (      Annotation a : as) {
        final Injectable i=getInjectable(a.annotationType(),null,a,f.getGenericType());
        if (i != null && i instanceof SingletonInjectable) {
          SingletonInjectable si=(SingletonInjectable)i;
          Object v=si.getValue(null);
          setFieldValue(o,f,v);
        }
      }
    }
    oClass=oClass.getSuperclass();
  }
}

Fixed version (ground truth):
public void injectResources(final Object o){
  Class oClass=o.getClass();
  while (oClass != Object.class) {
    for (    final Field f : oClass.getDeclaredFields()) {
      if (getFieldValue(o,f) != null)       continue;
      final Annotation[] as=f.getAnnotations();
      for (      Annotation a : as) {
        final Injectable i=getInjectable(a.annotationType(),null,a,f.getGenericType());
        if (i != null && i instanceof SingletonInjectable) {
          SingletonInjectable si=(SingletonInjectable)i;
          Object v=si.getValue(null);
          setFieldValue(o,f,v);
        }
      }
    }
    oClass=oClass.getSuperclass();
  }
}
Program: 51305
Project: 51305
Buggy source:
private MetaInjectableProvider getMeta(InjectableProvider ip){
  Class<?> c=ip.getClass();
  Type[] args=getMetaArguments(ip.getClass());
  if (args != null)   return new MetaInjectableProvider(ip,(Class)args[0],(Class)args[1],(Class)args[2]);
  return null;
}

Fixed version (ground truth):
private MetaInjectableProvider getMeta(InjectableProvider ip){
  Type[] args=getMetaArguments(ip.getClass());
  if (args != null)   return new MetaInjectableProvider(ip,(Class)args[0],(Class)args[1],(Class)args[2]);
  return null;
}
Program: 51307
Project: 51307
Buggy source:
public MultivaluedMap<String,Object> getMetadata(){
  if (headers == null)   headers=new ResponseHttpHeadersImpl();
  for (int i=0; i < values.length; i++)   if (values[i] != null)   headers.putSingle(ResponseBuilderImpl.getHeader(i),values[i]);
  Iterator i=nameValuePairs.iterator();
  while (i.hasNext()) {
    headers.add((String)i.next(),i.next());
  }
  return headers;
}

Fixed version (ground truth):
public MultivaluedMap<String,Object> getMetadata(){
  if (headers != null)   return headers;
  headers=new ResponseHttpHeadersImpl();
  for (int i=0; i < values.length; i++)   if (values[i] != null)   headers.putSingle(ResponseBuilderImpl.getHeader(i),values[i]);
  Iterator i=nameValuePairs.iterator();
  while (i.hasNext()) {
    headers.add((String)i.next(),i.next());
  }
  return headers;
}
Program: 51308
Project: 51308
Buggy source:
public MultivaluedMap<String,Object> getMetadataOptimal(HttpRequestContext request,MediaType contentType){
  if (headers == null)   headers=new ResponseHttpHeadersImpl();
  if (values.length == 0 && contentType != null) {
    headers.putSingle(ResponseBuilderImpl.getHeader(ResponseBuilderImpl.CONTENT_TYPE),contentType);
  }
  for (int i=0; i < values.length; i++) {
switch (i) {
case ResponseBuilderImpl.CONTENT_TYPE:
      if (values[i] != null)       headers.putSingle(ResponseBuilderImpl.getHeader(i),values[i]);
 else       if (contentType != null)       headers.putSingle(ResponseBuilderImpl.getHeader(i),contentType);
    break;
case ResponseBuilderImpl.LOCATION:
  Object location=values[i];
if (location != null) {
  if (location instanceof URI) {
    if (!((URI)location).isAbsolute()) {
      String path=((URI)location).getRawPath();
      if (status == 201)       location=UriBuilder.fromUri(request.getAbsolutePath()).encode(false).path(path).build();
 else       location=UriBuilder.fromUri(request.getBaseUri()).encode(false).path(path).build();
    }
  }
  headers.putSingle(ResponseBuilderImpl.getHeader(i),location);
}
break;
default :
if (values[i] != null) headers.putSingle(ResponseBuilderImpl.getHeader(i),values[i]);
}
}
Iterator i=nameValuePairs.iterator();
while (i.hasNext()) {
headers.add((String)i.next(),i.next());
}
return headers;
}

Fixed version (ground truth):
public MultivaluedMap<String,Object> getMetadataOptimal(HttpRequestContext request,MediaType contentType){
  if (headers != null)   return headers;
  headers=new ResponseHttpHeadersImpl();
  if (values.length == 0 && contentType != null) {
    headers.putSingle(ResponseBuilderImpl.getHeader(ResponseBuilderImpl.CONTENT_TYPE),contentType);
  }
  for (int i=0; i < values.length; i++) {
switch (i) {
case ResponseBuilderImpl.CONTENT_TYPE:
      if (values[i] != null)       headers.putSingle(ResponseBuilderImpl.getHeader(i),values[i]);
 else       if (contentType != null)       headers.putSingle(ResponseBuilderImpl.getHeader(i),contentType);
    break;
case ResponseBuilderImpl.LOCATION:
  Object location=values[i];
if (location != null) {
  if (location instanceof URI) {
    if (!((URI)location).isAbsolute()) {
      String path=((URI)location).getRawPath();
      if (status == 201)       location=UriBuilder.fromUri(request.getAbsolutePath()).encode(false).path(path).build();
 else       location=UriBuilder.fromUri(request.getBaseUri()).encode(false).path(path).build();
    }
  }
  headers.putSingle(ResponseBuilderImpl.getHeader(i),location);
}
break;
default :
if (values[i] != null) headers.putSingle(ResponseBuilderImpl.getHeader(i),values[i]);
}
}
Iterator i=nameValuePairs.iterator();
while (i.hasNext()) {
headers.add((String)i.next(),i.next());
}
return headers;
}
Program: 51309
Project: 51309
Buggy source:
public final void setResponse(Response response,MediaType contentType){
  responseSet=true;
  if (contentType == null)   contentType=APPLICATION_OCTET_STREAM;
  response=(response != null) ? response : Responses.noContent().build();
  this.status=response.getStatus();
  this.entity=response.getEntity();
  if (request.getHttpMethod().equals("String_Node_Str"))   this.entity=null;
 else   if (this.entity == null) {
    contentType=null;
    if (status == 200)     status=204;
  }
 else   if (status == 204)   status=200;
  if (response instanceof ResponseImpl) {
    this.headers=setResponseOptimal((ResponseImpl)response,contentType);
  }
 else {
    this.headers=setResponseNonOptimal(response,contentType);
  }
}

Fixed version (ground truth):
public final void setResponse(Response response,MediaType contentType){
  responseSet=true;
  if (contentType == null)   contentType=APPLICATION_OCTET_STREAM;
  response=(response != null) ? response : Responses.noContent().build();
  this.status=response.getStatus();
  this.entity=response.getEntity();
  if (request.getHttpMethod().equals("String_Node_Str"))   this.entity=null;
 else   if (this.entity == null) {
    contentType=null;
  }
  if (response instanceof ResponseImpl) {
    this.headers=setResponseOptimal((ResponseImpl)response,contentType);
  }
 else {
    this.headers=setResponseNonOptimal(response,contentType);
  }
}
Program: 51310
Project: 51310
Buggy source:
protected WebResource resource(String relativeUri,boolean checkStatus,ClientConfig clientConfig){
  Client c=(clientConfig == null) ? new Client(new TestResourceClientHandler(BASE_URI,w)) : new Client(new TestResourceClientHandler(BASE_URI,w),clientConfig);
  if (checkStatus) {
    c.addFilter(new ClientFilter(){
      public ClientResponse handle(      ClientRequest ro){
        ClientResponse r=getNext().handle(ro);
        if (r.hasEntity()) {
          assertEquals(200,r.getStatus());
        }
 else {
          assertEquals(204,r.getStatus());
        }
        return r;
      }
    }
);
  }
  WebResource r=c.resource(createCompleteUri(BASE_URI,relativeUri));
  return r;
}

Fixed version (ground truth):
protected WebResource resource(String relativeUri,boolean checkStatus,ClientConfig clientConfig){
  Client c=(clientConfig == null) ? new Client(new TestResourceClientHandler(BASE_URI,w)) : new Client(new TestResourceClientHandler(BASE_URI,w),clientConfig);
  if (checkStatus) {
    c.addFilter(new ClientFilter(){
      public ClientResponse handle(      ClientRequest ro){
        ClientResponse r=getNext().handle(ro);
        assertTrue(r.getStatus() < 300);
        return r;
      }
    }
);
  }
  WebResource r=c.resource(createCompleteUri(BASE_URI,relativeUri));
  return r;
}
Program: 51311
Project: 51311
Buggy source:
public ClientResponse handle(ClientRequest ro){
  ClientResponse r=getNext().handle(ro);
  if (r.hasEntity()) {
    assertEquals(200,r.getStatus());
  }
 else {
    assertEquals(204,r.getStatus());
  }
  return r;
}

Fixed version (ground truth):
public ClientResponse handle(ClientRequest ro){
  ClientResponse r=getNext().handle(ro);
  assertTrue(r.getStatus() < 300);
  return r;
}
Program: 51312
Project: 51312
Buggy source:
/** 
 * @param paths the array paths consisting of either jar files ordirectories containing jar files for class files.
 */
public ClasspathResourceConfig(String[] paths){
  super();
  if (paths == null || paths.length == 0)   throw new IllegalArgumentException("String_Node_Str");
  this.paths=paths;
  init(paths);
}

Fixed version (ground truth):
/** 
 * @param paths the array paths consisting of either jar files ordirectories containing jar files for class files.
 */
public ClasspathResourceConfig(String[] paths){
  super();
  if (paths == null || paths.length == 0)   throw new IllegalArgumentException("String_Node_Str");
  this.paths=paths.clone();
  init(paths);
}
Program: 51313
Project: 51313
Buggy source:
public void setClasspath(Path classpath){
  if (classpath != null) {
    this.classpath=classpath;
  }
 else {
    this.classpath.append(classpath);
  }
}

Fixed version (ground truth):
public void setClasspath(Path classpath){
  if (this.classpath == null) {
    this.classpath=classpath;
  }
 else {
    this.classpath.append(classpath);
  }
}
Program: 51314
Project: 51314
Buggy source:
private void createWadlResource(Set<AbstractResource> rootResources,RulesMap<UriRule> rulesMap){
  Object wr=WadlFactory.createWadlResource(rootResources);
  if (wr == null)   return;
  ResourceClass r=getResourceClass(WadlResource.class);
  UriTemplate t=new PathTemplate("String_Node_Str",false);
  PathPattern p=new PathPattern(t,false);
  rulesMap.put(p,new RightHandPathRule(resourceConfig.getFeature(ResourceConfig.FEATURE_REDIRECT),false,new ResourceObjectRule(t,wr)));
}

Fixed version (ground truth):
private void createWadlResource(Set<AbstractResource> rootResources,RulesMap<UriRule> rulesMap){
  Object wr=WadlFactory.createWadlResource(rootResources);
  if (wr == null)   return;
  getResourceClass(WadlResource.class);
  UriTemplate t=new PathTemplate("String_Node_Str",false);
  PathPattern p=new PathPattern(t,false);
  rulesMap.put(p,new RightHandPathRule(resourceConfig.getFeature(ResourceConfig.FEATURE_REDIRECT),false,new ResourceObjectRule(t,wr)));
}
Program: 51315
Project: 51315
Buggy source:
private final void processProperties(Map<String,Object> properties){
  for (  String k : properties.keySet()) {
    if (k.startsWith(NAMESPACE)) {
      getJsonProperties().put(k,properties.get(k));
    }
  }
  for (  String k : getJsonProperties().keySet()) {
    properties.remove(k);
  }
}

Fixed version (ground truth):
private final void processProperties(Map<String,Object> properties){
  for (  Map.Entry<String,Object> e : properties.entrySet()) {
    if (e.getKey().startsWith(NAMESPACE)) {
      getJsonProperties().put(e.getKey(),e.getValue());
    }
  }
  for (  String k : getJsonProperties().keySet()) {
    properties.remove(k);
  }
}
Program: 51316
Project: 51316
Buggy source:
public JSONUnmarshaller(JAXBContext jaxbContext,Map<String,Object> properties) throws JAXBException {
  try {
    this.jaxbContext=jaxbContext;
    this.jaxbUnmarshaller=jaxbContext.createUnmarshaller();
    setProperties(properties);
  }
 catch (  PropertyException ex) {
    Logger.getLogger(JSONUnmarshaller.class.getName()).log(Level.SEVERE,null,ex);
  }
}

Fixed version (ground truth):
public JSONUnmarshaller(JAXBContext jaxbContext,Map<String,Object> properties) throws JAXBException {
  try {
    this.jaxbUnmarshaller=jaxbContext.createUnmarshaller();
    setProperties(properties);
  }
 catch (  PropertyException ex) {
    Logger.getLogger(JSONUnmarshaller.class.getName()).log(Level.SEVERE,null,ex);
  }
}
Program: 51317
Project: 51317
Buggy source:
public JsonXmlStreamReader(Reader reader,boolean jsonRootUnwrapping) throws IOException {
  this.reader=reader;
  this.jsonRootUnwrapping=jsonRootUnwrapping;
  lexer=new JsonLexer(reader);
  depth=0;
  processingStack=new ArrayList<ProcessingState>();
  processingStack.add(new ProcessingState());
  readNext();
}

Fixed version (ground truth):
public JsonXmlStreamReader(Reader reader,boolean jsonRootUnwrapping) throws IOException {
  this.jsonRootUnwrapping=jsonRootUnwrapping;
  lexer=new JsonLexer(reader);
  depth=0;
  processingStack=new ArrayList<ProcessingState>();
  processingStack.add(new ProcessingState());
  readNext();
}
Program: 51318
Project: 51318
Buggy source:
/** 
 * Redirect to a URI that ends in a slash. TODO use the complete URI.
 */
private boolean redirect(UriRuleContext context){
  final HttpRequestContext request=context.getRequest();
  final HttpResponseContext response=context.getResponse();
  response.setResponse(Response.temporaryRedirect(UriBuilder.fromUri(context.getUriInfo().getAbsolutePath()).path("String_Node_Str").build()).build());
  return true;
}

Fixed version (ground truth):
/** 
 * Redirect to a URI that ends in a slash. TODO use the complete URI.
 */
private boolean redirect(UriRuleContext context){
  final HttpResponseContext response=context.getResponse();
  response.setResponse(Response.temporaryRedirect(UriBuilder.fromUri(context.getUriInfo().getAbsolutePath()).path("String_Node_Str").build()).build());
  return true;
}