Skip to content

Commit d8c483e

Browse files
keshavpeswaniashishagg
authored andcommitted
Downgrading apache commonslang3 to 3.0 version (#63)
1 parent 4646e9b commit d8c483e

File tree

11 files changed

+118
-164
lines changed

11 files changed

+118
-164
lines changed

core/src/main/java/com/expedia/www/haystack/client/LogData.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,25 @@
1616
*/
1717
package com.expedia.www.haystack.client;
1818

19+
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
20+
import org.apache.commons.lang3.builder.ToStringStyle;
21+
1922
import java.util.Collections;
2023
import java.util.HashMap;
2124
import java.util.Map;
2225
import java.util.Objects;
2326

24-
import org.apache.commons.lang3.builder.RecursiveToStringStyle;
25-
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
26-
2727
public class LogData {
2828
private final Long timestamp;
2929
private final Map<String, ?> fields;
3030

3131
public LogData(Long timestamp, String event) {
3232
this(timestamp,
33-
new HashMap<String, Object>(1) {
34-
{
35-
put(event, null);
36-
}
37-
});
33+
new HashMap<String, Object>(1) {
34+
{
35+
put(event, null);
36+
}
37+
});
3838
}
3939

4040
public LogData(Long timestamp, Map<String, ?> fields) {
@@ -48,8 +48,8 @@ public LogData(Long timestamp, Map<String, ?> fields) {
4848

4949
@Override
5050
public String toString() {
51-
return new ReflectionToStringBuilder(this, RecursiveToStringStyle.JSON_STYLE)
52-
.toString();
51+
return new ReflectionToStringBuilder(this, ToStringStyle.SIMPLE_STYLE)
52+
.toString();
5353
}
5454

5555
@Override
@@ -63,7 +63,7 @@ public boolean equals(Object obj) {
6363
if (obj == null || getClass() != obj.getClass()) return false;
6464
LogData logData = (LogData) obj;
6565
return Objects.equals(timestamp, logData.getTimestamp())
66-
&& Objects.equals(fields, logData.getFields());
66+
&& Objects.equals(fields, logData.getFields());
6767
}
6868

6969
/**

core/src/main/java/com/expedia/www/haystack/client/Reference.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
*/
1717
package com.expedia.www.haystack.client;
1818

19-
import java.util.Objects;
20-
21-
import org.apache.commons.lang3.builder.RecursiveToStringStyle;
2219
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
20+
import org.apache.commons.lang3.builder.ToStringStyle;
21+
22+
import java.util.Objects;
2323

2424
public class Reference {
2525
private final String referenceType;
@@ -36,7 +36,7 @@ public boolean equals(Object obj) {
3636
if (obj == null || getClass() != obj.getClass()) return false;
3737
Reference reference = (Reference) obj;
3838
return Objects.equals(referenceType, reference.getReferenceType())
39-
&& Objects.equals(context, reference.getContext());
39+
&& Objects.equals(context, reference.getContext());
4040
}
4141

4242
@Override
@@ -46,8 +46,8 @@ public int hashCode() {
4646

4747
@Override
4848
public String toString() {
49-
return new ReflectionToStringBuilder(this, RecursiveToStringStyle.JSON_STYLE)
50-
.toString();
49+
return new ReflectionToStringBuilder(this, ToStringStyle.SIMPLE_STYLE)
50+
.toString();
5151
}
5252

5353
/**

core/src/main/java/com/expedia/www/haystack/client/Span.java

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,11 @@
1616
*/
1717
package com.expedia.www.haystack.client;
1818

19-
import java.util.ArrayList;
20-
import java.util.Collection;
21-
import java.util.Collections;
22-
import java.util.HashMap;
23-
import java.util.List;
24-
import java.util.Map;
25-
import java.util.concurrent.atomic.AtomicReference;
26-
27-
import org.apache.commons.lang3.builder.RecursiveToStringStyle;
2819
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
20+
import org.apache.commons.lang3.builder.ToStringStyle;
21+
22+
import java.util.*;
23+
import java.util.concurrent.atomic.AtomicReference;
2924

3025
public class Span implements io.opentracing.Span {
3126
private final Tracer tracer;
@@ -67,18 +62,17 @@ public Span(Tracer tracer, Clock clock, String operationName, SpanContext contex
6762

6863
@Override
6964
public String toString() {
70-
return new ReflectionToStringBuilder(this, RecursiveToStringStyle.JSON_STYLE)
71-
.setExcludeFieldNames("tracer", "clock")
72-
.toString();
65+
return new ReflectionToStringBuilder(this, ToStringStyle.SIMPLE_STYLE)
66+
.setExcludeFieldNames("tracer", "clock")
67+
.toString();
7368
}
7469

7570
/**
7671
* Helper to record illegal access to span internals after <code>finish()</code>
7772
* has been called.
7873
*
7974
* @param format The string format to include in the execption message
80-
* @param args Any arguments needed to populate the supplied format
81-
*
75+
* @param args Any arguments needed to populate the supplied format
8276
*/
8377
protected synchronized void finishedCheck(String format, Object... args) {
8478
if (finished.get()) {

core/src/main/java/com/expedia/www/haystack/client/SpanContext.java

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,11 @@
1616
*/
1717
package com.expedia.www.haystack.client;
1818

19-
import java.util.Collections;
20-
import java.util.HashMap;
21-
import java.util.Map;
22-
import java.util.Map.Entry;
23-
import java.util.Objects;
24-
import java.util.UUID;
25-
26-
import org.apache.commons.lang3.builder.RecursiveToStringStyle;
2719
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
20+
import org.apache.commons.lang3.builder.ToStringStyle;
21+
22+
import java.util.*;
23+
import java.util.Map.Entry;
2824

2925
public class SpanContext implements io.opentracing.SpanContext {
3026

@@ -59,15 +55,15 @@ public boolean equals(Object obj) {
5955
if (obj == null || getClass() != obj.getClass()) return false;
6056
SpanContext context = (SpanContext) obj;
6157
return Objects.equals(traceId, context.getTraceId())
62-
&& Objects.equals(spanId, context.getSpanId())
63-
&& Objects.equals(parentId, context.getParentId())
64-
&& Objects.equals(baggage, context.getBaggage());
58+
&& Objects.equals(spanId, context.getSpanId())
59+
&& Objects.equals(parentId, context.getParentId())
60+
&& Objects.equals(baggage, context.getBaggage());
6561
}
6662

6763
@Override
6864
public String toString() {
69-
return new ReflectionToStringBuilder(this, RecursiveToStringStyle.JSON_STYLE)
70-
.toString();
65+
return new ReflectionToStringBuilder(this, ToStringStyle.SIMPLE_STYLE)
66+
.toString();
7167
}
7268

7369
public SpanContext addBaggage(Map<String, String> newBaggage) {
@@ -94,7 +90,6 @@ public String getBaggageItem(String key) {
9490
}
9591

9692

97-
9893
/**
9994
* @return the traceId
10095
*/

core/src/main/java/com/expedia/www/haystack/client/Tracer.java

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,36 +16,26 @@
1616
*/
1717
package com.expedia.www.haystack.client;
1818

19-
import java.io.IOException;
20-
import java.util.ArrayList;
21-
import java.util.Collections;
22-
import java.util.HashMap;
23-
import java.util.List;
24-
import java.util.Map;
25-
import java.util.UUID;
26-
27-
import org.apache.commons.lang3.builder.RecursiveToStringStyle;
28-
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
29-
3019
import com.expedia.www.haystack.client.dispatchers.Dispatcher;
31-
import com.expedia.www.haystack.client.metrics.Counter;
32-
import com.expedia.www.haystack.client.metrics.Metrics;
33-
import com.expedia.www.haystack.client.metrics.MetricsRegistry;
34-
import com.expedia.www.haystack.client.metrics.Tag;
20+
import com.expedia.www.haystack.client.metrics.*;
3521
import com.expedia.www.haystack.client.metrics.Timer;
3622
import com.expedia.www.haystack.client.metrics.Timer.Sample;
3723
import com.expedia.www.haystack.client.propagation.Extractor;
3824
import com.expedia.www.haystack.client.propagation.Injector;
3925
import com.expedia.www.haystack.client.propagation.PropagationRegistry;
4026
import com.expedia.www.haystack.client.propagation.TextMapPropagator;
41-
4227
import io.opentracing.References;
4328
import io.opentracing.Scope;
4429
import io.opentracing.ScopeManager;
4530
import io.opentracing.Span;
4631
import io.opentracing.propagation.Format;
4732
import io.opentracing.propagation.TextMap;
4833
import io.opentracing.util.ThreadLocalScopeManager;
34+
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
35+
import org.apache.commons.lang3.builder.ToStringStyle;
36+
37+
import java.io.IOException;
38+
import java.util.*;
4939

5040
public class Tracer implements io.opentracing.Tracer {
5141
private final Dispatcher dispatcher;
@@ -93,15 +83,15 @@ public Tracer(String serviceName, ScopeManager scopeManager, Clock clock, Dispat
9383

9484
@Override
9585
public String toString() {
96-
return new ReflectionToStringBuilder(this, RecursiveToStringStyle.JSON_STYLE)
97-
.setExcludeFieldNames("clock", "activeSource")
98-
.toString();
86+
return new ReflectionToStringBuilder(this, ToStringStyle.SIMPLE_STYLE)
87+
.setExcludeFieldNames("clock", "activeSource")
88+
.toString();
9989
}
10090

10191
public void close() throws IOException {
10292
try (Sample timer = closeTimer.start()) {
10393
dispatcher.close();
104-
} catch(IOException e) {
94+
} catch (IOException e) {
10595
closeExceptionCounter.increment();
10696
throw e;
10797
}
@@ -110,7 +100,7 @@ public void close() throws IOException {
110100
public void flush() throws IOException {
111101
try (Sample timer = flushTimer.start()) {
112102
dispatcher.flush();
113-
} catch(IOException e) {
103+
} catch (IOException e) {
114104
flushExceptionCounter.increment();
115105
throw e;
116106
}
@@ -290,9 +280,9 @@ protected SpanContext createDependentContext() {
290280
}
291281

292282
return createContext(parent.getContext().getTraceId(),
293-
UUID.randomUUID(),
294-
parent.getContext().getSpanId(),
295-
baggage);
283+
UUID.randomUUID(),
284+
parent.getContext().getSpanId(),
285+
baggage);
296286
}
297287

298288
protected SpanContext createContext() {

core/src/main/java/com/expedia/www/haystack/client/dispatchers/ChainedDispatcher.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,15 @@
1616
*/
1717
package com.expedia.www.haystack.client.dispatchers;
1818

19+
import com.expedia.www.haystack.client.Span;
20+
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
21+
import org.apache.commons.lang3.builder.ToStringStyle;
22+
1923
import java.io.IOException;
2024
import java.util.ArrayList;
2125
import java.util.Collections;
2226
import java.util.List;
2327

24-
import org.apache.commons.lang3.builder.RecursiveToStringStyle;
25-
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
26-
27-
import com.expedia.www.haystack.client.Span;
28-
2928
public class ChainedDispatcher implements Dispatcher {
3029
private final List<Dispatcher> dispatchers;
3130

@@ -41,8 +40,8 @@ public ChainedDispatcher(Dispatcher... dispatchers) {
4140

4241
@Override
4342
public String toString() {
44-
return new ReflectionToStringBuilder(this, RecursiveToStringStyle.JSON_STYLE)
45-
.toString();
43+
return new ReflectionToStringBuilder(this, ToStringStyle.SIMPLE_STYLE)
44+
.toString();
4645
}
4746

4847
@Override
@@ -87,7 +86,7 @@ public void flush() throws IOException {
8786
}
8887

8988
public static class Builder {
90-
private List<Dispatcher> dispatchers = new ArrayList<>();;
89+
private List<Dispatcher> dispatchers = new ArrayList<>();
9190

9291
public Builder withDispatcher(Dispatcher dispatcher) {
9392
dispatchers.add(dispatcher);

core/src/main/java/com/expedia/www/haystack/client/dispatchers/LoggerDispatcher.java

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,16 @@
1616
*/
1717
package com.expedia.www.haystack.client.dispatchers;
1818

19-
import java.io.IOException;
20-
import java.util.Arrays;
21-
22-
import org.apache.commons.lang3.builder.RecursiveToStringStyle;
19+
import com.expedia.www.haystack.client.Span;
20+
import com.expedia.www.haystack.client.metrics.*;
21+
import com.expedia.www.haystack.client.metrics.Timer.Sample;
2322
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
23+
import org.apache.commons.lang3.builder.ToStringStyle;
2424
import org.slf4j.Logger;
2525
import org.slf4j.LoggerFactory;
2626

27-
import com.expedia.www.haystack.client.Span;
28-
import com.expedia.www.haystack.client.metrics.Counter;
29-
import com.expedia.www.haystack.client.metrics.Metrics;
30-
import com.expedia.www.haystack.client.metrics.MetricsRegistry;
31-
import com.expedia.www.haystack.client.metrics.Tag;
32-
import com.expedia.www.haystack.client.metrics.Timer;
33-
import com.expedia.www.haystack.client.metrics.Timer.Sample;
27+
import java.io.IOException;
28+
import java.util.Arrays;
3429

3530
public class LoggerDispatcher implements Dispatcher {
3631
private final Logger logger;
@@ -53,9 +48,9 @@ public LoggerDispatcher(Metrics metrics, Logger logger) {
5348

5449
@Override
5550
public String toString() {
56-
return new ReflectionToStringBuilder(this, RecursiveToStringStyle.JSON_STYLE)
57-
.setExcludeFieldNames("metrics")
58-
.toString();
51+
return new ReflectionToStringBuilder(this, ToStringStyle.SIMPLE_STYLE)
52+
.setExcludeFieldNames("metrics")
53+
.toString();
5954
}
6055

6156
@Override

0 commit comments

Comments
 (0)