Fop
  1. Fop
  2. FOP-1909

[PATCH] fixed bugs in MODCAParser

    Details

    • Type: Bug Bug
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: trunk
    • Fix Version/s: None
    • Component/s: unqualified
    • Labels:
      None
    • Environment:
      Operating System: All
      Platform: All
    • External issue ID:
      50909

      Description

      Under uncertain conditions, an EOFException is thrown by the MODCAParser when invoking the mark/reset methods of a BufferedInputStream that wraps an input stream of MODCA data. This patch provides a parsing solution that does not rely on mark() and reset().

      MODCAParser now correctly serializes structured fields that contain extension data.

      Patch includes unit test.

      1. bugzilla.patch
        38 kB
        Peter Hancock

        Activity

        Hide
        Peter Hancock added a comment -

        Attachment bugzilla.patch has been added with description: PATCH

        Show
        Peter Hancock added a comment - Attachment bugzilla.patch has been added with description: PATCH
        Hide
        Chris Bowditch added a comment -

        Hi Peter,

        I've taken a look at your patch and have some observations:

        1. I am wondering why you have moved the class UnparsedStructuredField from a separate class file to an inner class of MODCAParser. It may be a matter of personal taste but I think inner classes are really only suitable for small classes that are not used elsewhere. The Unit text classes reference this inner class and you've had to include it in the imports statement.
        2. Your changes to readNextStructedField remove the checks for CR/LF. I think these are required in case the AFP Resource being parsed contains any line data. Are you sure its safe to remove them?

        Thanks,

        Chris

        Show
        Chris Bowditch added a comment - Hi Peter, I've taken a look at your patch and have some observations: 1. I am wondering why you have moved the class UnparsedStructuredField from a separate class file to an inner class of MODCAParser. It may be a matter of personal taste but I think inner classes are really only suitable for small classes that are not used elsewhere. The Unit text classes reference this inner class and you've had to include it in the imports statement. 2. Your changes to readNextStructedField remove the checks for CR/LF. I think these are required in case the AFP Resource being parsed contains any line data. Are you sure its safe to remove them? Thanks, Chris
        Hide
        Peter Hancock added a comment -

        Hi Chris,

        1 - I agree that UnparsedStructuredField should probably be a top level class.

        2 - I removed the checks for CR/LF because there was no extra action being taken during byte stream iteration:
        The current iteration logic

        while
        if CR/LF
        continue
        else if CARRIAGE_CONTROL
        break

        is just equivalent to

        while
        if CARRIAGE_CONTROL
        break

        I will ammend and commit the patch shortly.

        Thanks for your comments,

        Pete

        Show
        Peter Hancock added a comment - Hi Chris, 1 - I agree that UnparsedStructuredField should probably be a top level class. 2 - I removed the checks for CR/LF because there was no extra action being taken during byte stream iteration: The current iteration logic while if CR/LF continue else if CARRIAGE_CONTROL break is just equivalent to while if CARRIAGE_CONTROL break I will ammend and commit the patch shortly. Thanks for your comments, Pete
        Hide
        Peter Hancock added a comment -

        fixed in commit 1104135

        Show
        Peter Hancock added a comment - fixed in commit 1104135

          People

          • Assignee:
            fop-dev
            Reporter:
            Peter Hancock
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development