Skip to content

Commit dbf8d3b

Browse files
committed
Update release notes wrt #1067
1 parent 5a562cf commit dbf8d3b

File tree

3 files changed

+30
-7
lines changed

3 files changed

+30
-7
lines changed

release-notes/CREDITS-2.x

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,3 +382,8 @@ Carter Kozak (carterkozak@github)
382382
Armin Samii (artoonie@github)
383383
* Contributed #1050: Compare `_snapshotInfo` in `Version`
384384
(2.16.0)
385+
386+
Joo Hyuk Kim (JooHyukKim@github)
387+
* Contributed #1067: Add `ErrorReportConfiguration`
388+
(2.16.0)
389+

release-notes/VERSION-2.x

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ a pure JSON library.
3737
(contributed by @artoonie)
3838
#1051: Add `JsonGeneratorDecorator` to allow decorating `JsonGenerator`s
3939
(contributed by @digulla)
40+
#1067: Add `ErrorReportConfiguration`
41+
(contributed by Joo-Hyuk K)
4042

4143
2.15.2 (30-May-2023)
4244

src/main/java/com/fasterxml/jackson/core/ErrorReportConfiguration.java

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
* @since 2.16
1616
*/
1717
public class ErrorReportConfiguration
18-
implements Serializable {
18+
implements Serializable
19+
{
1920
private static final long serialVersionUID = 1L;
2021

2122
/**
@@ -46,6 +47,22 @@ public class ErrorReportConfiguration
4647
private static ErrorReportConfiguration DEFAULT =
4748
new ErrorReportConfiguration(DEFAULT_MAX_ERROR_TOKEN_LENGTH, DEFAULT_MAX_RAW_CONTENT_LENGTH);
4849

50+
/**
51+
* Override the default ErrorReportConfiguration. These defaults are only used when {@link JsonFactory}
52+
* instances are not configured with their own ErrorReportConfiguration.
53+
* <p>
54+
* Library maintainers should not set this as it will affect other code that uses Jackson.
55+
* Library maintainers who want to configure ErrorReportConfiguration for the Jackson usage within their
56+
* lib should create <code>ObjectMapper</code> instances that have a {@link JsonFactory} instance with
57+
* the required ErrorReportConfiguration.
58+
* <p>
59+
* This method is meant for users delivering applications. If they use this, they set it when they start
60+
* their application to avoid having other code initialize their mappers before the defaults are overridden.
61+
*
62+
* @param errorReportConfiguration new default for ErrorReportConfiguration (a null value will reset to built-in default)
63+
* @see #defaults()
64+
* @see #builder()
65+
*/
4966
public static void overrideDefaultErrorReportConfiguration(final ErrorReportConfiguration errorReportConfiguration) {
5067
if (errorReportConfiguration == null) {
5168
DEFAULT = new ErrorReportConfiguration(DEFAULT_MAX_ERROR_TOKEN_LENGTH, DEFAULT_MAX_RAW_CONTENT_LENGTH);
@@ -78,7 +95,7 @@ public Builder maxErrorTokenLength(final int maxErrorTokenLength) {
7895
/**
7996
*
8097
* @see ErrorReportConfiguration#_maxRawContentLength
81-
* @return This factory instance (to allow call chaining)
98+
* @return This builder instance (to allow call chaining)
8299
*/
83100
public Builder maxRawContentLength(final int maxRawContentLength) {
84101
validateMaxRawContentLength(maxRawContentLength);
@@ -129,8 +146,7 @@ public static ErrorReportConfiguration defaults() {
129146
}
130147

131148
/**
132-
* @return New {@link Builder} initialized with settings of configuration
133-
* instance
149+
* @return New {@link Builder} initialized with settings of configuration instance
134150
*/
135151
public Builder rebuild() {
136152
return new Builder(this);
@@ -156,7 +172,7 @@ public int getMaxErrorTokenLength() {
156172
* Accessor for {@link #_maxRawContentLength}
157173
*
158174
* @return Maximum length of token to include in error messages
159-
* @see Builder#maxRawContentLength
175+
* @see Builder#maxRawContentLength(int)
160176
*/
161177
public int getMaxRawContentLength() {
162178
return _maxRawContentLength;
@@ -174,14 +190,14 @@ public int getMaxRawContentLength() {
174190
*
175191
* @param maxErrorTokenLength Maximum length of token to include in error messages
176192
*/
177-
private static void validateMaxErrorTokenLength(int maxErrorTokenLength) throws IllegalArgumentException {
193+
static void validateMaxErrorTokenLength(int maxErrorTokenLength) throws IllegalArgumentException {
178194
if (maxErrorTokenLength < 0) {
179195
throw new IllegalArgumentException(
180196
String.format("Value of maxErrorTokenLength (%d) cannot be negative", maxErrorTokenLength));
181197
}
182198
}
183199

184-
private static void validateMaxRawContentLength(int maxRawContentLength) {
200+
static void validateMaxRawContentLength(int maxRawContentLength) {
185201
if (maxRawContentLength < 0) {
186202
throw new IllegalArgumentException(
187203
String.format("Value of maxRawContentLength (%d) cannot be negative", maxRawContentLength));

0 commit comments

Comments
 (0)