Skip to content
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

GEODE-6196 Replace use of org.json with Jackson JSON library #3259

Closed
wants to merge 5 commits into from

Conversation

bschuchardt
Copy link
Contributor

@bschuchardt bschuchardt commented Mar 2, 2019

This removes TypedJson and replaces it with QueryResultFormatter that uses Jackson ObjectMapper to serialize query results into a JSON document. Custom serializers for collections, PdxInstance, query Structs, etc. do most of the work. It also wraps the default serializer in order to keep Jackson from going crazy if there is a circular reference and to limit the depth of serialization (GEODE-1842, which was never really fixed).

Most of the changes in this PR are replacing the TypedJson class name with QueryResultFormatter and changing the expected query result strings. The bulk of the code to be reviewed is in the new QueryResultFormatter class.

Thank you for submitting a contribution to Apache Geode.

In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:

For all changes:

  • Is there a JIRA ticket associated with this PR? Is it referenced in the commit message?

  • Has your PR been rebased against the latest commit within the target branch (typically develop)?

  • Is your initial contribution a single, squashed commit?

  • Does gradlew build run cleanly?

  • Have you written or updated unit tests to verify your changes?

  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?

Note:

Please ensure that once the PR is submitted, you check travis-ci for build issues and
submit an update to your PR as soon as possible. If you need help, please send an
email to dev@geode.apache.org.

NOT READY FOR REVIEW

This removes most of the code from TypedJson and replaces it with
Jackson ObjectMapper.  Type information for things like Enums isn't
being generated in this commit.  All TypedJson tests are passing
as are QueryDataFunction tests (which is the only thing that uses
TypedJson).
most of TypedJson's internals were replaced so I just renamed it to
QueryResultFormatter to better show its intended purpose.

Object traversal depth is now limited to the element-count being passed
by the QueryDataFunction function.  This will prevent the stack-overflow
problems seen in GEODE-1842.
also reverting another test change that is no longer needed.
// insert a RegionEntry serializer because they're too messy looking
mapperModule.addSerializer(Region.Entry.class, new RegionEntrySerializer());

// mapper.setFilterProvider(new SimpleFilterProvider().setDefaultFilter(new DepthFilter(4)));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove commented lines.

@bschuchardt bschuchardt closed this Mar 7, 2019
@bschuchardt bschuchardt deleted the feature/GEODE-6196 branch March 7, 2019 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants