3535import com .uber .jaeger .utils .Clock ;
3636import com .uber .jaeger .utils .SystemClock ;
3737import com .uber .jaeger .utils .Utils ;
38- import io .opentracing .References ;
39- import io .opentracing .propagation .Format ;
40- import io .opentracing .tag .Tags ;
4138
4239import java .io .InputStream ;
4340import java .net .Inet4Address ;
4643import java .util .Collections ;
4744import java .util .HashMap ;
4845import java .util .Map ;
49- import java .util .Objects ;
5046import java .util .Properties ;
47+
48+ import io .opentracing .References ;
49+ import io .opentracing .propagation .Format ;
50+ import io .opentracing .tag .Tags ;
5151import lombok .ToString ;
5252import lombok .extern .slf4j .Slf4j ;
5353
@@ -89,7 +89,7 @@ private Tracer(
8989
9090 this .version = loadVersion ();
9191
92- Map <String , Object > tags = new HashMap <>();
92+ Map <String , Object > tags = new HashMap <String , Object >();
9393 tags .put ("jaeger.version" , this .version );
9494 String hostname = getHostName ();
9595 if (hostname != null ) {
@@ -164,7 +164,7 @@ class SpanBuilder implements io.opentracing.Tracer.SpanBuilder {
164164 private String operationName = null ;
165165 private long startTimeMicroseconds ;
166166 private SpanContext parent ;
167- private final Map <String , Object > tags = new HashMap <>();
167+ private final Map <String , Object > tags = new HashMap <String , Object >();
168168
169169 SpanBuilder (String operationName ) {
170170 this .operationName = operationName ;
@@ -192,8 +192,8 @@ public io.opentracing.Tracer.SpanBuilder asChildOf(io.opentracing.Span parent) {
192192 public io .opentracing .Tracer .SpanBuilder addReference (
193193 String referenceType , io .opentracing .SpanContext referencedContext ) {
194194 if (parent == null
195- && (Objects .equals (referenceType , References .CHILD_OF )
196- || Objects .equals (referenceType , References .FOLLOWS_FROM ))) {
195+ && (Utils .equals (referenceType , References .CHILD_OF )
196+ || Utils .equals (referenceType , References .FOLLOWS_FROM ))) {
197197 this .parent = (SpanContext ) referencedContext ;
198198 }
199199 return this ;
@@ -376,8 +376,8 @@ public Tracer build() {
376376 }
377377
378378 private static class PropagationRegistry {
379- private final Map <Format <?>, Injector <?>> injectors = new HashMap <>();
380- private final Map <Format <?>, Extractor <?>> extractors = new HashMap <>();
379+ private final Map <Format <?>, Injector <?>> injectors = new HashMap <Format <?>, Injector <?> >();
380+ private final Map <Format <?>, Extractor <?>> extractors = new HashMap <Format <?>, Extractor <?> >();
381381
382382 @ SuppressWarnings ("unchecked" )
383383 <T > Injector <T > getInjector (Format <T > format ) {
@@ -401,10 +401,13 @@ public <T> void register(Format<T> format, Extractor<T> extractor) {
401401 private static String loadVersion () {
402402 String version ;
403403 try {
404- try (InputStream is = Tracer .class .getResourceAsStream ("jaeger.properties" )) {
404+ InputStream is = Tracer .class .getResourceAsStream ("jaeger.properties" );
405+ try {
405406 Properties prop = new Properties ();
406407 prop .load (is );
407408 version = prop .getProperty ("jaeger.version" );
409+ } finally {
410+ is .close ();
408411 }
409412 } catch (Exception e ) {
410413 throw new RuntimeException ("Cannot read jaeger.properties" , e );
0 commit comments