Closing Reader-s
MODIFY
dd-trace-api/src/main/java/datadog/trace/api/DDTraceApiInfo.java
dd-trace-api/src/main/java/datadog/trace/api/DDTraceApiInfo.java
@@ -10,13 +10,12 @@ public class DDTraceApiInfo {
static {
String v;
- try {
- final StringBuilder sb = new StringBuilder();
-
- final BufferedReader br =
+ try (final BufferedReader br =
new BufferedReader(
new InputStreamReader(
- DDTraceApiInfo.class.getResourceAsStream("/dd-trace-api.version"), "UTF-8"));
+ DDTraceApiInfo.class.getResourceAsStream("/dd-trace-api.version"), "UTF-8"))) {
+ final StringBuilder sb = new StringBuilder();
+
for (int c = br.read(); c != -1; c = br.read()) sb.append((char) c);
v = sb.toString().trim();

MODIFY
dd-trace-ot/src/main/java/datadog/opentracing/DDTraceOTInfo.java
dd-trace-ot/src/main/java/datadog/opentracing/DDTraceOTInfo.java
@@ -15,13 +15,12 @@ public class DDTraceOTInfo {
static {
String v;
- try {
- final StringBuilder sb = new StringBuilder();
-
- final BufferedReader br =
+ try (final BufferedReader br =
new BufferedReader(
new InputStreamReader(
- DDTraceOTInfo.class.getResourceAsStream("/dd-trace-ot.version"), "UTF-8"));
+ DDTraceOTInfo.class.getResourceAsStream("/dd-trace-ot.version"), "UTF-8"))) {
+ final StringBuilder sb = new StringBuilder();
+
for (int c = br.read(); c != -1; c = br.read()) sb.append((char) c);
v = sb.toString().trim();

Closing Reader-s