Package com.fasterxml.jackson.core

# Class ErrorReportConfiguration

java.lang.Object
com.fasterxml.jackson.core.ErrorReportConfiguration

All Implemented Interfaces:
  `Serializable`

public class ErrorReportConfiguration extends Object implements Serializable
Container for configuration values used when handling errorneous token inputs. For example, unquoted text segments.

Currently default settings are

- Maximum length of token to include in error messages (see `_maxErrorTokenLength`)
- Maximum length of raw content to include in error messages (see `_maxRawContentLength`)

Since:
  2.16
See Also:
  - Serialized Form

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static final class`
`ErrorReportConfiguration.Builder`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected final int`
`_maxErrorTokenLength`
Maximum length of token to include in error messages
`protected final int`
`_maxRawContentLength`
Maximum length of raw content to include in error messages
`static final int`
`DEFAULT_MAX_ERROR_TOKEN_LENGTH`
Default value for `_maxErrorTokenLength`.
`static final int`
`DEFAULT_MAX_RAW_CONTENT_LENGTH`
Previously was `com.fasterxml.jackson.core.io.ContentReference#DEFAULT_MAX_CONTENT_SNIPPET`.

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`ErrorReportConfiguration(int maxErrorTokenLength, int maxRawContentLength)`

## Method Summary

Modifier and Type
Method
Description
`static ErrorReportConfiguration.Builder`
`builder()`
`static ErrorReportConfiguration`
`defaults()`
`int`
`getMaxErrorTokenLength()`
Accessor for `_maxErrorTokenLength`
`int`
`getMaxRawContentLength()`
Accessor for `_maxRawContentLength`
`static void`
`overrideDefaultErrorReportConfiguration(ErrorReportConfiguration errorReportConfiguration)`
Override the default ErrorReportConfiguration.
`ErrorReportConfiguration.Builder`
`rebuild()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### DEFAULT_MAX_ERROR_TOKEN_LENGTH

public static final int DEFAULT_MAX_ERROR_TOKEN_LENGTH
Default value for `_maxErrorTokenLength`.

See Also:
  - Constant Field Values

### DEFAULT_MAX_RAW_CONTENT_LENGTH

public static final int DEFAULT_MAX_RAW_CONTENT_LENGTH
Previously was `com.fasterxml.jackson.core.io.ContentReference#DEFAULT_MAX_CONTENT_SNIPPET`. Default value for `_maxRawContentLength`.

See Also:
  - Constant Field Values

### _maxErrorTokenLength

protected final int _maxErrorTokenLength
Maximum length of token to include in error messages

See Also:
  - `ErrorReportConfiguration.Builder.maxErrorTokenLength(int)`

### _maxRawContentLength

protected final int _maxRawContentLength
Maximum length of raw content to include in error messages

See Also:
  - `ErrorReportConfiguration.Builder.maxRawContentLength(int)`

## Constructor Details

### ErrorReportConfiguration

protected ErrorReportConfiguration(int maxErrorTokenLength, int maxRawContentLength)

## Method Details

### overrideDefaultErrorReportConfiguration

public static void overrideDefaultErrorReportConfiguration(ErrorReportConfiguration errorReportConfiguration)
Override the default ErrorReportConfiguration. These defaults are only used when `JsonFactory` instances are not configured with their own ErrorReportConfiguration.

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 `ObjectMapper` instances that have a `JsonFactory` instance with the required ErrorReportConfiguration.

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.

Parameters:
  `errorReportConfiguration` - new default for ErrorReportConfiguration (a null value will reset to built-in default)
See Also:
  - `defaults()`
  - `builder()`

### builder

public static ErrorReportConfiguration.Builder builder()

### defaults

public static ErrorReportConfiguration defaults()

Returns:
  the default `ErrorReportConfiguration` (when none is set on the `JsonFactory` explicitly)
See Also:
  - `overrideDefaultErrorReportConfiguration(ErrorReportConfiguration)`

### rebuild

public ErrorReportConfiguration.Builder rebuild()

Returns:
  New `ErrorReportConfiguration.Builder` initialized with settings of configuration instance

### getMaxErrorTokenLength

public int getMaxErrorTokenLength()
Accessor for `_maxErrorTokenLength`

Returns:
  Maximum length of token to include in error messages
See Also:
  - `ErrorReportConfiguration.Builder.maxErrorTokenLength(int)`

### getMaxRawContentLength

public int getMaxRawContentLength()
Accessor for `_maxRawContentLength`

Returns:
  Maximum length of token to include in error messages
See Also:
  - `ErrorReportConfiguration.Builder.maxRawContentLength(int)`