Le jeu. 21 avr. 2022 à 03:04, David Blevins <dblev...@tomitribe.com> a
écrit :

> Hey All,
>
> With inspiration from Romain, I went ahead and wrote a Json serializer
> that can create short Json snippets that we can safely include in error
> messages.  I.e. it is optimized to only write a specific number of bytes
> and then stop.  The recursion is tightly controlled to stop early as well.
> You can see that code in this PR if you're curious:
>
>  - https://github.com/apache/johnzon/pull/84


Commented a few details but it is overall *the* solution! Thanks David!


>
> A few thoughts on where we could go from here:
>
>  - We can probably work this into more exception handling that currently
> doesn't print Json
>


+1


>  - We do have some existing exception handling calling toString on
> JsonValue instances we should update.  For example:
>
> https://github.com/apache/johnzon/blob/v1.2.16/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/MappingParserImpl.java#L627


Outch, assumption was that it was a primitive but you are right it is wrong


>
>  - The current default number of characters in a snippet is 50.  We could
> potentially have a system property to allow users to get more.
>

Nop, a JsonXxFactory property as all toggles ;)
+1 for it



>
> Thoughts?
>
>
> -David
>
>

Reply via email to