I'm getting an error while checking the code quality of code using sonar. Here is error
Classes and methods that rely on the default system encoding should not be used : Remove this use of constructor "InputStreamReader(InputStream)"
And here is code
private StringBuilder getServerResponse(URLConnection connection) throws IOException {
final BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
final StringBuilder response = new StringBuilder();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
return response;
}
I'm getting this error on below line :-
final BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
I've tried to find the solution but didn't get any success. any pointer would be helpful.