Uploaded image for project: 'Apache Gora'
  1. Apache Gora
  2. GORA-361

AvroUtils.deepClonePersistent needs to flush BinaryEncoder

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.4
    • 0.5
    • gora-core
    • None

    Description

      Calling AvroUtils.deepClonePersistent on a smallish object (e.g. an unfetched Nutch WebPage) results in the following exception:

      java.lang.RuntimeException: Unable to deserialize avro object from byte buffer - please report this issue to the Gora bugtracker or your administrator.
              at org.apache.gora.util.AvroUtils.deepClonePersistent(AvroUtils.java:125)
      

      The method clones its argument by writing it to a wrapped byte array and deserializing it from there. However, the output is buffered in the BinaryEncoder and doesn't appear in the OutputStream. Adding enc.flush() after writer.write seems to fix the bug.

      The attached patch contains a test that demonstrates the bug.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            gerhard.gossen Gerhard Gossen
            gerhard.gossen Gerhard Gossen
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment