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

Replace PrintStream in codebase #87

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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,7 +23,7 @@
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.io.OutputStreamWriter;
import java.util.Map;

import static com.facebook.airlift.configuration.ConfigurationLoader.loadProperties;
Expand Down Expand Up @@ -68,8 +68,9 @@ public void testLoadsFromFile()
throws IOException
{
final File file = File.createTempFile("config", ".properties", tempDir);
try (PrintStream out = new PrintStream(new FileOutputStream(file))) {
out.print("test: foo");
try (OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(file))) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably specify the charset here and below as UTF-8

out.write("test: foo");
out.flush();

System.setProperty("config", file.getAbsolutePath());

Expand All @@ -87,9 +88,10 @@ public void testSystemOverridesFile()
throws IOException
{
final File file = File.createTempFile("config", ".properties", tempDir);
try (PrintStream out = new PrintStream(new FileOutputStream(file))) {
out.println("key1: original");
out.println("key2: original");
try (OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(file))) {
out.write("key1: original" + "\n");
out.write("key2: original" + "\n");
out.flush();

System.setProperty("config", file.getAbsolutePath());
System.setProperty("key1", "overridden");
Expand Down
Loading