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

Permit null log streams, as the code is null safe #2268

Merged
merged 1 commit into from
Apr 14, 2022
Merged
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
4 changes: 3 additions & 1 deletion server/src/main/java/io/deephaven/server/log/LogModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import io.deephaven.io.logger.LogBufferGlobal;
import io.deephaven.io.logger.StreamToLogBuffer;

import javax.annotation.Nullable;
import javax.inject.Named;
import javax.inject.Singleton;
import java.io.PrintStream;
Expand Down Expand Up @@ -55,7 +56,8 @@ static StreamToLogBuffer providesStreamToLogBuffer(LogBuffer logBuffer) {
}

@Provides
static StreamToPrintStreams providesStreamToReal(@Named("out") PrintStream out, @Named("err") PrintStream err) {
static StreamToPrintStreams providesStreamToReal(@Nullable @Named("out") PrintStream out,
@Nullable @Named("err") PrintStream err) {
final boolean skipStdout = Boolean.getBoolean("stdout.skipReal");
final boolean skipStderr = Boolean.getBoolean("stderr.skipReal");
return new StreamToPrintStreams(skipStdout ? null : out, skipStderr ? null : err);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import dagger.BindsInstance;
import dagger.Component;

import javax.annotation.Nullable;
import javax.inject.Named;
import java.io.PrintStream;

Expand All @@ -24,9 +25,9 @@ interface Builder<B extends Builder<B>> {
B withMaxInboundMessageSize(@Named("grpc.maxInboundMessageSize") int maxInboundMessageSize);

@BindsInstance
B withOut(@Named("out") PrintStream out);
B withOut(@Nullable @Named("out") PrintStream out);

@BindsInstance
B withErr(@Named("err") PrintStream err);
B withErr(@Nullable @Named("err") PrintStream err);
}
}