Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor - Remove redundant InputStreamReader #1120

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.XMLEvent;

import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringReader;
import java.io.UncheckedIOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
Expand Down Expand Up @@ -142,8 +141,7 @@ public static Model getRawModel(MavenProject project) throws IOException {
* @throws IOException if the file is not found or if the file does not parse.
*/
public static Model getRawModel(File moduleProjectFile) throws IOException {
try (Reader reader =
new BufferedReader(new InputStreamReader(Files.newInputStream(moduleProjectFile.toPath())))) {
try (Reader reader = Files.newBufferedReader(moduleProjectFile.toPath(), Charset.defaultCharset())) {
Model result = getRawModel(reader);
result.setPomFile(moduleProjectFile);
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
* limitations under the License.
*/

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.stream.Stream;
Expand Down Expand Up @@ -52,7 +51,7 @@ public static Stream<Extension> getCoreExtensions(MavenProject project) throws I
return Stream.empty();
}

try (Reader reader = new BufferedReader(new InputStreamReader(Files.newInputStream(extensionsFile)))) {
try (Reader reader = Files.newBufferedReader(extensionsFile, Charset.defaultCharset())) {
return new CoreExtensionsXpp3Reader()
.read(reader).getExtensions().stream().map(ex -> ExtensionBuilder.newBuilder()
.withGroupId(ex.getGroupId())
Expand Down
Loading