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

Fix parseToken array popping #13620

Merged

Commits on Aug 13, 2024

  1. Fix parseToken array popping

    Signed-off-by: naomichi-y <n.yamakita@gmail.com>
    naomichi-y authored and msfroh committed Aug 13, 2024
    Configuration menu
    Copy the full SHA
    8e6e92b View commit details
    Browse the repository at this point in the history
  2. Add fix description

    Signed-off-by: naomichi-y <n.yamakita@gmail.com>
    naomichi-y authored and msfroh committed Aug 13, 2024
    Configuration menu
    Copy the full SHA
    4f3be35 View commit details
    Browse the repository at this point in the history
  3. Refactor JsonToStringXContentParser#parseToken

    This method was pretty complicated, hard to follow, and therefore prone
    to bugs.
    
    This change introduces a proper stack (rather than a StringBuilder) to
    keep track of fields under fields. When ever we parse a field name, we
    push it onto the stack, recursively parse its value (an object, an
    array, or a primitive value), then we pop (guaranteeing pushes and pops
    are balanced).
    
    Signed-off-by: Michael Froh <froh@amazon.com>
    msfroh committed Aug 13, 2024
    Configuration menu
    Copy the full SHA
    ca4f31e View commit details
    Browse the repository at this point in the history
  4. Remove use of org.apache.logging.log4j.util.Strings

    Signed-off-by: Michael Froh <froh@amazon.com>
    msfroh committed Aug 13, 2024
    Configuration menu
    Copy the full SHA
    7f176b3 View commit details
    Browse the repository at this point in the history
  5. Make sure JsonToStringXContentParser ends on END_OBJECT

    There is logic in DocumentParser that expects any object parser to start
    with currentToken() pointing to START_OBJECT, and return with
    currentToken() pointing to END_OBJECT.
    
    My previous commits were stepping over the start/end, and returning on
    the token following the end.
    
    Signed-off-by: Michael Froh <froh@amazon.com>
    msfroh committed Aug 13, 2024
    Configuration menu
    Copy the full SHA
    02c12c6 View commit details
    Browse the repository at this point in the history
  6. Throw exception when flat object is null

    The existing behavior throws an exception on null flat object by
    advancing the parser beyond the end of the flat object input.
    
    We could simply skip a null flat_object field, but this would be
    a behavioral change from 2.7.
    
    Signed-off-by: Michael Froh <froh@amazon.com>
    msfroh committed Aug 13, 2024
    Configuration menu
    Copy the full SHA
    cac0d94 View commit details
    Browse the repository at this point in the history