Re: [jackson-user] CVE-2016-3720: XML external entity (XXE) vulnerability in XmlMapper in the Data format extension for

2016-06-15 Thread Tatu Saloranta
Yes. It was brought to our attention and fix: https://github.com/FasterXML/jackson-dataformat-xml/issues/190 was included in Jackson 2.7.4, Note that users can also resolve the issue by pre-configuring `XMLInputFactory` passed to `XmlMapper` so that external parsed entity resolution is disabled.

Re: [jackson-user] Change in handling of enum when moving from 2.6 to 2.7

2016-06-15 Thread Tatu Saloranta
Since `XmlEnumValue` is a JAXB annotation, it is used if (and only if) JAXB module is included. `@JsonProperty` is applied through standard `jackson-databind`. Precedence of annotations depends on how `AnnotationIntrospector`s are registered (which has precedence). I assume that you have JAXB modul

Re: [jackson-user] Dynamic Json - Deserialization

2016-06-15 Thread Tatu Saloranta
There is no current functionality for inferring type from structure or values of JSON Objects. Something like that has been requested, but it is difficult to both think of how to generalize this (is there a declarative way of defining what and how to match?) as well as how to make it work through e

Re: [jackson-user] CVE-2016-3720: XML external entity (XXE) vulnerability in XmlMapper in the Data format extension for

2016-06-15 Thread Tatu Saloranta
;t included in the CVE. > > > On Wednesday, June 15, 2016 at 2:25:15 PM UTC-4, Tatu Saloranta wrote: >> >> Yes. It was brought to our attention and fix: >> >> https://github.com/FasterXML/jackson-dataformat-xml/issues/190 >> >> was included in Jac

Re: [jackson-user] Hinting polymorphism

2016-06-16 Thread Tatu Saloranta
As is, there is no way to override the type. However, ability to make given target type override polymorphic handling has been requested (I forget the issue, should be easy to find), and I think that makes sense. I haven't had time to look into this, but if a PR was to arrive I would be happy to me

Re: [jackson-user] Hinting polymorphism

2016-06-16 Thread Tatu Saloranta
u please remind me if there's a way to create a custom deserializer > that only adjusts the handling of one field, not all the others? > > > > > On Thu, Jun 16, 2016 at 12:49 PM, Tatu Saloranta > wrote: > >> As is, there is no way to override the type. However,

[jackson-user] Jackson 2.8.0.rc2 being released, feedback urgently needed

2016-06-16 Thread Tatu Saloranta
The second Release Candidate for 2.8.0 -- 2.8.0.rc2 -- is now mostly out (with JAX-RS provider being deployed, and Scala to follow). I have tried to update release notes: https://github.com/FasterXML/jackson/wiki/Jackson-Release-2.8 to reflect learnings. Things done since rc1: * Found and fixed

Re: [jackson-user] Jackson 2.8.0.rc2 being released, feedback urgently needed

2016-06-17 Thread Tatu Saloranta
the need for the new @NotNull support in master when generating > json schema from my DTOs. > > > *Gesendet:* Freitag, 17. Juni 2016 um 04:10 Uhr > *Von:* "Tatu Saloranta" > *An:* jackson-announce , > jackson-user@googlegroups.com, "jackson-...@googlegroups.com"

Re: [jackson-user] Jackson 2.8.0.rc2 being released, feedback urgently needed

2016-06-17 Thread Tatu Saloranta
I can see 2.8.0.rc2 of `jackson-module-jsonSchema` right here: http://repo1.maven.org/maven2/com/fasterxml/jackson/module/jackson-module-jsonSchema/2.8.0.rc2/ -+ Tatu +- On Fri, Jun 17, 2016 at 1:17 PM, Tatu Saloranta wrote: > That should have been released as well, but maybe Nexus

Re: [jackson-user] Problem with a delegating creator

2016-06-17 Thread Tatu Saloranta
I don't know if it is possible to pass external type id via constructor. Probably worth a unit test, see if that is possible to make work or not. -+ Tatu +- On Fri, Jun 17, 2016 at 10:22 AM, Benson Margulies wrote: > The class 'Key' in here has a @JsonValue for a string and a delegating > creat

Re: [jackson-user] Problem with a delegating creator

2016-06-17 Thread Tatu Saloranta
Does the custom id resolver get called? -+ Tatu +- On Fri, Jun 17, 2016 at 1:51 PM, Tatu Saloranta wrote: > I don't know if it is possible to pass external type id via constructor. > Probably worth a unit test, see if that is possible to make work or not. > > -+ Tatu +- &

Re: [jackson-user] CVE-2016-3720: XML external entity (XXE) vulnerability in XmlMapper in the Data format extension for

2016-06-20 Thread Tatu Saloranta
Yes, it only affects XML since parsing of external entities (DTD-declared entities that use URI to specify where expansion comes from) is XML-specific thing. Codehaus version uses old defaults, although I don't think XML module for 1.x is widely used (based on download statistics). Behavior-wise 1

Re: [jackson-user] CVE-2016-3720: XML external entity (XXE) vulnerability in XmlMapper in the Data format extension for

2016-06-21 Thread Tatu Saloranta
If I knew who to contact, yes. It is strange that they do not include version numbers as I was contacted to ask if fix was in a version. Issue itself was logged as: https://github.com/FasterXML/jackson-dataformat-xml/issues/190 leading to https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2016

Re: [jackson-user] CVE-2016-3720: XML external entity (XXE) vulnerability in XmlMapper in the Data format extension for

2016-06-21 Thread Tatu Saloranta
. I'll see if I can get Redhat security team's take on how to add more information. -+ Tatu +- On Tue, Jun 21, 2016 at 8:02 AM, Tatu Saloranta wrote: > If I knew who to contact, yes. It is strange that they do not include > version numbers as I was contacted to ask if fix

[jackson-user] Possible replacement for existing JSON Schema generator, supports v4 (but written in Scala)

2016-06-21 Thread Tatu Saloranta
Ok, so here's a new project: https://github.com/mbknor/mbknor-jackson-jsonSchema that aims for better JSON Schema generation support, for version 4 of the specification. Sounds good and could perhaps replace existing fasterxml generator, which is not particularly well maintained. One thing to no

[jackson-user] CVE-2016-3720 for `jackson-dataformat-xml`, issue #190 fixed in 2.7.4

2016-06-23 Thread Tatu Saloranta
Since this has been asked a few times by users, here is what I know about security vulnerability id'd as "CVE-2016-3720" (reported by https://access.redhat.com/security/cve/CVE-2016-3720 and https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2016-3720). Reported (and resolved) problem is that J

Re: [jackson-user] vulnerability feed for Jackson?

2016-06-24 Thread Tatu Saloranta
There is no separate channel. `jackson-dev` is where most such things would be discussed. We could also use `jackson-announce` which exists. Number of security concerns and issues has been low enough that there hasn't been much need or demand for separate channel. Would not be against such a thing

Re: [jackson-user] Why don't modules include an API to add a filter provider?

2016-06-26 Thread Tatu Saloranta
If I remember correctly, there is no way to add a provider but to set one (and overwrite one that was previously set, if any). Given this it seemed like something that only primary user should do to make sure there is no conflict. I also didn't see an existing use case for modules to install provid

Re: [jackson-user] Why don't modules include an API to add a filter provider?

2016-06-27 Thread Tatu Saloranta
hings to be controlled by > a module. Do I have any options short of full-blown custom > serialization? > > > On Mon, Jun 27, 2016 at 1:43 AM, Tatu Saloranta > wrote: > > If I remember correctly, there is no way to add a provider but to set one > > (and ove

Re: [jackson-user] Why don't modules include an API to add a filter provider?

2016-06-27 Thread Tatu Saloranta
es > wrote: > > On Mon, Jun 27, 2016 at 7:34 PM, Tatu Saloranta > wrote: > >> Ignoral is not applied to "any properties"; I think it is considered for > >> regular static properties. > >> If so perhaps this is an issue to fix. > > > >

Re: [jackson-user] Getting exception when trying to parse nested json array into array of objects

2016-06-29 Thread Tatu Saloranta
As the exception says there is something wrong with constructor of `Photo` class. Could you please include its definition? -+ Tatu +- On Wed, Jun 29, 2016 at 5:05 AM, Mostafa Nasiri wrote: > I have this json string: > > {"id":"1","description":"1","bgSoundId":"1","audio":"Your_Eyes.mp3","title

Re: [jackson-user] com.fasterxml.jackson.core.JsonParseException: Illegal unquoted character ((CTRL-CHAR, code 10))

2016-06-30 Thread Tatu Saloranta
If content does indeed contain character 10 (Unicode), that is, linefeed, it is prohibited by JSON specification (should be escaped as \n), so the content should be fixed and parser is right to report it. This is assuming content does have that; cut'n pasting JSON can not quite tell that, so you'd

Re: [jackson-user] StackOverflowError in deeply nested JSON

2016-06-30 Thread Tatu Saloranta
50 levels it not a lot, but at the same time, amount of state Jackson keeps should not be big so it is bit puzzling. 32kb/50 gives about 600 bytes and I wouldn't think there is that much state kept per level. Generator keeps couple of things (property name, index number, parent reference), serializ

[jackson-user] Jackson 2.8.0 released (scala module to follow)

2016-07-05 Thread Tatu Saloranta
As per title, I have pushed 2.8.0 release out (with JAX-RS provider being synced to Maven Central now). As usual, Scala module should follow with some delay, but otherwise core components are released. Release notes can be found from: https://github.com/FasterXML/jackson/wiki/Jackson-Release-2.8

Re: [jackson-user] StackOverflowError in deeply nested JSON

2016-07-06 Thread Tatu Saloranta
Thank you! -+ Tatu +- On Fri, Jul 1, 2016 at 10:05 AM, Colin White wrote: > Thanks for the response. I'll take a closer look into the allocations on > the stack and report back. > > -Colin > > > On Thursday, 30 June 2016 22:33:41 UTC-7, Tatu Saloranta wrote: >>

Re: [jackson-user] JsonMappingException: Can not resolve PropertyFilter with id

2016-07-06 Thread Tatu Saloranta
I can't think of anything obvious. Since registration occurs via REST framework of some kind, it would seem like maybe registration is failing for some reason? Sometimes framework uses different `ObjectMapper` than user expects, leading to missing configuration. -+ Tatu +- On Thu, Jun 30, 2016 a

Re: [jackson-user] Globally deserialize with underscore/hyphen/case insensitivity

2016-07-06 Thread Tatu Saloranta
There is no way to do this; you can have case-insensitive properties, or regular conversion (given POJO property, produce translated expected external value), but no arbitrary conversions applied on-the-fly. To support such mapping you would need to do 2-phase processing: first read content and cl

Re: [jackson-user] JsonIdentityInfo and serializing ObjectId references - expected a field name

2016-07-13 Thread Tatu Saloranta
This definitely sounds like a bug in Jackson; exception itself indicates that the state Jackson databind thinks it is in (wrt what is to be written) differs from what low-level JSON generator thinks. If possible, could you file a bug at https://github.com/FasterXML/jackson-databind/issues but id

Re: [jackson-user] Deserialize an arbitrary object within a custom deserializer

2016-07-14 Thread Tatu Saloranta
Yes, for delegation you would retrieve a JsonDeserializer via DeserializationContext. However, for performance reasons this is most often done by implementing ContextualDeserializer, and handling lookups from method `createContextual()` which is called once after construction. This method can acce

[jackson-user] Possibly releasing at least one more Jackson 1.x version, 1.9.14; patches accepted

2016-07-14 Thread Tatu Saloranta
Although there hasn't been any releases for 1.9.x branch (the only potentially open 1.x branch), a new release has been requested, and since we do have github repo: https://github.com/FasterXML/jackson-1 I figured... why not. Jackson 1.x is still rather widely used, especially in the Hadoop-world

Re: [jackson-user] Deserialize an arbitrary object within a custom deserializer

2016-07-15 Thread Tatu Saloranta
e & motivation to do that. Maybe one day. There are some articles on writing custom serializers/deserializers, and if anyone can recommend good ones I'll add links to from `jackson-docs` github repo. -+ Tatu +- > > Thanks. > > On Thursday, 14 July 2016 21:01:56 UTC+1, Tatu Salor

Re: [jackson-user] YamlScheme Validation

2016-07-25 Thread Tatu Saloranta
Jackson does not provide any schema-validation functionality, but in theory it should be possible to use `jackson-dataformat-yaml` for reading content, and then using an external validator by giving `JsonParser` created by YAML module (assuming validator uses or allows use of Jackson for input read

Re: [jackson-user] java.lang.VerifyError when using jackson-module-scala_2.11

2016-07-25 Thread Tatu Saloranta
Actually I don't think your problem is related to Jackson 1.x usage, since you are trying to use 2.7.5 version of Scala module, which requires 2.x base components. 1.x and 2.x components reside in different Java packages and have different Maven group ids so they do not collide. However it seems l

Re: [jackson-user] Jackson + Bean validation (JSR-303)

2016-07-25 Thread Tatu Saloranta
On Mon, Jul 25, 2016 at 1:11 PM, Martin Duris wrote: > Hi guys, > > is possible to perform basic validation ? For example max-length on string > : > > public class MyBean { >private String name; > >@JsonGetter("name") >@Min(value = 100) >public String getTheName() { > return

Re: [jackson-user] StackOverflowError in deeply nested JSON

2016-07-25 Thread Tatu Saloranta
ack > trace and it shows that each nested JSON node adds 8 method calls to the > stack, though I'm not sure how much state is being stored at each step. I > upgraded to Jackson 2.8.1 and it still has the same behaviour. > > On Wednesday, 6 July 2016 10:10:38 UTC-7, Tatu Saloranta

Re: [jackson-user] Re: Custom Error Handler for invalid objects in JSON array

2016-07-28 Thread Tatu Saloranta
Right, this isn't kind of use case for which there is (or likely will) be special handling; for better functionality you may need to both use 2-pass processing (first bind individual sub-trees to a JsonNode, or Map or TokenBuffer) and custom error handling (for each generic subtree). In general the

Re: [jackson-user] Skip any property/method if encountering any exception for Serialization

2016-08-08 Thread Tatu Saloranta
There is no such option, but you may be able to specify `DeserializationProblemHandler` with handling for a subset of processing problems. Jackson 2.8 improved this aspect significantly, so many more problem cases are routed via this handler. -+ Tatu +- On Thu, Aug 4, 2016 at 3:19 PM, Ted Smith

Re: [jackson-user] parsing an empty string into a Map[String, Int] in scala

2016-08-08 Thread Tatu Saloranta
The very first thing to do is to upgrade: Jackson 2.2 is a very old version, and has not been supported for a while. You may want to try version 2.7.5 to see whether this might resolve your issue. -+ Tatu +- On Fri, Aug 5, 2016 at 11:01 AM, wrote: > I am trying to deserialize this json: > > {

Re: [jackson-user] How to access TypeResolutionContext in jackson 2.8.1

2016-08-09 Thread Tatu Saloranta
On Tue, Aug 9, 2016 at 3:03 AM, JonyD wrote: > Hi, > I will repost the question I did in stackoverflow ( > http://stackoverflow.com/questions/38797189/how-to- > access-typeresolutioncontext-in-jackson-2-8-1). > > > I am upgrading jackson library in a java project from version 2.4.6 to the > lates

Re: [jackson-user] issue with restEasy client and jackson2 provider

2016-08-09 Thread Tatu Saloranta
That sounds like a version incompatibility (version deployed differs from version with which service is deployed). Make sure you are using the latest 2.7 version (2.7.6). -+ Tatu +- On Fri, Aug 5, 2016 at 8:58 AM, Mario Rodriguez wrote: > Hi, I have a Java REST webservice that connects to a Nod

Re: [jackson-user] How to access TypeResolutionContext in jackson 2.8.1

2016-08-10 Thread Tatu Saloranta
lass be package protected/ protected? Or have a > "warning" in the javadoc saying it is an "internal" class that should be > only used by jackson? > > So, how can I circumvent that then? > > Thanks! > > On Wednesday, August 10, 2016 at 1:36:53 AM UTC+2

Re: [jackson-user] help serializing child objects

2016-08-10 Thread Tatu Saloranta
Usually it would work by adding `@JsonIgnoreProperties` on `children`, but in this case type is `Set`, which is not a POJO. Likewise I don't think you can currently specify separate view for property, as `@JsonView` on property simply defines inclusion of that property. One way this could work wou

Re: [jackson-user] Full Data Binding With Variable Schema Data Types

2016-08-10 Thread Tatu Saloranta
While there are some limited structural conversions that may be applied (for example, "one-or-many" to support 'X' or '[X, X, ...]'; unwrapping, "scalar-or-POJO"), and which may help, the general answer is that eventually you probably can't do it all. It might help to show kinds of inconsistencies

Re: [jackson-user] Deprecated findSerializationType might be breaking refineSerializationType (v2.8.1)

2016-08-11 Thread Tatu Saloranta
Your suggestion sounds plausible, but to fix it, as well as to guard against regression, it would be necessary to have a way to reproduce the problem. So if there is any way you could suggest a way to trigger the problem that would be great. Exception, however, would seem to indicate some other ki

Re: [jackson-user] Anyway to get Jackson object mapper running with dependency injector like guice?

2016-08-16 Thread Tatu Saloranta
There is `jackson-module-guice` as one of base modules: https://github.com/FasterXML/jackson-modules-base which allows something like that I think. I haven't used it myself but others who have may be able to comment more. It adds support for connecting `@JacksonInject` annotation (that Jackson ne

Re: [jackson-user] Add support to "required" attribute in non creator parameters

2016-08-16 Thread Tatu Saloranta
Unfortunately I don't think this approach will work due to overhead being added: just looking at code it would make all existing usage measurably slower. And for case where there are actually required properties there's even more due to construction and management of the Map. There are other challe

Re: [jackson-user] CVE-2016-3720: XML external entity (XXE) vulnerability in XmlMapper in the Data format extension for

2016-08-16 Thread Tatu Saloranta
is the > right point of contact to get this fix updated in CVE? > > Thanks, > Neeraj > > On Wednesday, 22 June 2016 01:02:11 UTC+5:30, Tatu Saloranta wrote: >> >> A small update: original Red Hat cve was: >> >> https://access.redhat.com/security/cve/CVE-20

Re: [jackson-user] Re: "hierarchy of the type is inconsistent" from Eclipse trying to extend JacksonJsonProvider

2016-08-16 Thread Tatu Saloranta
That is bit tricky... not sure if this is is Eclipse's fault or not. Root cause is due to dependency inclusion being: javax.ws.rs javax.ws.rs-api 2.0.1 provided in pom.xml. This should be sufficient for compilation and I haven't had any isses with Eclipse.

Re: [jackson-user] Deprecated findSerializationType might be breaking refineSerializationType (v2.8.1)

2016-08-16 Thread Tatu Saloranta
Thanks; I filed: https://github.com/FasterXML/jackson-databind/issues/1338 for this issue. -+ Tatu +- On Fri, Aug 12, 2016 at 5:11 AM, JonyD wrote: > I've created a repo in https://github.com/JonyD/my-app with a failing > test. > The pom.xml is a bit messy but it's important because of depe

Re: [jackson-user] Re: Wrapping root elements and adding root sibling fields

2016-08-17 Thread Tatu Saloranta
At the moment I can not think of a better way. Adding wrapping/unwrapping from Jackson side has proven a thorny issue, not so much for simple use cases (... well, most cases end up not being simple anyway), but in combination with things like polymorphic handling, type ids and JsonCreator/JsonValue

Re: [jackson-user] Jackson 2.7 vs 2.6 custom serializer behavior when converting Maps' values

2016-08-17 Thread Tatu Saloranta
Semantics of `convertValue()` are bit vague, and I think what is happening here is that code in 2.7 notices that incoming type is already same as outgoing (that is, a `Map` is being given, and `Map` is expected -- hence code considers it a no-operation and just returns input value. The intent would

Re: [jackson-user] @JsonSubType Default Type If Not Matched.

2016-08-19 Thread Tatu Saloranta
Yes, this is what @JsonTypeInfo(, defaultImpl = GenericImpl.class) is for (assuming I understood question correctly). That type is used if type id is missing, or does not map to anything (in case of type id to class mappings). -+ Tatu +- On Fri, Aug 19, 2016 at 10:15 AM, Gerald Wiltse

Re: [jackson-user] Dynamic Filters

2016-08-22 Thread Tatu Saloranta
Your problem is that you are trying to re-configure `ObjectMapper` after using it -- this is not supported. Values that you assign before use will not change (or, rather, not be guaranteed to change, and attempts may even result in exceptions). You can only specify unchangeable default settings. H

Re: [jackson-user] best way to handle changing JSON field names?

2016-08-23 Thread Tatu Saloranta
There is no support for such variations at this point. I suspect most users would first bind JSON into Map or JsonNode, manipulate it into some sort of canonical representation, then use databinding. -+ Tatu +- On Tue, Aug 23, 2016 at 9:11 AM, JP wrote: > Hi all, > > Is there an eloquent way t

Re: [jackson-user] Java float value deserialized as DoubleNode instance

2016-08-24 Thread Tatu Saloranta
That sounds like a flaw. Could you please file an issue against `jackson-dataformats-binary` to get this fixed/improved? -+ Tatu +- On Wed, Aug 24, 2016 at 8:56 AM, Elliot wrote: > Hello, > > I'm new to Jackson and using it to parse some JSON using Jackson annotated > Java classes. The resultan

Re: [jackson-user] best way to handle changing JSON field names?

2016-08-24 Thread Tatu Saloranta
As a general answer, I am always open to new ideas. :) In this specific case I am not quite sure how this could be implemented, considering the way Jackson handles properties and introspection. However... come to think of this, there is one piece of configurability that might help here. `Property

Re: [jackson-user] best way to handle changing JSON field names?

2016-08-25 Thread Tatu Saloranta
r > the use of the PropertyNamingStrategy? > > Thanks, > jp > > On Wednesday, August 24, 2016 at 2:18:11 PM UTC-4, Tatu Saloranta wrote: >> >> As a general answer, I am always open to new ideas. :) >> >> In this specific case I am not quite sure how this

Re: [jackson-user] How to config maffer features per class

2016-08-26 Thread Tatu Saloranta
Visibility can be changed on per-class basis using annotation @JsonAutoDetect. And to use these for third-party classes, you can use mix-in annotation approach to associate settings. Conversely you could change defaults, and override visibility for your own classes. Going forward we could perhaps

Re: [jackson-user] Re: JsonMappingException: Can not resolve PropertyFilter with id

2016-08-29 Thread Tatu Saloranta
I don't know what might be wrong, but the first thing to try is to ensure that you are using the latest patch version from the branch; so, if you were using 2.6.2, upgrade to 2.6.6 (and so on). -+ Tatu +- On Mon, Aug 29, 2016 at 4:19 AM, manish kumar wrote: > Hi, > > I am also facing same issue

[jackson-user] Jackson 2.8.2 being released

2016-08-29 Thread Tatu Saloranta
Quick note: after releasing 2.7.7 patch release last week, I am now releasing 2.8.2. Latter has all the fixes that former had, plus half a dozen others as per: https://github.com/FasterXML/jackson/wiki/Jackson-Release-2.8.2 I plan on moving `master` to be 2.9.0-SNAPSHOT soon, so that development

[jackson-user] Re: [jackson-dev] Jackson 2.8.2 being released

2016-08-30 Thread Tatu Saloranta
2.8.1 (no 2.8.0 > release due to incompatibilities), and 2.8.2. They should be available on > maven central within a few hours. > > On Tue, Aug 30, 2016 at 12:31 AM Tatu Saloranta > wrote: > >> Quick note: after releasing 2.7.7 patch release last week, I am now >> releasi

[jackson-user] Unavailability of the old FasterXML Jackson Wiki: no ETA

2016-08-30 Thread Tatu Saloranta
Looks like the old (and somewhat obsolete) Wiki was read by many users. Unfortunately there has been a problem with its hosting, and at this point we do not quite have an ETA for it coming back (or potentially if, but first things first). I am pretty sure we can get a dump of contents from a backup

Re: [jackson-user] Delegating back to jackson in a deserializer?

2016-09-02 Thread Tatu Saloranta
Jackson does not provide support for type-detection that uses mechanism other than either static declarations (that is, declared Java type of POJO property) or polymorphic handling with type id. So to infer type from actual structure or contents of JSON (other than type id as mentioned), you will n

Re: [jackson-user] Sporadic deserialization failure with abstract class

2016-09-06 Thread Tatu Saloranta
Behavior does sound like a concurrency problem, but I do not recall anything specific that should cause it. I do know there have been fixes to some concurrency issues related to type resolution so this could be the root cause. There are no currently open bug reports for this, as far as I know. The

Re: [jackson-user] UnrecognizedPropertyException - ignore by default?

2016-09-08 Thread Tatu Saloranta
Yes. Also, with 2.8, there is a programmatic alternative to per-class `@JsonIgnoreProperties` annotation: mapper.configOverride(MyPOJO.class) .setIgnorals(JsonIgnoreProperties.Value.forIgnoreUnknown(false)); which can be used to disable or enable exception throwing on specific clas

Re: [jackson-user] Deprecated findSerializationType might be breaking refineSerializationType (v2.8.1)

2016-09-08 Thread Tatu Saloranta
As a follow up, turns out that the problem is, as far as I can see: https://github.com/FasterXML/jackson-databind/issues/1338 in the code itself. Issue has full detail, but basically Jackson is indicating a real problem in annotation for @JsonSerialize( keyAs=String.class) public Map getReve

Re: [jackson-user] How to filter out fields based on a dynamic condition?

2016-09-09 Thread Tatu Saloranta
On Fri, Sep 9, 2016 at 3:18 AM, Clément Poulain wrote: > Hi there, > > I'm using Jackson 2.7.5 with Jersey 2.22.1 (run on Grizzly 2.3.23) to > build a REST API. > > I have a class that looks like: > > public class Task { > >List updates = new ArrayList<>(); > > } > > public class Update { > >

Re: [jackson-user] Re: Can I dynamically disable JsonAnySetter so that I can have strict rules from an API perspective?

2016-09-10 Thread Tatu Saloranta
On Sat, Sep 10, 2016 at 5:10 PM, Brent Ryan wrote: > So using a mixin did NOT work. Here's the mixin: > > interface DisableAdditionalPropertiesMixIn { > > @JsonIgnore > Map getAdditionalProperties(); > > @JsonIgnore > void setAdditionalProperty(String name, Object value); > } > >

Re: [jackson-user] How to filter out fields based on a dynamic condition?

2016-09-10 Thread Tatu Saloranta
On Sat, Sep 10, 2016 at 6:45 AM, Clément Poulain wrote: > >> BeanSerializerModifier would probably not help here either because it >> only gets called once when constructing serializer for a type, and them it >> is cached (new instances may be created via ContextualSerializer, but >> that's still

Re: [jackson-user] How to write a custom list deserializer with automatic type inference like CollectionDeserializer?

2016-09-12 Thread Tatu Saloranta
Adding custom Collection deserializers is possible, but it is quite a bit more involved due to delegation needed. Best examples of how this is done would probably be found from `jackson-datatype-guava` package, which has support for Immutable lists and sets. You may also want to have a look `Collec

Re: [jackson-user] How to filter out fields based on a dynamic condition?

2016-09-12 Thread Tatu Saloranta
On Mon, Sep 12, 2016 at 9:30 AM, Clément Poulain wrote: > > >> I think there are many ways to build filters, including cases where you >> have a small number of filters, but each with complicated logic. One >> possible problem is that of passing settings/configuration into filters, >> regarding o

Re: [jackson-user] How to filter out fields based on a dynamic condition?

2016-09-13 Thread Tatu Saloranta
On Tue, Sep 13, 2016 at 5:28 AM, Clément Poulain wrote: > >> Not necessarily simple, but you did describe the obvious problem that >> once you register custom (de)serializer, that's what will be found. >> It would also be tricky to know what the "original" deserializer would >> be, considering th

Re: [jackson-user] How to filter out fields based on a dynamic condition?

2016-09-13 Thread Tatu Saloranta
On Tue, Sep 13, 2016 at 1:09 PM, Clément Poulain wrote: > >> Actually you can not omit serialization here: at this point a value >> generally has to be written (if within JSON Object), since name has been >> written. >> >> So you would need to serialize something here; suppression of a property >

[jackson-user] Fasterxml Wiki (etc) back up again

2016-09-14 Thread Tatu Saloranta
After (too) long outage, wiki.fasterxml.com is back up again. I hope to move some parts (specifically, Smile format specification) out now, and over time other parts need to go too. But whatever is there is accessible now. -+ Tatu +- -- You received this message because you are subscribed to th

Re: [jackson-user] Re: Can I dynamically disable JsonAnySetter so that I can have strict rules from an API perspective?

2016-09-17 Thread Tatu Saloranta
Excellent, thank you. -+ Tatu +- On Sat, Sep 17, 2016 at 9:30 AM, Brent Ryan wrote: > Added issue here: https://github.com/FasterXML/jackson-databind/ > issues/1376 > > Thanks! > > > On Saturday, September 10, 2016 at 10:17:45 PM UTC-4, Tatu Saloranta wrote: >> >

[jackson-user] Jackson 2.8.3 released (Scala to follow)

2016-09-18 Thread Tatu Saloranta
Quick note: I just finished pushing patch version 2.8.3. Release notes can be found here: https://github.com/FasterXML/jackson/wiki/Jackson-Release-2.8.3 Upgrade is recommended from earlier 2.8.x versions. Scala version is not yet out, but our hope is that it can be release within upcoming week

[jackson-user] Jackson 2.9 -> Java 8 ?

2016-09-26 Thread Tatu Saloranta
After slow gradual upgrades to JDK baseline, I think time may have come to move to Java 8 for Jackson 2.9. But before committing to this course, I want to make sure there is wide agreement on this, as well as on mitigation plans for users who can not use the new version. My thinking here is that m

Re: [jackson-user] Releases

2016-09-27 Thread Tatu Saloranta
Nothing definitive, but in general: 1. Releases wiki page -- https://github.com/FasterXML/jackson/wiki/Jackson-Releases -- and explicit sub-pages do get updated 2. We try to tweet via @fasterxml 3. There is also `jackson-announce` mailing list (alas, not reliable used) I would be interested in kn

[jackson-user] Jackson 2.7.8 patch release out

2016-09-27 Thread Tatu Saloranta
Patch release 2.7.8 is now out, as per: https://github.com/FasterXML/jackson/wiki/Jackson-Release-2.7.8 (minus some inertia wrt Scala module, to follow) Although upgrades from earlier patch versions is always recommended -- we try to keep risk for patch versions very low, and unlike issues with

Re: [jackson-user] Progressive Deserialization

2016-09-27 Thread Tatu Saloranta
On Tue, Sep 20, 2016 at 8:49 AM, Hob Spillane wrote: > I'm trying to do something a bit non-standard and hoping someone has a > suggestion. I'd like to use elements at the top of my JSON document to > build up objects further down the document. Here's a contrived example: > { > "templates": {

[jackson-user] Re: Jackson 2.9 -> Java 8 ?

2016-09-28 Thread Tatu Saloranta
minimize compatibility changes, since there would be no namespace isolation. WDYT? -+ Tatu +- On Mon, Sep 26, 2016 at 9:32 PM, Tatu Saloranta wrote: > After slow gradual upgrades to JDK baseline, I think time may have come to > move to Java 8 for Jackson 2.9. But before committing to this cou

Re: [jackson-user] Jackson 2.9 -> Java 8 ?

2016-09-28 Thread Tatu Saloranta
ava 8 baseline requirement, would this change anyone's opinion, compared to going with 2.9? Is there any real downside to this? (also note: it is possible that we might just go with Java6 platform compat with 2.9; and go Java 8 after that) -+ Tatu +- > > I hope this helps. > >

Re: [jackson-user] Deserialize primitive long field while using TypeResolverBuilder of Jackson

2016-10-02 Thread Tatu Saloranta
I can't say for sure either; could you please file a bug at `jackson-databind`, including sample code in issue itself? I suspect this has to do with the special treatment that a small number of "natural" types (long/Long, boolean/Boolean, String, double/Double) require with polymorphic typing (bas

Re: [jackson-user] @JsonTypeInfo doesn't serialize property value in a List

2016-10-07 Thread Tatu Saloranta
So, what happens is that while you think you are giving a List (or List), what runtimes sees is a List. Since `Object` has no `@JsonTypeInfo`, no type is included. You have been tripped by Java Type Erasure. Also, my general suggestion is to NEVER EVER use generic type as the root type, but always

Re: [jackson-user] @JsonTypeInfo doesn't serialize property value in a List

2016-10-07 Thread Tatu Saloranta
such ways. > > Thanks for quick response. > > 2016年10月8日土曜日 2時52分18秒 UTC+9 Tatu Saloranta: >> >> So, what happens is that while you think you are giving a >> List (or List), what runtimes sees is a >> List. Since `Object` has no `@JsonTypeInfo`, no type is >>

Re: [jackson-user] Progressive Deserialization

2016-10-10 Thread Tatu Saloranta
Sounds good. The only possible further improvement I can think of would be use of `JsonParserDelegate` which could be useful if you need to dispatch most calls to an existing real `JsonParser`. -+ Tatu +- On Sat, Oct 8, 2016 at 11:16 AM, Hob Spillane wrote: > Tatu, > > Thanks for the reply. D

Re: [jackson-user] Why does custom deserializer get called multiple times with 1 call to mapper.readValue()?

2016-10-11 Thread Tatu Saloranta
I can't see why this would be immediately. Would it be possible to create a simple github repo, or package this up as a maven project? I could have a look to see what gives. -+ Tatu +- On Mon, Oct 10, 2016 at 6:42 PM, Brent Ryan wrote: > Here's the custom deserializer: https://github.com/jonpe

Re: [jackson-user] Set DateFormat

2016-10-11 Thread Tatu Saloranta
It means that `ObjectMapper` is only thread-safe when ALL configuration is done first, before any usage. This includes, but is not limited to, configuring default `DateFormat` to use. Usage of `DateFormat` itself is synchronized such that this aspect itself is not problematic, rather, settings of `

Re: [jackson-user] Set DateFormat

2016-10-12 Thread Tatu Saloranta
ateFormat' when mapping data across multiple > threads ? Where exactly is this done ? > A new instance is created with a clone; no sharing is done. If you want to see where, have a look at code. -+ Tatu +- > > > > Thanks, > Mohan > > On Wednesday, 12 Octobe

Re: [jackson-user] Re: Json Schema V4 issue with virtual property

2016-10-14 Thread Tatu Saloranta
I don't think schema generation / type introspection aspects have been tested with virtual properties, so you are exploring uncharted territory here. Most likely some wiring is missing. As usual, a github issue with simple repo would be good way to go. -+ Tatu +- On Fri, Oct 14, 2016 at 6:12 AM,

Re: [jackson-user] Replacing a custom resolver with @JsonSubTypes

2016-10-14 Thread Tatu Saloranta
The only thing is @JsonTypeInfo(defaultImpl=...) which would be used if nothing is found or matches. -+ Tatu +- On Fri, Oct 14, 2016 at 8:01 AM, Benson Margulies wrote: > Note the fallback if statement here. Is there a way to do an @Type > that says what to do if nothing else matches? > > @Ove

Re: [jackson-user] Problem pretty printing a String of Json

2016-10-14 Thread Tatu Saloranta
Java String just becomes JSON String value, that is, surrounded in double quotes and contents escaped if and as necessary. So to pretty-print, you need to parse JSON into a Java object structure, then write with pretty-printing. Something like: JsonNode root = mapper.readTree(input); String prett

Re: [jackson-user] About @JsonProperty, @JsonGetter and @JsonSetter

2016-10-14 Thread Tatu Saloranta
You can think of `@JsonGetter` and `@JsonSetter` mostly as old aliases for `@JsonProperty`. So you shouldn't have to them for anything. And yes, annotated getter/field for serialization (to access property value), setter/constructor-parameter/field for deserialization (to assign). Beyond this, th

Re: [jackson-user] Serialize exception cause infinite recursion, when @JsonCreator method's param mismatch the type

2016-10-14 Thread Tatu Saloranta
Which version of Jackson? Have you tried to upgrade with the latest patch version, so, if you were using 2.8.1, upgrade to 2.8.4? -+ Tatu +- On Thu, Oct 13, 2016 at 2:01 AM, 林林夕 wrote: > >

Re: [jackson-user] How to replace UnwrappingBeanSerializer

2016-10-20 Thread Tatu Saloranta
This is not an end user use case that we explicitly support, but if there are gaps where unwrapping serializer accidentally becomes not-unwrapping (vanilla) one, those should be fixed. A github issue would be helpful, showing when this happens -- so if you could file one for "withIgnorals" that'd

Re: [jackson-user] [jackson-datatype-jdk8] Optional default value

2016-10-24 Thread Tatu Saloranta
What do you mean by optional fields? Optional values are usually defined by assigning them in POJO. Jackson itself does not support value defaulting, as that belongs (IMO) outside data-binding. -+ Tatu +- On Mon, Oct 24, 2016 at 2:58 AM, Alex Oberon wrote: > Hi. > > How to make default values

Re: [jackson-user] Can't deserialize polymorphic attribute from json string

2016-11-01 Thread Tatu Saloranta
You need to use `@JsonTypeInfo` in the base class, where it is visible when traversing property types. So just move declaration from Rectangle down to Shape. -+ Tatu +- On Mon, Oct 31, 2016 at 8:08 AM, sdfdsf dsfsdfds wrote: > I have a json string coming to my GWT app with the fully qualified cl

Re: [jackson-user] [jackson-datatype-jdk8] Optional default value

2016-11-01 Thread Tatu Saloranta
al assign > Optional.empty() instead of assign null > > On Tuesday, October 25, 2016 at 12:55:48 AM UTC+3, Tatu Saloranta wrote: >> >> What do you mean by optional fields? Optional values are usually defined >> by assigning them in POJO. >> Jackson itself does not supp

Re: [jackson-user] Is there a way to add an attribute to the wrapper element for a collection when using XML?

2016-11-01 Thread Tatu Saloranta
Unfortunately there is no functionality to directly do this. While it is possible to append "virtual" properties -- and possibly make it work here -- the problem is that Collections are not treated as POJOs, and since output assumes logical Array as shape, no properties may be added. -+ Tatu +-

Re: [jackson-user] Potential breakage ahead (as a comment in TypeFactory)

2016-11-07 Thread Tatu Saloranta
The bigger problem here is that you are actually using the wrong method. This can be seen as a documentation flaw. The method to use with `Map` and subtypes is `constructMapType()`; this will work better since it will construct `MapType`. Having said that, I definitely agree with the preference o

  1   2   3   4   5   6   7   8   9   10   >