Avro
  1. Avro
  2. AVRO-1023

Saved state should be restored in finally clause

    Details

    • Type: Bug Bug
    • Status: Patch Available
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: java
    • Labels:
      None

      Description

      Schema.parse(JsonParse) and Schema.parse(JsonNode,Names) save global state in a local variable; they should restore that state in a finally clause but they don't.

      1. AVRO-1023.patch
        11 kB
        Raymie Stata

        Activity

        Hide
        Raymie Stata added a comment -

        This patch looks big because I put fairly long stretches of code into a try/finally block, and had to re-indent it. Except for the reindenting, none of the code moved inside the try/finally has been changed.

        Show
        Raymie Stata added a comment - This patch looks big because I put fairly long stretches of code into a try/finally block, and had to re-indent it. Except for the reindenting, none of the code moved inside the try/finally has been changed.
        Hide
        Scott Carey added a comment -

        We should also add a unit test that fails if this is not applied.

        Show
        Scott Carey added a comment - We should also add a unit test that fails if this is not applied.
        Hide
        Doug Cutting added a comment -

        The way this might be triggered is if a Schema.Parser is reused after a SchemaParseException is thrown. Currently the default namespace is that of the preceding schema parsed. If a SchemaParseException is thrown and the parser is reused then the default namespace could be that of a schema nested within the previous schema.

        Show
        Doug Cutting added a comment - The way this might be triggered is if a Schema.Parser is reused after a SchemaParseException is thrown. Currently the default namespace is that of the preceding schema parsed. If a SchemaParseException is thrown and the parser is reused then the default namespace could be that of a schema nested within the previous schema.

          People

          • Assignee:
            Raymie Stata
            Reporter:
            Raymie Stata
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:

              Development