Removed usage to IOUtils.toString (#8579)

Specifically the toString reading from inputstream.

Signed-off-by: Hilbrand Bouwkamp <hilbrand@h72.nl>
This commit is contained in:
Hilbrand Bouwkamp
2020-09-25 20:46:14 +02:00
committed by GitHub
parent aa3f73d423
commit 1bc55a208b
13 changed files with 46 additions and 43 deletions

View File

@@ -18,6 +18,7 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
@@ -27,7 +28,6 @@ import java.util.Optional;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import org.apache.commons.io.IOUtils;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.spotify.internal.api.exception.SpotifyException;
@@ -107,7 +107,7 @@ public class SpotifyAuthService {
String.format("Cannot find '{}' - failed to initialize Spotify servlet", templateName));
} else {
try (InputStream inputStream = index.openStream()) {
return IOUtils.toString(inputStream);
return new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
}
}
}