Avro
  1. Avro
  2. AVRO-246

Java schema parser should take schema from InputStream in addition to file

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.3.0
    • Component/s: java
    • Labels:
      None

      Description

      Accepting the schema from an InputStream (in addition to the current File) enables many use-cases like taking schema from a resource in a jar file.

      1. AVRO-246.patch
        0.9 kB
        Thiruvalluvan M. G.
      2. AVRO-246.patch
        0.9 kB
        Thiruvalluvan M. G.

        Activity

        Hide
        Thiruvalluvan M. G. added a comment -

        This patch addresses the problem. Though I could have made Jackson accept java.io.File directly in File version of parse, I decided to delegate to to InputStream version so that there is no duplication of try/catch.

        Show
        Thiruvalluvan M. G. added a comment - This patch addresses the problem. Though I could have made Jackson accept java.io.File directly in File version of parse, I decided to delegate to to InputStream version so that there is no duplication of try/catch.
        Hide
        Doug Cutting added a comment -

        The advantage of passing the File directly to Jackson is that Jackson can then generate error messages that include the file name and line number.

        Show
        Doug Cutting added a comment - The advantage of passing the File directly to Jackson is that Jackson can then generate error messages that include the file name and line number.
        Hide
        Thiruvalluvan M. G. added a comment -

        Good point Doug. Restored parse(File) to the original.

        Show
        Thiruvalluvan M. G. added a comment - Good point Doug. Restored parse(File) to the original.
        Hide
        Doug Cutting added a comment -

        +1 This looks good. Can you also please add a simple javadoc comment, stating something like, "Construct a Schema from JSON text." The parse(File) method also needs similar javadoc.

        Show
        Doug Cutting added a comment - +1 This looks good. Can you also please add a simple javadoc comment, stating something like, "Construct a Schema from JSON text." The parse(File) method also needs similar javadoc.
        Hide
        Thiruvalluvan M. G. added a comment -

        Committed revision 888720 after adding comments and a test.

        Show
        Thiruvalluvan M. G. added a comment - Committed revision 888720 after adding comments and a test.

          People

          • Assignee:
            Thiruvalluvan M. G.
            Reporter:
            Thiruvalluvan M. G.
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development