Well the code is using the builder pattern
return Json.createObjectBuilder()
.add("destinationName", counter.getDestinationName())
.add("destinationSubscription", counter.getDestinationSubscription())
Problem is that the string values here are nullable.
I'm guessing the spec calls it out, as I just looked and the RI has a similar
check.
John
On 2016-07-21 11:28 (-0400), Romain Manni-Bucau <[email protected]> wrote:
> Hi John,
>
> Do you speak about generator/builder? I think it is valid since the
> JsonValue#valueType shouldnt be string if null and the API quite enforce
> you to choose it as a caller.
>
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> | Blog
> <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
>
> 2016-07-21 17:25 GMT+02:00 John D. Ament <[email protected]>:
>
> > Hi,
> >
> > I was wondering, is the null check on JsonString valid? Or can it be
> > handled a little bit better? See here:
> > https://github.com/apache/johnzon/blob/master/johnzon-core/src/main/java/org/apache/johnzon/core/JsonStringImpl.java#L30
> >
> > I'd prefer to not have to add null checks in my code, and the fluent
> > interface works well, so I was wondering if it made sense for Johnzon to do
> > a null check, and if the input is null add it as null instead?
> >
> > John
> >
>