Skip to content

Ensure JsonNodes are ContainerNodes in AddOperation #7

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

Merged
merged 1 commit into from
Mar 4, 2014
Merged

Ensure JsonNodes are ContainerNodes in AddOperation #7

merged 1 commit into from
Mar 4, 2014

Conversation

lopopolo
Copy link
Contributor

@lopopolo lopopolo commented Mar 4, 2014

Fixes a ClassCastException when AddOperation attempts to add to a non-ContainerNode. For example patching:

{
  "foo": "bar"
}

with the patch:

[ { "op": "add", "path": "/foo/f", "value": "bar" } ]

With this patch, AddOperation will throw a JsonPatchException in this case.

Thank you for dual licensing under ASL 2.0. 😄

@fge
Copy link
Collaborator

fge commented Mar 4, 2014

Hello,

Nice one!

I'll pull in. With this in, merge-patch support and full {de,}serialization support, this grants a new release...

fge added a commit that referenced this pull request Mar 4, 2014
Ensure JsonNodes are ContainerNodes in AddOperation

The existing code only checked the parent node of the target path but failed to account for the node itself not being a container node.
@fge fge merged commit 1807e05 into java-json-tools:master Mar 4, 2014
fge added a commit that referenced this pull request Mar 4, 2014
Francis Galiegue (45):
      Announce 1.4
      Remove JsonNullAwareDeserializer
      Small test program highlighting serialization deficiencies
      Add custom JsonPointer serializer class
      project.gradle: add javadoc link to jackson-coreutils
      Add @JsonSerialize annotations
      Tests: trust Jackson deserialization a little more
      Tests: rename "patch" to "op" for individual operation tests
      Add serialization tests for JSON Patch operations
      Add @JsonPropertyOrder for JSON serialization "beautification"
      DualPathOperation: add javadoc for protected constructor
      JsonPatch: decorate "operations" instance field with @JsonValue
      Support full Jackson serialization via ObjectMapper
      Use ToStringSerializer instead of our own
      RemoveOperation: add a @JsonPropertyOrder
      Start and implement JSON Merge Patch
      JsonMergePatch: change signature of .apply()
      Implement JSON merge patch for objects, with tests
      Rework serialization for JsonPatch
      JsonMergePatch: change IETF draft reference
      JsonMergePatch: add and start to test a clearNulls method
      JsonMergePatch: fix call to message bundle assertion...
      Add more tests for clearNulls
      Start and extract mergepatch examples from the draft
      Add text copies of RFC 6901 (JSON Patch) and JSON Merge Patch draft
      Add more mergepatch tests
      mergepatch: add all examples from the draft
      mergepatch: make all tests pass
      JsonMergePatch: add deserialization support
      JsonMergePatch: use JacksonUtils to get a JsonNodeFactory
      JsonMergePatch: implement serialization (UNTESTED)
      JsonMergePatch: add javadoc
      JsonMergePatch: add code comments for .clearNulls*()
      Update README
      More README updates
      Delete now obsolete file
      Merge pull request #7 from lopopolo/add-op-class-cast-exception
      Move newly added test to the appropriate test file
      Change error message in one test
      AddOperation: some code changes
      Add entry to CONTRIBUTORS.md
      AddOperation: update comment
      Update to gradle 1.11
      Update release notes
      1.5

Ryan Lopopolo (1):
      Ensure JsonNodes are ContainerNodes in AddOperation
stephanedaviet pushed a commit to stephanedaviet/json-patch that referenced this pull request Apr 6, 2019
"translate" and "translate?" operations
stephanedaviet pushed a commit to stephanedaviet/json-patch that referenced this pull request Apr 6, 2019
Eugene Huang (8):
    Introduce TranslateOperation
    TranslateOperation tests
    Clean up TranslateOperation
    Fix TranslateOperation testing issues
    TranslateOptionalOperation
    Fix TranslateOptionalOperation tests
    Announce 1.12
    1.13

box-ehuang (1):
    Merge pull request java-json-tools#7 from crate-metadata/translate

huggsboson (1):
    Update README.md
BartekGravity referenced this pull request in gravity9-tech/json-patch-path Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants