Stripping "start marker....' from exception messages

65 views
Skip to first unread message

Mark Derricutt

unread,
Nov 29, 2023, 5:46:17 PM11/29/23
to jackson-dev
Tatu,

When getting an JSON exception, even with source redacted - I was
wondering if it was possible to configure jackson to not even _mention_
the source, i.e instead of getting;

Unexpected end-of-input: expected close marker for Array (start marker
at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION`
disabled); line: 1, column: 12])

just reporting:

Unexpected end-of-input: expected close marker for Array; line: 1,
column: 12

I couldn't see anything in the source to possible configure that, so am
looking at regexing it out myself, tho I'd rather not manually do this
for all exceptions if possible - I could seem to see any way of just
getting the base message, and line/column information from any
exceptions to build up my own message from fields either.


Tatu Saloranta

unread,
Nov 29, 2023, 8:39:02 PM11/29/23
to jacks...@googlegroups.com
`JacksonException` base has `getOriginalMessage()` and is the base of
all Jackson-produced exceptions.

Maybe that could help?

Other than that there is no functionality; I would be open to PR for
another `StreamReadFeature`, although it gets to quite specific
handling at this point.

-+ Tatu +-

Joo Hyuk Kim (Vince)

unread,
Nov 29, 2023, 9:37:51 PM11/29/23
to jackson-dev
How about handling via `ErrorReportConfiguration`?
Name itself sort of suggests could be covered.

Tatu Saloranta

unread,
Nov 29, 2023, 10:43:42 PM11/29/23
to jacks...@googlegroups.com
On Wed, Nov 29, 2023 at 6:37 PM Joo Hyuk Kim (Vince)
<bean...@gmail.com> wrote:
>
> How about handling via `ErrorReportConfiguration`?
> Name itself sort of suggests could be covered.

Yes, good point. That can control aspects of error reporting.

-+ Tatu +-
> --
> You received this message because you are subscribed to the Google Groups "jackson-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to jackson-dev...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/jackson-dev/4b3b7092-880b-43ec-bb6f-60828f8c71cdn%40googlegroups.com.

Joo Hyuk Kim (Vince)

unread,
Dec 3, 2023, 12:38:05 AM12/3/23
to jackson-dev
Filed an issue in jackson-core in case more requests for such functionality is made

Joo Hyuk Kim (Vince)

unread,
Dec 3, 2023, 12:39:30 AM12/3/23
to jackson-dev
Filed an issue in jackson-core (linked) in case more requests for such functionality is made
Reply all
Reply to author
Forward
0 new messages