Use Files.readString() 63/108463/1
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 16 Oct 2023 17:34:13 +0000 (19:34 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 16 Oct 2023 17:34:13 +0000 (19:34 +0200)
Since Java 11 we have a simple convenience method to read the contents
of a UTF-8-encoded file. Use that instead of going through a CharSource.

Change-Id: I1ddf210a7d5fb0d78296fbc897593e395e75ae63
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/client/stress/StressClient.java

index cd26030a964d399c3d6b9be48a71e27371bd60a1..0a61735b26263407b0029089dfb307c508d2487a 100644 (file)
@@ -5,18 +5,16 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.netconf.test.tool.client.stress;
 
 import ch.qos.logback.classic.Level;
 import com.google.common.base.Stopwatch;
-import com.google.common.io.Files;
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import io.netty.channel.nio.NioEventLoopGroup;
 import io.netty.util.HashedWheelTimer;
 import io.netty.util.Timer;
 import java.io.IOException;
-import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.ExecutionException;
@@ -126,7 +124,7 @@ public final class StressClient {
 
         final String editContentString;
         try {
-            editContentString = Files.asCharSource(params.editContent, StandardCharsets.UTF_8).read();
+            editContentString = Files.readString(params.editContent.toPath());
         } catch (final IOException e) {
             throw new IllegalArgumentException("Cannot read content of " + params.editContent, e);
         }