jackson-core icon indicating copy to clipboard operation
jackson-core copied to clipboard

Allow suppresion of source information in exception messages

Open jamesagnew opened this issue 7 months ago • 3 comments

This is a follow-on from the discussion in #1151 .

Currently the JsonParser.Feature.INCLUDE_SOURCE_IN_LOCATION setting can be used to choose whether to include source information as a part of the location in JsonProcessingException.

When this is disabled, the message now includes messages such as:

at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 4, column: 18]

It would be nice to have configuration that just disables the source entirely from this text blurb, logs and messages don't have a reference to internal implementation details. Ideally this would result in messages more like:

at [line: 4, column: 18]

jamesagnew avatar Dec 06 '23 15:12 jamesagnew

To be honest, I think we could just change this in 2.17 to leave out the Source: REDACTED (StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION disabled); if treamReadFeature.INCLUDE_SOURCE_IN_LOCATION is disabled. That is, I don't see the need to make this even more configurable.

pjfanning avatar Dec 06 '23 15:12 pjfanning

My worry is simply that if any references are removed, by default, developers are not even aware of possibility of including source as part of Location information. And so we are going to be hit by requests to start including source to show "where is the problem?" (esp. since older versions include it, for some sources).

Put another way: reference to StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION is very much intentional hint.

cowtowncoder avatar Dec 06 '23 22:12 cowtowncoder