-
-
Notifications
You must be signed in to change notification settings - Fork 799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make MAX_ERROR_TOKEN_LENGTH configurable via ErrorReportConfiguration
#1043
Make MAX_ERROR_TOKEN_LENGTH configurable via ErrorReportConfiguration
#1043
Conversation
Quick note: due to number of changes needed for configuration, I think I really want a configuration object to be created to pass this setting, along with others. Similar to I don't know what a good name would be, nor if there are other settings that could already be added. But I think adding individual scalars in |
Totally agree on this 👍🏻👍🏻 So I will come back with an object version( Until then... keep this as DRAFT, to reduce distraction. |
MAX_ERROR_TOKEN_LENGTH
configurableMAX_ERROR_TOKEN_LENGTH
configurable
MAX_ERROR_TOKEN_LENGTH
configurableErrorTokenConfiguration
Re-implemented Object-style, like Do you think there is there any revision to do in other module, @cowtowncoder ? |
I would ask @cowtowncoder for review. I'm just an end-user :) |
@JooHyukKim Sorry, I should have explained bit further: although the encapsulation as So I think that at this point I'd probably leave this PR as work-in-progress to see if we can use configuration for other aspects. |
Sure thing! I will turn this into draft for the moment. Maybe what we need is time 😆. @cowtowncoder No worries 🙂 explanation was not short at all. I just tried start with narrow scope and see how it looks from others' perspective. Couple of possible names that we might consider are....
PS : I changed the class name and PR title to |
ErrorTokenConfiguration
ErrorReportConfiguration
@JooHyukKim I like that name -- and yeah, let's let this wait for a bit -- I don't necessarily mind having just one setting as long as it seems plausible we could have more. And now that you mention this, one thing we could perhaps use it for would be configuring inclusion (or not) of source. |
@cowtowncoder The name and JavaDoc of
I guess it "can" be error-related, if we name and use it that way? 🙂 Another thing is that I hope this new |
@JooHyukKim Sorry, what I meant to say is that we'd leave the on/off feature as-is (too much hassle moving thing just added IMO, unless for maybe 3.0). |
@cowtowncoder Oh I see. And yes “specifying length” seems useful. though I can’t seem to think of appropriate default value for the new config. Naming idea : ‘maxSourceLengthInLocation’ ? Or maybe something shorter in length. 🤔🤔 |
src/main/java/com/fasterxml/jackson/core/io/ContentReference.java
Outdated
Show resolved
Hide resolved
src/main/java/com/fasterxml/jackson/core/io/ContentReference.java
Outdated
Show resolved
Hide resolved
Ok yes this is better. I wish passing new configuration was not so awkward though, it is unfortunate to need to modify both One thing that would help merging would, however, be splitting one set of change to be merged first:
and then in a follow-up PR do the rest. This will be bit easier to merge cleanly; one problem are being It would also be bit easier to maybe see if there's any way to minimize changes to I think easiest way might be to leave this PR as-is, create new "minimal" one from some of changes. |
The changes in those classes might have been reduced a bit. Will keep this in mind along the way.
Sounds like a plan 👍🏻 Will take below steps unless suggested otherwise. EDIT : Filed a container issue #1066 to track PRs and changes instead, since this PR will be closed. |
as discussed in google groups page.
Motivation
Currently, when Jackson throws an exception, it quotes the JSON that triggered the error. However, there's a limitation: the quoted message is truncated after MAX_ERROR_TOKEN_LENGTH as specified in...
jackson-core/src/main/java/com/fasterxml/jackson/core/base/ParserMinimalBase.java
Line 132 in 832b520
.... which makes it difficult to debug issues when the relevant section is further down in the JSON.
This PR elliviates that by introducing ErrorTokenConfiguration configurable via
JsonFactory.Builder
andJsonFactory.setErrorTokenConfiguration