Skip to content

Commit d6a1b35

Browse files
Internal Change
PiperOrigin-RevId: 782078325
1 parent 1cc16c3 commit d6a1b35

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

java/core/src/main/java/com/google/protobuf/TextFormat.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ private TextFormat() {}
4242
private static final String ENABLE_INSERT_SILENT_MARKER_ENV_NAME =
4343
"SILENT_MARKER_INSERTION_ENABLED";
4444
private static final boolean ENABLE_INSERT_SILENT_MARKER =
45-
"true".equals(System.getenv(ENABLE_INSERT_SILENT_MARKER_ENV_NAME));
45+
System.getenv().getOrDefault(ENABLE_INSERT_SILENT_MARKER_ENV_NAME, "false").equals("true");
4646

4747
private static final String REDACTED_MARKER = "[REDACTED]";
4848

java/core/src/test/java/com/google/protobuf/ProtobufToStringOutputTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
@RunWith(JUnit4.class)
1414
public final class ProtobufToStringOutputTest extends DebugFormatTest {
15+
private static final String SILENT_MARKER = "";
16+
1517
RedactedFields.Builder messageBuilder;
1618
RedactedFields message;
1719

@@ -31,7 +33,7 @@ public void setupTest() {
3133
public void toStringFormat_defaultFormat() {
3234
assertThat(message.toString())
3335
.matches(
34-
"optional_redacted_string: \"bar\"\n"
36+
"optional_redacted_string: " + SILENT_MARKER + "\"bar\"\n"
3537
+ "optional_unredacted_string: \"foo\"\n"
3638
+ "optional_redacted_message \\{\n"
3739
+ " optional_unredacted_nested_string: \"foobar\"\n"
@@ -107,7 +109,7 @@ public void toStringFormat_testProtoWrapperWithTextFormat() {
107109
public void builderToStringFormat_defaultFormat() {
108110
assertThat(messageBuilder.toString())
109111
.matches(
110-
"optional_redacted_string: \"bar\"\n"
112+
"optional_redacted_string: " + SILENT_MARKER + "\"bar\"\n"
111113
+ "optional_unredacted_string: \"foo\"\n"
112114
+ "optional_redacted_message \\{\n"
113115
+ " optional_unredacted_nested_string: \"foobar\"\n"

0 commit comments

Comments
 (0)