Skip to content

Commit 1df3dde

Browse files
Automated rollback of commit 1d4b6ba.
PiperOrigin-RevId: 735780482
1 parent ab3fb84 commit 1df3dde

File tree

1 file changed

+14
-34
lines changed

1 file changed

+14
-34
lines changed

java/util/src/main/java/com/google/protobuf/util/JsonFormat.java

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ public static Printer printer() {
9191
/* preservingProtoFieldNames */ false,
9292
/* omittingInsignificantWhitespace */ false,
9393
/* printingEnumsAsInts */ false,
94-
/* sortingMapKeys */ false,
95-
/* unsafeDisableCodepointsForHtmlSymbols */ false);
94+
/* sortingMapKeys */ false);
9695
}
9796

9897
private enum ShouldPrintDefaults {
@@ -115,7 +114,6 @@ public static class Printer {
115114
private final boolean omittingInsignificantWhitespace;
116115
private final boolean printingEnumsAsInts;
117116
private final boolean sortingMapKeys;
118-
private final boolean unsafeDisableCodepointsForHtmlSymbols;
119117

120118
private Printer(
121119
com.google.protobuf.TypeRegistry registry,
@@ -125,8 +123,7 @@ private Printer(
125123
boolean preservingProtoFieldNames,
126124
boolean omittingInsignificantWhitespace,
127125
boolean printingEnumsAsInts,
128-
boolean sortingMapKeys,
129-
boolean unsafeDisableCodepointsForHtmlSymbols) {
126+
boolean sortingMapKeys) {
130127
this.registry = registry;
131128
this.oldRegistry = oldRegistry;
132129
this.shouldPrintDefaults = shouldOutputDefaults;
@@ -135,7 +132,6 @@ private Printer(
135132
this.omittingInsignificantWhitespace = omittingInsignificantWhitespace;
136133
this.printingEnumsAsInts = printingEnumsAsInts;
137134
this.sortingMapKeys = sortingMapKeys;
138-
this.unsafeDisableCodepointsForHtmlSymbols = unsafeDisableCodepointsForHtmlSymbols;
139135
}
140136

141137
/**
@@ -157,8 +153,7 @@ public Printer usingTypeRegistry(TypeRegistry oldRegistry) {
157153
preservingProtoFieldNames,
158154
omittingInsignificantWhitespace,
159155
printingEnumsAsInts,
160-
sortingMapKeys,
161-
unsafeDisableCodepointsForHtmlSymbols);
156+
sortingMapKeys);
162157
}
163158

164159
/**
@@ -180,8 +175,7 @@ public Printer usingTypeRegistry(com.google.protobuf.TypeRegistry registry) {
180175
preservingProtoFieldNames,
181176
omittingInsignificantWhitespace,
182177
printingEnumsAsInts,
183-
sortingMapKeys,
184-
unsafeDisableCodepointsForHtmlSymbols);
178+
sortingMapKeys);
185179
}
186180

187181
/**
@@ -210,8 +204,7 @@ public Printer includingDefaultValueFields() {
210204
preservingProtoFieldNames,
211205
omittingInsignificantWhitespace,
212206
printingEnumsAsInts,
213-
sortingMapKeys,
214-
unsafeDisableCodepointsForHtmlSymbols);
207+
sortingMapKeys);
215208
}
216209

217210
/**
@@ -239,8 +232,7 @@ public Printer includingDefaultValueFields(Set<FieldDescriptor> fieldsToAlwaysOu
239232
preservingProtoFieldNames,
240233
omittingInsignificantWhitespace,
241234
printingEnumsAsInts,
242-
sortingMapKeys,
243-
unsafeDisableCodepointsForHtmlSymbols);
235+
sortingMapKeys);
244236
}
245237

246238
/**
@@ -261,8 +253,7 @@ public Printer alwaysPrintFieldsWithNoPresence() {
261253
preservingProtoFieldNames,
262254
omittingInsignificantWhitespace,
263255
printingEnumsAsInts,
264-
sortingMapKeys,
265-
unsafeDisableCodepointsForHtmlSymbols);
256+
sortingMapKeys);
266257
}
267258

268259
/**
@@ -279,8 +270,7 @@ public Printer printingEnumsAsInts() {
279270
preservingProtoFieldNames,
280271
omittingInsignificantWhitespace,
281272
true,
282-
sortingMapKeys,
283-
unsafeDisableCodepointsForHtmlSymbols);
273+
sortingMapKeys);
284274
}
285275

286276
private void checkUnsetPrintingEnumsAsInts() {
@@ -304,8 +294,7 @@ public Printer preservingProtoFieldNames() {
304294
true,
305295
omittingInsignificantWhitespace,
306296
printingEnumsAsInts,
307-
sortingMapKeys,
308-
unsafeDisableCodepointsForHtmlSymbols);
297+
sortingMapKeys);
309298
}
310299

311300

@@ -334,8 +323,7 @@ public Printer omittingInsignificantWhitespace() {
334323
preservingProtoFieldNames,
335324
true,
336325
printingEnumsAsInts,
337-
sortingMapKeys,
338-
unsafeDisableCodepointsForHtmlSymbols);
326+
sortingMapKeys);
339327
}
340328

341329
/**
@@ -358,8 +346,7 @@ public Printer sortingMapKeys() {
358346
preservingProtoFieldNames,
359347
omittingInsignificantWhitespace,
360348
printingEnumsAsInts,
361-
true,
362-
unsafeDisableCodepointsForHtmlSymbols);
349+
true);
363350
}
364351

365352
/**
@@ -381,8 +368,7 @@ public void appendTo(MessageOrBuilder message, Appendable output) throws IOExcep
381368
output,
382369
omittingInsignificantWhitespace,
383370
printingEnumsAsInts,
384-
sortingMapKeys,
385-
unsafeDisableCodepointsForHtmlSymbols)
371+
sortingMapKeys)
386372
.print(message);
387373
}
388374

@@ -740,8 +726,6 @@ private static final class PrinterImpl {
740726

741727
private static class GsonHolder {
742728
private static final Gson DEFAULT_GSON = new GsonBuilder().create();
743-
private static final Gson GSON_WITHOUT_HTML_ESCAPING =
744-
new GsonBuilder().disableHtmlEscaping().create();
745729
}
746730

747731
PrinterImpl(
@@ -753,19 +737,15 @@ private static class GsonHolder {
753737
Appendable jsonOutput,
754738
boolean omittingInsignificantWhitespace,
755739
boolean printingEnumsAsInts,
756-
boolean sortingMapKeys,
757-
boolean unsafeDisableCodepointsForHtmlSymbols) {
740+
boolean sortingMapKeys) {
758741
this.registry = registry;
759742
this.oldRegistry = oldRegistry;
760743
this.shouldPrintDefaults = shouldPrintDefaults;
761744
this.includingDefaultValueFields = includingDefaultValueFields;
762745
this.preservingProtoFieldNames = preservingProtoFieldNames;
763746
this.printingEnumsAsInts = printingEnumsAsInts;
764747
this.sortingMapKeys = sortingMapKeys;
765-
this.gson =
766-
unsafeDisableCodepointsForHtmlSymbols
767-
? GsonHolder.GSON_WITHOUT_HTML_ESCAPING
768-
: GsonHolder.DEFAULT_GSON;
748+
this.gson = GsonHolder.DEFAULT_GSON;
769749
// json format related properties, determined by printerType
770750
if (omittingInsignificantWhitespace) {
771751
this.generator = new CompactTextGenerator(jsonOutput);

0 commit comments

Comments
 (0)