Fix flaky http url connection test
https://ge.opentelemetry.io/s/2x656dnceehhk/tests/:instrumentation:http-url-connection:javaagent:test/io.opentelemetry.javaagent.instrumentation.httpurlconnection.HttpUrlConnectionTest/traceRequest(boolean)%5B1%5D?top-execution=1
MODIFY
instrumentation/http-url-connection/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/httpurlconnection/StreamUtils.java
instrumentation/http-url-connection/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/httpurlconnection/StreamUtils.java
@@ -7,7 +7,6 @@ package io.opentelemetry.javaagent.instrumentation.httpurlconnection;
import static java.nio.charset.StandardCharsets.UTF_8;
-import com.google.common.base.Strings;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
@@ -19,9 +18,9 @@ final class StreamUtils {
static List<String> readLines(InputStream stream) throws IOException {
List<String> lines = new ArrayList<>();
BufferedReader reader = new BufferedReader(new InputStreamReader(stream, UTF_8));
- while (reader.ready()) {
- String line = reader.readLine();
- if (!Strings.isNullOrEmpty(line)) {
+ String line;
+ while ((line = reader.readLine()) != null) {
+ if (!line.isEmpty()) {
lines.add(line);
}
}

Fix flaky http url connection test (#7724)

https://ge.opentelemetry.io/s/2x656dnceehhk/tests/:instrumentation:http-url-connection:javaagent:test/io.opentelemetry.javaagent.instrumentation.httpurlconnection.HttpUrlConnectionTest/traceRequest(boolean)%5B1%5D?top-execution=1