nus-yam/ex-repair huggingface dataset:
Program: 15255
Project: 15255
Buggy source:
@Override public void doFilter(ServletRequest request,ServletResponse response,FilterChain chain) throws IOException, ServletException {
  HttpServletRequest httpRequest=(HttpServletRequest)request;
  HttpServletResponse httpResponse=servlet.httpResponse(response);
  if (request.getAttribute("String_Node_Str") != null) {
    chain.doFilter(request,response);
    return;
  }
  request.setAttribute("String_Node_Str","String_Node_Str");
  Span span=handler.handleReceive(extractor,httpRequest);
  request.setAttribute(SpanCustomizer.class.getName(),span.customizer());
  request.setAttribute(TraceContext.class.getName(),span.context());
  Throwable error=null;
  try (Tracer.SpanInScope ws=tracer.withSpanInScope(span)){
    chain.doFilter(httpRequest,httpResponse);
  }
 catch (  IOException|ServletException|RuntimeException|Error e) {
    error=e;
    throw e;
  }
 finally {
    if (servlet.isAsync(httpRequest)) {
      servlet.handleAsync(handler,httpRequest,span);
    }
 else {
      handler.handleSend(ADAPTER.adaptResponse(httpRequest,httpResponse),error,span);
    }
  }
}

Fixed version (ground truth):
@Override public void doFilter(ServletRequest request,ServletResponse response,FilterChain chain) throws IOException, ServletException {
  HttpServletRequest httpRequest=(HttpServletRequest)request;
  HttpServletResponse httpResponse=servlet.httpResponse(response);
  TraceContext context=(TraceContext)request.getAttribute(TraceContext.class.getName());
  if (context != null) {
    Scope scope=currentTraceContext.maybeScope(context);
    try {
      chain.doFilter(request,response);
    }
  finally {
      scope.close();
    }
    return;
  }
  Span span=handler.handleReceive(extractor,httpRequest);
  request.setAttribute(SpanCustomizer.class.getName(),span.customizer());
  request.setAttribute(TraceContext.class.getName(),span.context());
  Throwable error=null;
  Scope scope=currentTraceContext.newScope(span.context());
  try {
    chain.doFilter(httpRequest,httpResponse);
  }
 catch (  IOException|ServletException|RuntimeException|Error e) {
    error=e;
    throw e;
  }
 finally {
    scope.close();
    if (servlet.isAsync(httpRequest)) {
      servlet.handleAsync(handler,httpRequest,span);
    }
 else {
      handler.handleSend(ADAPTER.adaptResponse(httpRequest,httpResponse),error,span);
    }
  }
}
Program: 15256
Project: 15256
Buggy source:
InternalBuilder debug(boolean debug){
  if (debug) {
    flags|=FLAG_DEBUG;
  }
 else {
    flags&=~FLAG_DEBUG;
  }
  return this;
}

Fixed version (ground truth):
/** 
 * Ensures sampled is set when debug is 
 */
InternalBuilder debug(boolean debug){
  if (debug) {
    flags|=FLAG_DEBUG;
    flags|=FLAG_SAMPLED_SET;
    flags|=FLAG_SAMPLED;
  }
 else {
    flags&=~FLAG_DEBUG;
  }
  return this;
}
Program: 15257
Project: 15257
Buggy source:
/** 
 * Returns a customizer for current span in scope or noop if there isn't one. <p>Unlike   {@link CurrentSpanCustomizer}, this represents a single span. Accordingly, this reference should not be saved as a field. That said, it is more efficient to save this result as a method-local variable vs repeated calls to   {@link #currentSpanCustomizer()}.
 */
public SpanCustomizer currentSpanCustomizer(){
  TraceContext currentContext=currentTraceContext.get();
  return currentContext != null ? RealSpanCustomizer.create(currentContext,recorder) : NoopSpanCustomizer.INSTANCE;
}

Fixed version (ground truth):
/** 
 * Returns a customizer for current span in scope or noop if there isn't one. <p>Unlike   {@link CurrentSpanCustomizer}, this represents a single span. Accordingly, this reference should not be saved as a field. That said, it is more efficient to save this result as a method-local variable vs repeated calls to   {@link #currentSpanCustomizer()}.
 */
public SpanCustomizer currentSpanCustomizer(){
  TraceContext currentContext=currentTraceContext.get();
  return currentContext != null && Boolean.TRUE.equals(currentContext.sampled()) ? RealSpanCustomizer.create(currentContext,recorder) : NoopSpanCustomizer.INSTANCE;
}
Program: 15258
Project: 15258
Buggy source:
@Override public TraceContext decorate(TraceContext context){
  TraceContext result=delegate.decorate(context);
  int extraIndex=indexOfExtra(result.extra());
  if (extraIndex != -1) {
    Extra extra=(Extra)result.extra().get(extraIndex);
    if (!Arrays.equals(extra.fieldNames,fieldNames)) {
      throw new IllegalStateException(String.format("String_Node_Str",Arrays.asList(extra.fieldNames),Arrays.asList(fieldNames)));
    }
    if (extra.tryAssociate(context))     return context;
  }
  List<Object> copyOfExtra=new ArrayList<>(result.extra());
  Extra extra;
  if (extraIndex != -1) {
    extra=((Extra)copyOfExtra.get(extraIndex)).clone();
    copyOfExtra.set(extraIndex,extra);
  }
 else {
    extra=new Extra(fieldNames);
    copyOfExtra.add(extra);
  }
  extra.context=context;
  return result.toBuilder().extra(Collections.unmodifiableList(copyOfExtra)).build();
}

Fixed version (ground truth):
@Override public TraceContext decorate(TraceContext context){
  TraceContext result=delegate.decorate(context);
  List<Object> extras=result.extra();
  int thisExtraIndex=-1, parentExtraIndex=-1;
  for (int i=0, length=extras.size(); i < length; i++) {
    if (extras.get(i) instanceof Extra) {
      Extra extra=(Extra)result.extra().get(i);
      if (!Arrays.equals(extra.fieldNames,fieldNames)) {
        throw new IllegalStateException(String.format("String_Node_Str",Arrays.toString(extra.fieldNames),Arrays.toString(fieldNames)));
      }
      if (extra.tryAssociate(context)) {
        thisExtraIndex=i;
      }
 else {
        parentExtraIndex=i;
      }
    }
  }
  if (thisExtraIndex != -1 && parentExtraIndex == -1)   return context;
  List<Object> copyOfExtra=new ArrayList<>(result.extra());
  Extra extra;
  if (thisExtraIndex == -1 && parentExtraIndex != -1) {
    extra=((Extra)copyOfExtra.get(parentExtraIndex)).clone();
    copyOfExtra.set(parentExtraIndex,extra);
  }
 else   if (thisExtraIndex != -1 && parentExtraIndex != -1) {
    extra=((Extra)copyOfExtra.get(thisExtraIndex));
    Extra parent=(Extra)copyOfExtra.remove(parentExtraIndex);
    if (parent.values != null) {
      for (int i=0; i < parent.values.length; i++) {
        if (parent.values[i] != null && extra.get(i) == null) {
          extra.set(i,parent.values[i]);
        }
      }
    }
  }
 else {
    extra=new Extra(fieldNames);
    copyOfExtra.add(extra);
  }
  TraceContext resultContext=result.toBuilder().extra(Collections.unmodifiableList(copyOfExtra)).build();
  extra.context=resultContext;
  return resultContext;
}
Program: 15259
Project: 15259
Buggy source:
/** 
 * Converts the context as-is to a Span object 
 */
public Span toSpan(TraceContext context){
  if (context == null)   throw new NullPointerException("String_Node_Str");
  if (noop.get() == false && Boolean.TRUE.equals(context.sampled())) {
    return RealSpan.create(context,recorder);
  }
  return NoopSpan.create(context);
}

Fixed version (ground truth):
/** 
 * Converts the context as-is to a Span object 
 */
public Span toSpan(TraceContext context){
  if (context == null)   throw new NullPointerException("String_Node_Str");
  if (!noop.get() && Boolean.TRUE.equals(context.sampled())) {
    return RealSpan.create(context,recorder);
  }
  return NoopSpan.create(context);
}
Program: 15260
Project: 15260
Buggy source:
/** 
 * Explicitly creates a child within an existing. The result will be have its parent ID set to the input's span ID. <p>To implicitly create a new trace, or a span within an existing one, use   {@link #nextSpan()}.
 */
public Span newChild(TraceContext parent){
  if (parent == null)   throw new NullPointerException("String_Node_Str");
  return nextSpan(TraceContextOrSamplingFlags.create(parent));
}

Fixed version (ground truth):
/** 
 * Explicitly creates a child within an existing trace. The result will be have its parent ID set to the input's span ID. If a sampling decision has not yet been made, one will happen here. <p>To implicitly create a new trace, or a span within an existing one, use   {@link #nextSpan()}.
 */
public Span newChild(TraceContext parent){
  if (parent == null)   throw new NullPointerException("String_Node_Str");
  return nextSpan(TraceContextOrSamplingFlags.create(parent));
}
Program: 15261
Project: 15261
Buggy source:
@Override public String toString(){
  String[] elements;
synchronized (this) {
    elements=values;
  }
  Map<String,String> contents=new LinkedHashMap<>();
  for (int i=0, length=fieldNames.length; i < length; i++) {
    String maybeValue=elements[i];
    if (maybeValue == null)     continue;
    contents.put(fieldNames[i],maybeValue);
  }
  return "String_Node_Str" + contents;
}

Fixed version (ground truth):
@Override public String toString(){
  String[] elements;
synchronized (this) {
    elements=values;
  }
  if (elements == null)   return "String_Node_Str";
  Map<String,String> contents=new LinkedHashMap<>();
  for (int i=0, length=fieldNames.length; i < length; i++) {
    String maybeValue=elements[i];
    if (maybeValue == null)     continue;
    contents.put(fieldNames[i],maybeValue);
  }
  return "String_Node_Str" + contents;
}
Program: 15262
Project: 15262
Buggy source:
@Override public void init(ServletContextHandler handler){
  super.init(handler);
  handler.addServlet(new ServletHolder(new AsyncServlet()),"String_Node_Str");
  handler.addServlet(new ServletHolder(new ExceptionAsyncServlet()),"String_Node_Str");
}

Fixed version (ground truth):
@Override public void init(ServletContextHandler handler){
  super.init(handler);
  handler.addServlet(new ServletHolder(new AsyncServlet()),"String_Node_Str");
  handler.addServlet(new ServletHolder(new ForwardServlet()),"String_Node_Str");
  handler.addServlet(new ServletHolder(new AsyncForwardServlet()),"String_Node_Str");
  handler.addServlet(new ServletHolder(new ExceptionAsyncServlet()),"String_Node_Str");
}
Program: 15263
Project: 15263
Buggy source:
@Override protected void doGet(HttpServletRequest req,HttpServletResponse resp) throws IOException {
  AsyncContext ctx=req.startAsync();
  ctx.setTimeout(1);
  ctx.start(() -> {
    try {
      Thread.sleep(10L);
    }
 catch (    InterruptedException e) {
      Thread.currentThread().interrupt();
    }
 finally {
      ctx.complete();
    }
  }
);
}

Fixed version (ground truth):
@Override protected void doGet(HttpServletRequest req,HttpServletResponse resp){
  AsyncContext ctx=req.startAsync();
  ctx.setTimeout(1);
  ctx.start(() -> {
    try {
      Thread.sleep(10L);
    }
 catch (    InterruptedException e) {
      Thread.currentThread().interrupt();
    }
 finally {
      ctx.complete();
    }
  }
);
}
Program: 15264
Project: 15264
Buggy source:
@Override public void onError(AsyncEvent e) throws IOException {
  handler.handleSend(null,e.getThrowable(),span);
}

Fixed version (ground truth):
@Override public void onError(AsyncEvent e){
  if (complete)   return;
  handler.handleSend(null,e.getThrowable(),span);
  complete=true;
}
Program: 15265
Project: 15265
Buggy source:
@Override public void onComplete(AsyncEvent e) throws IOException {
  handler.handleSend((HttpServletResponse)e.getSuppliedResponse(),null,span);
}

Fixed version (ground truth):
@Override public void onComplete(AsyncEvent e){
  if (complete)   return;
  handler.handleSend((HttpServletResponse)e.getSuppliedResponse(),null,span);
  complete=true;
}
Program: 15266
Project: 15266
Buggy source:
@Override public void onStartAsync(AsyncEvent e) throws IOException {
}

Fixed version (ground truth):
/** 
 * If another async is created (ex via asyncContext.dispatch), this needs to be re-attached 
 */
@Override public void onStartAsync(AsyncEvent event){
  AsyncContext eventAsyncContext=event.getAsyncContext();
  if (eventAsyncContext != null)   eventAsyncContext.addListener(this);
}
Program: 15267
Project: 15267
Buggy source:
@Override public void onTimeout(AsyncEvent e) throws IOException {
  span.tag("String_Node_Str",String.format("String_Node_Str",e.getAsyncContext().getTimeout()));
  handler.handleSend((HttpServletResponse)e.getSuppliedResponse(),null,span);
}

Fixed version (ground truth):
@Override public void onTimeout(AsyncEvent e){
  if (complete)   return;
  span.tag("String_Node_Str",String.format("String_Node_Str",e.getAsyncContext().getTimeout()));
  handler.handleSend((HttpServletResponse)e.getSuppliedResponse(),null,span);
  complete=true;
}
Program: 15268
Project: 15268
Buggy source:
@Override public void doFilter(ServletRequest request,ServletResponse response,FilterChain chain) throws IOException, ServletException {
  HttpServletRequest httpRequest=(HttpServletRequest)request;
  HttpServletResponse httpResponse=servlet.httpResponse(response);
  Span span=handler.handleReceive(extractor,httpRequest);
  Throwable error=null;
  try (Tracer.SpanInScope ws=tracer.withSpanInScope(span)){
    chain.doFilter(httpRequest,httpResponse);
  }
 catch (  IOException|ServletException|RuntimeException|Error e) {
    error=e;
    throw e;
  }
 finally {
    if (servlet.isAsync(httpRequest)) {
      servlet.handleAsync(handler,httpRequest,span);
    }
 else {
      handler.handleSend(httpResponse,error,span);
    }
  }
}

Fixed version (ground truth):
@Override public void doFilter(ServletRequest request,ServletResponse response,FilterChain chain) throws IOException, ServletException {
  HttpServletRequest httpRequest=(HttpServletRequest)request;
  HttpServletResponse httpResponse=servlet.httpResponse(response);
  if (request.getAttribute("String_Node_Str") != null) {
    chain.doFilter(request,response);
    return;
  }
  request.setAttribute("String_Node_Str","String_Node_Str");
  Span span=handler.handleReceive(extractor,httpRequest);
  Throwable error=null;
  try (Tracer.SpanInScope ws=tracer.withSpanInScope(span)){
    chain.doFilter(httpRequest,httpResponse);
  }
 catch (  IOException|ServletException|RuntimeException|Error e) {
    error=e;
    throw e;
  }
 finally {
    if (servlet.isAsync(httpRequest)) {
      servlet.handleAsync(handler,httpRequest,span);
    }
 else {
      handler.handleSend(httpResponse,error,span);
    }
  }
}
Program: 15270
Project: 15270
Buggy source:
@Override public void onClose(Status status,Metadata trailers){
  try {
    super.onClose(status,trailers);
    parser.onClose(status,trailers,span);
  }
  finally {
    span.finish();
  }
}

Fixed version (ground truth):
@Override public void onClose(Status status,Metadata trailers){
  try (Tracer.SpanInScope ws=tracer.withSpanInScope(span)){
    super.onClose(status,trailers);
    parser.onClose(status,trailers,span);
  }
  finally {
    span.finish();
  }
}
Program: 15271
Project: 15271
Buggy source:
@Override public void start(Listener<RespT> responseListener,Metadata headers){
  injector.inject(span.context(),headers);
  span.kind(Span.Kind.CLIENT).start();
  parser.onStart(method,callOptions,headers,span);
  try (Tracer.SpanInScope ws=tracer.withSpanInScope(span)){
    super.start(new SimpleForwardingClientCallListener<RespT>(responseListener){
      @Override public void onMessage(      RespT message){
        try (Tracer.SpanInScope ws=tracer.withSpanInScope(span)){
          parser.onMessageReceived(message,span);
          delegate().onMessage(message);
        }
       }
      @Override public void onClose(      Status status,      Metadata trailers){
        try {
          super.onClose(status,trailers);
          parser.onClose(status,trailers,span);
        }
  finally {
          span.finish();
        }
      }
    }
,headers);
  }
 }

Fixed version (ground truth):
@Override public void start(Listener<RespT> responseListener,Metadata headers){
  injector.inject(span.context(),headers);
  span.kind(Span.Kind.CLIENT).start();
  try (Tracer.SpanInScope ws=tracer.withSpanInScope(span)){
    parser.onStart(method,callOptions,headers,span);
    super.start(new SimpleForwardingClientCallListener<RespT>(responseListener){
      @Override public void onMessage(      RespT message){
        try (Tracer.SpanInScope ws=tracer.withSpanInScope(span)){
          parser.onMessageReceived(message,span);
          delegate().onMessage(message);
        }
       }
      @Override public void onClose(      Status status,      Metadata trailers){
        try (Tracer.SpanInScope ws=tracer.withSpanInScope(span)){
          super.onClose(status,trailers);
          parser.onClose(status,trailers,span);
        }
  finally {
          span.finish();
        }
      }
    }
,headers);
  }
 }
Program: 15272
Project: 15272
Buggy source:
@Override public void sendMessage(ReqT message){
  super.sendMessage(message);
  parser.onMessageSent(message,span);
}

Fixed version (ground truth):
@Override public void sendMessage(ReqT message){
  try (Tracer.SpanInScope ws=tracer.withSpanInScope(span)){
    super.sendMessage(message);
    parser.onMessageSent(message,span);
  }
 }
Program: 15273
Project: 15273
Buggy source:
@Override protected <M>void onMessageSent(M message,SpanCustomizer span){
  span.tag("String_Node_Str",message.toString());
}

Fixed version (ground truth):
@Override protected <M>void onMessageSent(M message,SpanCustomizer span){
  span.tag("String_Node_Str",message.toString());
  if (tracing.tracing().currentTraceContext().get() != null) {
    span.tag("String_Node_Str","String_Node_Str");
  }
}
Program: 15274
Project: 15274
Buggy source:
@Test public void clientParserTest() throws Exception {
  closeClient(client);
  tracing=tracing.toBuilder().clientParser(new GrpcClientParser(){
    @Override protected <M>void onMessageSent(    M message,    SpanCustomizer span){
      span.tag("String_Node_Str",message.toString());
    }
    @Override protected <M>void onMessageReceived(    M message,    SpanCustomizer span){
      span.tag("String_Node_Str",message.toString());
    }
    @Override protected <ReqT,RespT>String spanName(    MethodDescriptor<ReqT,RespT> methodDescriptor){
      return methodDescriptor.getType().name();
    }
  }
).build();
  client=newClient();
  GreeterGrpc.newBlockingStub(client).sayHello(HELLO_REQUEST);
  assertThat(spans.getFirst().name()).isEqualTo("String_Node_Str");
  assertThat(spans).flatExtracting(s -> s.tags().keySet()).containsExactlyInAnyOrder("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
@Test public void clientParserTest() throws Exception {
  closeClient(client);
  tracing=tracing.toBuilder().clientParser(new GrpcClientParser(){
    @Override protected <M>void onMessageSent(    M message,    SpanCustomizer span){
      span.tag("String_Node_Str",message.toString());
      if (tracing.tracing().currentTraceContext().get() != null) {
        span.tag("String_Node_Str","String_Node_Str");
      }
    }
    @Override protected <M>void onMessageReceived(    M message,    SpanCustomizer span){
      span.tag("String_Node_Str",message.toString());
      if (tracing.tracing().currentTraceContext().get() != null) {
        span.tag("String_Node_Str","String_Node_Str");
      }
    }
    @Override protected <ReqT,RespT>String spanName(    MethodDescriptor<ReqT,RespT> methodDescriptor){
      return methodDescriptor.getType().name();
    }
  }
).build();
  client=newClient();
  GreeterGrpc.newBlockingStub(client).sayHello(HELLO_REQUEST);
  assertThat(spans.getFirst().name()).isEqualTo("String_Node_Str");
  assertThat(spans).flatExtracting(s -> s.tags().keySet()).containsExactlyInAnyOrder("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
}
Program: 15275
Project: 15275
Buggy source:
@Test public void serverParserTest() throws Exception {
  grpcTracing=grpcTracing.toBuilder().serverParser(new GrpcServerParser(){
    @Override protected <M>void onMessageSent(    M message,    SpanCustomizer span){
      span.tag("String_Node_Str",message.toString());
    }
    @Override protected <M>void onMessageReceived(    M message,    SpanCustomizer span){
      span.tag("String_Node_Str",message.toString());
    }
    @Override protected <ReqT,RespT>String spanName(    MethodDescriptor<ReqT,RespT> methodDescriptor){
      return methodDescriptor.getType().name();
    }
  }
).build();
  init();
  GreeterGrpc.newBlockingStub(client).sayHello(HELLO_REQUEST);
  assertThat(spans.getFirst().name()).isEqualTo("String_Node_Str");
  assertThat(spans).flatExtracting(s -> s.tags().keySet()).containsExactlyInAnyOrder("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
@Test public void serverParserTest() throws Exception {
  grpcTracing=grpcTracing.toBuilder().serverParser(new GrpcServerParser(){
    @Override protected <M>void onMessageSent(    M message,    SpanCustomizer span){
      span.tag("String_Node_Str",message.toString());
      if (grpcTracing.tracing().currentTraceContext().get() != null) {
        span.tag("String_Node_Str","String_Node_Str");
      }
    }
    @Override protected <M>void onMessageReceived(    M message,    SpanCustomizer span){
      span.tag("String_Node_Str",message.toString());
      if (grpcTracing.tracing().currentTraceContext().get() != null) {
        span.tag("String_Node_Str","String_Node_Str");
      }
    }
    @Override protected <ReqT,RespT>String spanName(    MethodDescriptor<ReqT,RespT> methodDescriptor){
      return methodDescriptor.getType().name();
    }
  }
).build();
  init();
  GreeterGrpc.newBlockingStub(client).sayHello(HELLO_REQUEST);
  assertThat(spans.getFirst().name()).isEqualTo("String_Node_Str");
  assertThat(spans).flatExtracting(s -> s.tags().keySet()).containsExactlyInAnyOrder("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
}
Program: 15276
Project: 15276
Buggy source:
@Override protected <M>void onMessageReceived(M message,SpanCustomizer span){
  span.tag("String_Node_Str",message.toString());
}

Fixed version (ground truth):
@Override protected <M>void onMessageReceived(M message,SpanCustomizer span){
  span.tag("String_Node_Str",message.toString());
  if (grpcTracing.tracing().currentTraceContext().get() != null) {
    span.tag("String_Node_Str","String_Node_Str");
  }
}
Program: 15277
Project: 15277
Buggy source:
@Test public void supportsPortableCustomization() throws Exception {
  String uri="String_Node_Str";
  close();
  httpTracing=httpTracing.toBuilder().clientParser(new HttpClientParser(){
    @Override public <Req>void request(    HttpAdapter<Req,?> adapter,    Req req,    SpanCustomizer customizer){
      customizer.name(adapter.method(req).toLowerCase() + "String_Node_Str" + adapter.path(req));
      customizer.tag("String_Node_Str",adapter.url(req));
    }
  }
).build().clientOf("String_Node_Str");
  client=newClient(server.getPort());
  server.enqueue(new MockResponse());
  get(client,uri);
  assertThat(spans).extracting(Span::name).containsExactly("String_Node_Str");
  assertThat(spans).extracting(Span::remoteServiceName).containsExactly("String_Node_Str");
  assertReportedTagsInclude("String_Node_Str",url(uri));
}

Fixed version (ground truth):
@Test public void supportsPortableCustomization() throws Exception {
  String uri="String_Node_Str";
  close();
  httpTracing=httpTracing.toBuilder().clientParser(new HttpClientParser(){
    @Override public <Req>void request(    HttpAdapter<Req,?> adapter,    Req req,    SpanCustomizer customizer){
      customizer.name(adapter.method(req).toLowerCase() + "String_Node_Str" + adapter.path(req));
      customizer.tag("String_Node_Str",adapter.url(req));
      customizer.tag("String_Node_Str",String.valueOf(currentTraceContext.get() != null));
    }
  }
).build().clientOf("String_Node_Str");
  client=newClient(server.getPort());
  server.enqueue(new MockResponse());
  get(client,uri);
  assertThat(spans).extracting(Span::name).containsExactly("String_Node_Str");
  assertThat(spans).extracting(Span::remoteServiceName).containsExactly("String_Node_Str");
  assertReportedTagsInclude("String_Node_Str",url(uri));
  assertReportedTagsInclude("String_Node_Str","String_Node_Str");
}
Program: 15278
Project: 15278
Buggy source:
@Override public <Req>void request(HttpAdapter<Req,?> adapter,Req req,SpanCustomizer customizer){
  customizer.name(adapter.method(req).toLowerCase() + "String_Node_Str" + adapter.path(req));
  customizer.tag("String_Node_Str",adapter.url(req));
}

Fixed version (ground truth):
@Override public <Req>void request(HttpAdapter<Req,?> adapter,Req req,SpanCustomizer customizer){
  customizer.name(adapter.method(req).toLowerCase() + "String_Node_Str" + adapter.path(req));
  customizer.tag("String_Node_Str",adapter.url(req));
  customizer.tag("String_Node_Str",String.valueOf(currentTraceContext.get() != null));
}
Program: 15279
Project: 15279
Buggy source:
@Test public void supportsPortableCustomization() throws Exception {
  httpTracing=httpTracing.toBuilder().serverParser(new HttpServerParser(){
    @Override public <Req>void request(    HttpAdapter<Req,?> adapter,    Req req,    SpanCustomizer customizer){
      customizer.name(adapter.method(req).toLowerCase() + "String_Node_Str" + adapter.path(req));
      customizer.tag("String_Node_Str",adapter.url(req));
    }
  }
).build();
  init();
  String uri="String_Node_Str";
  get(uri);
  assertThat(spans).extracting(Span::name).containsExactly("String_Node_Str");
  assertReportedTagsInclude("String_Node_Str",url(uri));
}

Fixed version (ground truth):
@Test public void supportsPortableCustomization() throws Exception {
  httpTracing=httpTracing.toBuilder().serverParser(new HttpServerParser(){
    @Override public <Req>void request(    HttpAdapter<Req,?> adapter,    Req req,    SpanCustomizer customizer){
      customizer.name(adapter.method(req).toLowerCase() + "String_Node_Str" + adapter.path(req));
      customizer.tag("String_Node_Str",adapter.url(req));
      customizer.tag("String_Node_Str",String.valueOf(currentTraceContext.get() != null));
    }
  }
).build();
  init();
  String uri="String_Node_Str";
  get(uri);
  assertThat(spans).extracting(Span::name).containsExactly("String_Node_Str");
  assertReportedTagsInclude("String_Node_Str",url(uri));
  assertReportedTagsInclude("String_Node_Str","String_Node_Str");
}
Program: 15280
Project: 15280
Buggy source:
@Override public <Req>void request(HttpAdapter<Req,?> adapter,Req req,SpanCustomizer customizer){
  customizer.name(adapter.method(req).toLowerCase() + "String_Node_Str" + adapter.path(req));
  customizer.tag("String_Node_Str",adapter.url(req));
}

Fixed version (ground truth):
@Override public <Req>void request(HttpAdapter<Req,?> adapter,Req req,SpanCustomizer customizer){
  customizer.name(adapter.method(req).toLowerCase() + "String_Node_Str" + adapter.path(req));
  customizer.tag("String_Node_Str",adapter.url(req));
  customizer.tag("String_Node_Str",String.valueOf(currentTraceContext.get() != null));
}
Program: 15281
Project: 15281
Buggy source:
/** 
 * Finishes the client span after assigning it tags according to the response or error. <p>This is typically called once the response headers are received, and after the span is  {@link brave.Tracer.SpanInScope#close() no longer in scope}.
 * @see HttpClientParser#response(HttpAdapter,Object,Throwable,SpanCustomizer)
 */
public void handleReceive(@Nullable Resp response,@Nullable Throwable error,Span span){
  if (span.isNoop())   return;
  try {
    parser.response(adapter,response,error,span);
  }
  finally {
    span.finish();
  }
}

Fixed version (ground truth):
/** 
 * Finishes the client span after assigning it tags according to the response or error. <p>This is typically called once the response headers are received, and after the span is  {@link brave.Tracer.SpanInScope#close() no longer in scope}.
 * @see HttpClientParser#response(HttpAdapter,Object,Throwable,SpanCustomizer)
 */
public void handleReceive(@Nullable Resp response,@Nullable Throwable error,Span span){
  if (span.isNoop())   return;
  Tracer.SpanInScope ws=tracer.withSpanInScope(span);
  try {
    parser.response(adapter,response,error,span);
  }
  finally {
    ws.close();
    span.finish();
  }
}
Program: 15282
Project: 15282
Buggy source:
/** 
 * Like   {@link #handleSend(TraceContext.Injector,Object,Object)}, except explicitly controls the span representing the request.
 * @since 4.4
 */
public <C>Span handleSend(TraceContext.Injector<C> injector,C carrier,Req request,Span span){
  injector.inject(span.context(),carrier);
  if (span.isNoop())   return span;
  span.kind(Span.Kind.CLIENT);
  parser.request(adapter,request,span);
  boolean parsedEndpoint=false;
  if (Platform.get().zipkinV1Present()) {
    zipkin.Endpoint.Builder deprecatedEndpoint=zipkin.Endpoint.builder().serviceName(serverNameSet ? serverName : "String_Node_Str");
    if ((parsedEndpoint=adapter.parseServerAddress(request,deprecatedEndpoint))) {
      span.remoteEndpoint(deprecatedEndpoint.serviceName(serverName).build());
    }
  }
  if (!parsedEndpoint) {
    Endpoint.Builder remoteEndpoint=Endpoint.newBuilder().serviceName(serverName);
    if (adapter.parseServerAddress(request,remoteEndpoint) || serverNameSet) {
      span.remoteEndpoint(remoteEndpoint.build());
    }
  }
  return span.start();
}

Fixed version (ground truth):
/** 
 * Like   {@link #handleSend(TraceContext.Injector,Object,Object)}, except explicitly controls the span representing the request.
 * @since 4.4
 */
public <C>Span handleSend(TraceContext.Injector<C> injector,C carrier,Req request,Span span){
  injector.inject(span.context(),carrier);
  if (span.isNoop())   return span;
  span.kind(Span.Kind.CLIENT);
  Tracer.SpanInScope ws=tracer.withSpanInScope(span);
  try {
    parser.request(adapter,request,span);
  }
  finally {
    ws.close();
  }
  boolean parsedEndpoint=false;
  if (Platform.get().zipkinV1Present()) {
    zipkin.Endpoint.Builder deprecatedEndpoint=zipkin.Endpoint.builder().serviceName(serverNameSet ? serverName : "String_Node_Str");
    if ((parsedEndpoint=adapter.parseServerAddress(request,deprecatedEndpoint))) {
      span.remoteEndpoint(deprecatedEndpoint.serviceName(serverName).build());
    }
  }
  if (!parsedEndpoint) {
    Endpoint.Builder remoteEndpoint=Endpoint.newBuilder().serviceName(serverName);
    if (adapter.parseServerAddress(request,remoteEndpoint) || serverNameSet) {
      span.remoteEndpoint(remoteEndpoint.build());
    }
  }
  return span.start();
}
Program: 15283
Project: 15283
Buggy source:
/** 
 * Like   {@link #handleReceive(TraceContext.Extractor,Object)}, except for when the carrier of trace data is not the same as the request.
 * @see HttpServerParser#request(HttpAdapter,Object,SpanCustomizer)
 */
public <C>Span handleReceive(TraceContext.Extractor<C> extractor,C carrier,Req request){
  Span span=nextSpan(extractor.extract(carrier),request);
  if (span.isNoop())   return span;
  span.kind(Span.Kind.SERVER);
  parser.request(adapter,request,span);
  boolean parsedEndpoint=false;
  if (Platform.get().zipkinV1Present()) {
    zipkin.Endpoint.Builder deprecatedEndpoint=zipkin.Endpoint.builder().serviceName("String_Node_Str");
    if ((parsedEndpoint=adapter.parseClientAddress(request,deprecatedEndpoint))) {
      span.remoteEndpoint(deprecatedEndpoint.build());
    }
  }
  if (!parsedEndpoint) {
    Endpoint.Builder remoteEndpoint=Endpoint.newBuilder();
    if (adapter.parseClientAddress(request,remoteEndpoint)) {
      span.remoteEndpoint(remoteEndpoint.build());
    }
  }
  return span.start();
}

Fixed version (ground truth):
/** 
 * Like   {@link #handleReceive(TraceContext.Extractor,Object)}, except for when the carrier of trace data is not the same as the request.
 * @see HttpServerParser#request(HttpAdapter,Object,SpanCustomizer)
 */
public <C>Span handleReceive(TraceContext.Extractor<C> extractor,C carrier,Req request){
  Span span=nextSpan(extractor.extract(carrier),request);
  if (span.isNoop())   return span;
  span.kind(Span.Kind.SERVER);
  Tracer.SpanInScope ws=tracer.withSpanInScope(span);
  try {
    parser.request(adapter,request,span);
  }
  finally {
    ws.close();
  }
  boolean parsedEndpoint=false;
  if (Platform.get().zipkinV1Present()) {
    zipkin.Endpoint.Builder deprecatedEndpoint=zipkin.Endpoint.builder().serviceName("String_Node_Str");
    if ((parsedEndpoint=adapter.parseClientAddress(request,deprecatedEndpoint))) {
      span.remoteEndpoint(deprecatedEndpoint.build());
    }
  }
  if (!parsedEndpoint) {
    Endpoint.Builder remoteEndpoint=Endpoint.newBuilder();
    if (adapter.parseClientAddress(request,remoteEndpoint)) {
      span.remoteEndpoint(remoteEndpoint.build());
    }
  }
  return span.start();
}
Program: 15284
Project: 15284
Buggy source:
/** 
 * Finishes the server span after assigning it tags according to the response or error. <p>This is typically called once the response headers are sent, and after the span is   {@link brave.Tracer.SpanInScope#close() no longer in scope}.
 * @see HttpServerParser#response(HttpAdapter,Object,Throwable,SpanCustomizer)
 */
public void handleSend(@Nullable Resp response,@Nullable Throwable error,Span span){
  if (span.isNoop())   return;
  try {
    parser.response(adapter,response,error,span);
  }
  finally {
    span.finish();
  }
}

Fixed version (ground truth):
/** 
 * Finishes the server span after assigning it tags according to the response or error. <p>This is typically called once the response headers are sent, and after the span is   {@link brave.Tracer.SpanInScope#close() no longer in scope}.
 * @see HttpServerParser#response(HttpAdapter,Object,Throwable,SpanCustomizer)
 */
public void handleSend(@Nullable Resp response,@Nullable Throwable error,Span span){
  if (span.isNoop())   return;
  Tracer.SpanInScope ws=tracer.withSpanInScope(span);
  try {
    parser.response(adapter,response,error,span);
  }
  finally {
    ws.close();
    span.finish();
  }
}
Program: 15285
Project: 15285
Buggy source:
TraceContext nextContext(@Nullable TraceContext parent,SamplingFlags samplingFlags){
  long nextId=Platform.get().randomLong();
  if (parent != null) {
    return parent.toBuilder().spanId(nextId).parentId(parent.spanId()).build();
  }
  return TraceContext.newBuilder().sampled(samplingFlags.sampled()).debug(samplingFlags.debug()).traceIdHigh(traceId128Bit ? Platform.get().randomLong() : 0L).traceId(nextId).spanId(nextId).build();
}

Fixed version (ground truth):
TraceContext nextContext(@Nullable TraceContext parent,SamplingFlags samplingFlags){
  long nextId=Platform.get().randomLong();
  if (parent != null) {
    return parent.toBuilder().spanId(nextId).parentId(parent.spanId()).shared(false).build();
  }
  return TraceContext.newBuilder().sampled(samplingFlags.sampled()).debug(samplingFlags.debug()).traceIdHigh(traceId128Bit ? Platform.get().randomLong() : 0L).traceId(nextId).spanId(nextId).build();
}
Program: 15286
Project: 15286
Buggy source:
/** 
 * Sets current client span. <p/> Should be thread-aware to support multiple parallel requests.
 * @param span Client span.
 */
void setCurrentClientSpan(final Span span);

Fixed version (ground truth):
/** 
 * Sets current client span. <p/> Should be thread-aware to support multiple parallel requests.
 * @param span Client span.
 */
void setCurrentClientSpan(@Nullable Span span);
Program: 15287
Project: 15287
Buggy source:
/** 
 * Gets the Span for the client request that was started as part of current request. <p/> Should be thread-aware to support multiple parallel requests.
 * @return Client request span for current thread.
 */
Span getCurrentClientSpan();

Fixed version (ground truth):
/** 
 * Gets the Span for the client request that was started as part of current request. <p/> Should be thread-aware to support multiple parallel requests.
 * @return Client request span for current thread.
 */
@Nullable Span getCurrentClientSpan();
Program: 15288
Project: 15288
Buggy source:
@Override public void setCurrentClientSpan(final Span span){
  currentClientSpan.set(span);
}

Fixed version (ground truth):
@Override public void setCurrentClientSpan(@Nullable Span span){
  currentClientSpan.set(span);
}
Program: 15289
Project: 15289
Buggy source:
@Override public void setCurrentServerSpan(final ServerSpan span){
  if (span == null) {
    currentServerSpan.remove();
  }
 else {
    currentServerSpan.set(span);
  }
}

Fixed version (ground truth):
@Override public void setCurrentServerSpan(@Nullable ServerSpan span){
  if (span == null) {
    currentServerSpan.remove();
  }
 else {
    currentServerSpan.set(span);
  }
}
Program: 15290
Project: 15290
Buggy source:
/** 
 * Never returns null:   {@code setCurrentServerSpan(null)} coerces to {@link ServerSpan#EMPTY} 
 */
@Override public ServerSpan getCurrentServerSpan(){
  return currentServerSpan.get();
}

Fixed version (ground truth):
/** 
 * Never returns null:   {@code setCurrentServerSpan(null)} coerces to {@link ServerSpan#EMPTY} 
 */
@Override @Nonnull public ServerSpan getCurrentServerSpan(){
  return currentServerSpan.get();
}
Program: 15291
Project: 15291
Buggy source:
/** 
 * Sets the specified local span as the active span at the top of the stack, or if the specified span is null, the top of the stack is popped.
 * @param span Local span.
 */
@Override public void setCurrentLocalSpan(Span span){
  Deque<Span> deque=currentLocalSpan.get();
  if (span == null) {
    deque.pollFirst();
  }
 else {
    deque.addFirst(span);
  }
}

Fixed version (ground truth):
/** 
 * Sets the specified local span as the active span at the top of the stack, or if the specified span is null, the top of the stack is popped.
 * @param span Local span.
 */
@Override public void setCurrentLocalSpan(@Nullable Span span){
  Deque<Span> deque=currentLocalSpan.get();
  if (span == null) {
    deque.pollFirst();
  }
 else {
    deque.addFirst(span);
  }
}
Program: 15292
Project: 15292
Buggy source:
@Override public Span getCurrentClientSpan(){
  return currentClientSpan.get();
}

Fixed version (ground truth):
@Override @Nullable public Span getCurrentClientSpan(){
  return currentClientSpan.get();
}
Program: 15293
Project: 15293
Buggy source:
/** 
 * Sets current local span. <p/> Should be thread-aware to support multiple parallel requests.
 * @param span Local span.
 */
void setCurrentLocalSpan(Span span);

Fixed version (ground truth):
/** 
 * Sets current local span. <p/> Should be thread-aware to support multiple parallel requests.
 * @param span Local span.
 */
void setCurrentLocalSpan(@Nullable Span span);
Program: 15294
Project: 15294
Buggy source:
/** 
 * Set span for current request.
 * @param span Span for current request.
 */
void setCurrentServerSpan(final ServerSpan span);

Fixed version (ground truth):
/** 
 * Set span for current request.
 * @param span Span for current request.
 */
void setCurrentServerSpan(@Nullable ServerSpan span);
Program: 15295
Project: 15295
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void setCurrentClientSpan(final Span span){
  currentClientSpan.set(span);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void setCurrentClientSpan(@Nullable Span span){
  currentClientSpan.set(span);
}
Program: 15296
Project: 15296
Buggy source:
@Override public Span getCurrentLocalSpan(){
  return currentLocalSpan.get();
}

Fixed version (ground truth):
@Override @Nullable public Span getCurrentLocalSpan(){
  return currentLocalSpan.get();
}
Program: 15297
Project: 15297
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void setCurrentServerSpan(final ServerSpan span){
  if (span == null) {
    currentServerSpan.remove();
  }
 else {
    currentServerSpan.set(span);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void setCurrentServerSpan(@Nullable ServerSpan span){
  if (span == null) {
    currentServerSpan.remove();
  }
 else {
    currentServerSpan.set(span);
  }
}
Program: 15298
Project: 15298
Buggy source:
/** 
 * Never returns null:   {@code setCurrentServerSpan(null)} coerces to {@link ServerSpan#EMPTY} 
 */
@Override public ServerSpan getCurrentServerSpan(){
  return currentServerSpan.get();
}

Fixed version (ground truth):
/** 
 * Never returns null:   {@code setCurrentServerSpan(null)} coerces to {@link ServerSpan#EMPTY} 
 */
@Override @Nonnull public ServerSpan getCurrentServerSpan(){
  return currentServerSpan.get();
}
Program: 15299
Project: 15299
Buggy source:
@Override public Boolean sample(){
  return currentServerSpan.get().getSample();
}

Fixed version (ground truth):
@Override @Nullable public Boolean sample(){
  return currentServerSpan.get().getSample();
}
Program: 15300
Project: 15300
Buggy source:
@Override public void setCurrentLocalSpan(Span span){
  if (span == null) {
    currentLocalSpan.remove();
  }
 else {
    currentLocalSpan.set(span);
  }
}

Fixed version (ground truth):
@Override public void setCurrentLocalSpan(@Nullable Span span){
  if (span == null) {
    currentLocalSpan.remove();
  }
 else {
    currentLocalSpan.set(span);
  }
}
Program: 15301
Project: 15301
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public Span getCurrentClientSpan(){
  return currentClientSpan.get();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override @Nullable public Span getCurrentClientSpan(){
  return currentClientSpan.get();
}
Program: 15302
Project: 15302
Buggy source:
@Override public TraceContextOrSamplingFlags extract(C carrier){
  if (carrier == null)   throw new NullPointerException("String_Node_Str");
  String sampledString=getter.get(carrier,propagation.sampledKey);
  Boolean sampled=sampledString != null ? sampledString.equals("String_Node_Str") || sampledString.equalsIgnoreCase("String_Node_Str") : null;
  boolean debug="String_Node_Str".equals(getter.get(carrier,propagation.debugKey));
  String traceIdString=getter.get(carrier,propagation.traceIdKey);
  TraceContext.Builder result=TraceContext.newBuilder().sampled(sampled).debug(debug);
  if (traceIdString != null) {
    result.traceIdHigh(traceIdString.length() == 32 ? lowerHexToUnsignedLong(traceIdString,0) : 0);
    result.traceId(lowerHexToUnsignedLong(traceIdString));
  }
  String spanIdString=getter.get(carrier,propagation.spanIdKey);
  if (spanIdString != null) {
    result.spanId(lowerHexToUnsignedLong(spanIdString));
  }
  String parentSpanIdString=getter.get(carrier,propagation.parentSpanIdKey);
  if (parentSpanIdString != null) {
    result.parentId(lowerHexToUnsignedLong(parentSpanIdString));
  }
  return TraceContextOrSamplingFlags.create(result);
}

Fixed version (ground truth):
@Override public TraceContextOrSamplingFlags extract(C carrier){
  if (carrier == null)   throw new NullPointerException("String_Node_Str");
  String sampledString=getter.get(carrier,propagation.sampledKey);
  Boolean sampled=sampledString != null ? sampledString.equals("String_Node_Str") || sampledString.equalsIgnoreCase("String_Node_Str") : null;
  boolean debug="String_Node_Str".equals(getter.get(carrier,propagation.debugKey));
  String traceIdString=getter.get(carrier,propagation.traceIdKey);
  if (traceIdString == null) {
    return TraceContextOrSamplingFlags.create(new SamplingFlags.Builder().sampled(sampled).debug(debug).build());
  }
  TraceContext.Builder result=TraceContext.newBuilder().sampled(sampled).debug(debug);
  result.traceIdHigh(traceIdString.length() == 32 ? lowerHexToUnsignedLong(traceIdString,0) : 0);
  result.traceId(lowerHexToUnsignedLong(traceIdString));
  String spanIdString=getter.get(carrier,propagation.spanIdKey);
  if (spanIdString != null) {
    result.spanId(lowerHexToUnsignedLong(spanIdString));
  }
  String parentSpanIdString=getter.get(carrier,propagation.parentSpanIdKey);
  if (parentSpanIdString != null) {
    result.parentId(lowerHexToUnsignedLong(parentSpanIdString));
  }
  return TraceContextOrSamplingFlags.create(result);
}
Program: 15303
Project: 15303
Buggy source:
/** 
 * Identifies problems by throwing assertion errors when a scope is closed on a different thread. 
 */
@Override public Scope newScope(TraceContext currentSpan){
  local.set(currentSpan);
  return new StrictScope(new Throwable(String.format("String_Node_Str",Thread.currentThread().getName(),currentSpan)));
}

Fixed version (ground truth):
/** 
 * Identifies problems by throwing assertion errors when a scope is closed on a different thread. 
 */
@Override public Scope newScope(TraceContext currentSpan){
  TraceContext previous=local.get();
  local.set(currentSpan);
  return new StrictScope(previous,new Error(String.format("String_Node_Str",Thread.currentThread().getName(),currentSpan)));
}
Program: 15304
Project: 15304
Buggy source:
StrictScope(Throwable caller){
  this.caller=caller;
}

Fixed version (ground truth):
StrictScope(TraceContext previous,Throwable caller){
  this.previous=previous;
  this.caller=caller;
}
Program: 15305
Project: 15305
Buggy source:
/** 
 * Returns true if this is the root span. 
 */
public final boolean root(){
  return (flags & FLAG_IS_ROOT) == FLAG_IS_ROOT || parentId == traceId && parentId == spanId;
}

Fixed version (ground truth):
/** 
 * Returns true if this is the root span. 
 */
public final boolean root(){
  return (flags & FLAG_IS_ROOT) == FLAG_IS_ROOT || (parentId == traceId && parentId == spanId);
}
Program: 15306
Project: 15306
Buggy source:
@Nullable public final void accept(T input){
  ServerSpan serverSpan=threadBinder.getCurrentServerSpan();
  Span span=serverSpan != null ? serverSpan.getSpan() : null;
  if (span == null)   return;
  byte[] addressBytes;
  try {
    addressBytes=parseAddressBytes(input);
    if (addressBytes == null)     return;
  }
 catch (  RuntimeException e) {
    return;
  }
  Endpoint.Builder builder=Endpoint.builder().serviceName("String_Node_Str");
  if (addressBytes.length == 4) {
    builder.ipv4(ByteBuffer.wrap(addressBytes).getInt());
  }
 else   if (addressBytes.length == 16) {
    boolean maybeIpv4Compat=true;
    for (int i=0; i < 10; i++) {
      if (addressBytes[i] != 0) {
        maybeIpv4Compat=false;
        break;
      }
    }
    if (maybeIpv4Compat) {
      ByteBuffer buffer=ByteBuffer.wrap(addressBytes,10,6);
      short flag=buffer.getShort();
      if (flag == 0 || flag == -1) {
        builder.ipv4(buffer.getInt());
      }
 else {
        builder.ipv6(addressBytes);
      }
    }
 else {
      builder.ipv6(addressBytes);
    }
  }
 else {
    return;
  }
  try {
    int port=parsePort(input);
    if (port > 0)     builder.port(port);
  }
 catch (  RuntimeException ignore) {
  }
  Endpoint ca=builder.build();
synchronized (span) {
    span.addToBinary_annotations(BinaryAnnotation.address(CLIENT_ADDR,ca));
  }
}

Fixed version (ground truth):
public final void accept(T input){
  ServerSpan serverSpan=threadBinder.getCurrentServerSpan();
  Span span=serverSpan != null ? serverSpan.getSpan() : null;
  if (span == null)   return;
  byte[] addressBytes;
  try {
    addressBytes=parseAddressBytes(input);
    if (addressBytes == null)     return;
  }
 catch (  RuntimeException e) {
    return;
  }
  Endpoint.Builder builder=Endpoint.builder().serviceName("String_Node_Str");
  if (addressBytes.length == 4) {
    builder.ipv4(ByteBuffer.wrap(addressBytes).getInt());
  }
 else   if (addressBytes.length == 16) {
    boolean maybeIpv4Compat=true;
    for (int i=0; i < 10; i++) {
      if (addressBytes[i] != 0) {
        maybeIpv4Compat=false;
        break;
      }
    }
    if (maybeIpv4Compat) {
      ByteBuffer buffer=ByteBuffer.wrap(addressBytes,10,6);
      short flag=buffer.getShort();
      if (flag == 0 || flag == -1) {
        builder.ipv4(buffer.getInt());
      }
 else {
        builder.ipv6(addressBytes);
      }
    }
 else {
      builder.ipv6(addressBytes);
    }
  }
 else {
    return;
  }
  try {
    int port=parsePort(input);
    if (port > 0)     builder.port(port);
  }
 catch (  RuntimeException ignore) {
  }
  Endpoint ca=builder.build();
synchronized (span) {
    span.addToBinary_annotations(BinaryAnnotation.address(CLIENT_ADDR,ca));
  }
}