Skip to content

Commit

Permalink
Update release notes wrt #1067
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jul 29, 2023
1 parent 5a562cf commit dbf8d3b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
5 changes: 5 additions & 0 deletions release-notes/CREDITS-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -382,3 +382,8 @@ Carter Kozak (carterkozak@github)
Armin Samii (artoonie@github)
* Contributed #1050: Compare `_snapshotInfo` in `Version`
(2.16.0)

Joo Hyuk Kim (JooHyukKim@github)
* Contributed #1067: Add `ErrorReportConfiguration`
(2.16.0)

2 changes: 2 additions & 0 deletions release-notes/VERSION-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ a pure JSON library.
(contributed by @artoonie)
#1051: Add `JsonGeneratorDecorator` to allow decorating `JsonGenerator`s
(contributed by @digulla)
#1067: Add `ErrorReportConfiguration`
(contributed by Joo-Hyuk K)

2.15.2 (30-May-2023)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
* @since 2.16
*/
public class ErrorReportConfiguration
implements Serializable {
implements Serializable
{
private static final long serialVersionUID = 1L;

/**
Expand Down Expand Up @@ -46,6 +47,22 @@ public class ErrorReportConfiguration
private static ErrorReportConfiguration DEFAULT =
new ErrorReportConfiguration(DEFAULT_MAX_ERROR_TOKEN_LENGTH, DEFAULT_MAX_RAW_CONTENT_LENGTH);

/**
* Override the default ErrorReportConfiguration. These defaults are only used when {@link JsonFactory}
* instances are not configured with their own ErrorReportConfiguration.
* <p>
* Library maintainers should not set this as it will affect other code that uses Jackson.
* Library maintainers who want to configure ErrorReportConfiguration for the Jackson usage within their
* lib should create <code>ObjectMapper</code> instances that have a {@link JsonFactory} instance with
* the required ErrorReportConfiguration.
* <p>
* This method is meant for users delivering applications. If they use this, they set it when they start
* their application to avoid having other code initialize their mappers before the defaults are overridden.
*
* @param errorReportConfiguration new default for ErrorReportConfiguration (a null value will reset to built-in default)
* @see #defaults()
* @see #builder()
*/
public static void overrideDefaultErrorReportConfiguration(final ErrorReportConfiguration errorReportConfiguration) {
if (errorReportConfiguration == null) {
DEFAULT = new ErrorReportConfiguration(DEFAULT_MAX_ERROR_TOKEN_LENGTH, DEFAULT_MAX_RAW_CONTENT_LENGTH);
Expand Down Expand Up @@ -78,7 +95,7 @@ public Builder maxErrorTokenLength(final int maxErrorTokenLength) {
/**
*
* @see ErrorReportConfiguration#_maxRawContentLength
* @return This factory instance (to allow call chaining)
* @return This builder instance (to allow call chaining)
*/
public Builder maxRawContentLength(final int maxRawContentLength) {
validateMaxRawContentLength(maxRawContentLength);
Expand Down Expand Up @@ -129,8 +146,7 @@ public static ErrorReportConfiguration defaults() {
}

/**
* @return New {@link Builder} initialized with settings of configuration
* instance
* @return New {@link Builder} initialized with settings of configuration instance
*/
public Builder rebuild() {
return new Builder(this);
Expand All @@ -156,7 +172,7 @@ public int getMaxErrorTokenLength() {
* Accessor for {@link #_maxRawContentLength}
*
* @return Maximum length of token to include in error messages
* @see Builder#maxRawContentLength
* @see Builder#maxRawContentLength(int)
*/
public int getMaxRawContentLength() {
return _maxRawContentLength;
Expand All @@ -174,14 +190,14 @@ public int getMaxRawContentLength() {
*
* @param maxErrorTokenLength Maximum length of token to include in error messages
*/
private static void validateMaxErrorTokenLength(int maxErrorTokenLength) throws IllegalArgumentException {
static void validateMaxErrorTokenLength(int maxErrorTokenLength) throws IllegalArgumentException {
if (maxErrorTokenLength < 0) {
throw new IllegalArgumentException(
String.format("Value of maxErrorTokenLength (%d) cannot be negative", maxErrorTokenLength));
}
}

private static void validateMaxRawContentLength(int maxRawContentLength) {
static void validateMaxRawContentLength(int maxRawContentLength) {
if (maxRawContentLength < 0) {
throw new IllegalArgumentException(
String.format("Value of maxRawContentLength (%d) cannot be negative", maxRawContentLength));
Expand Down

0 comments on commit dbf8d3b

Please sign in to comment.