Axiom
  1. Axiom
  2. AXIOM-24

OMDocument#serializeAndConsume doesn't consume the document

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2.8
    • Fix Version/s: 1.2.11
    • Component/s: DOOM, LLOM
    • Labels:
      None

      Description

      OMDocument#serializeAndConsume doesn't consume the document but instead fully builds it.

      This is caused by the following piece of code:

      while (children.hasNext())

      { OMNodeEx omNode = (OMNodeEx) children.next(); omNode.internalSerializeAndConsume(writer); }

      As described in WSCOMMONS-346, the call to Iterator#next() actually builds the returned node, so that the call to internalSerializeAndConsume has the same effect as serialization with caching enabled. This means that the code fully builds the document.

      Note that the code actually doesn't make sense because once a child (in particular the document element) has been consumed, it is not possible to retrieve the next sibling. This means that even if WSCOMMONS-346 is solved, the code still wouldn't behave as expected. Worse, it would trigger an exception.

        Issue Links

          Activity

          Andreas Veithen created issue -
          Andreas Veithen made changes -
          Field Original Value New Value
          Link This issue blocks WSCOMMONS-346 [ WSCOMMONS-346 ]
          Andreas Veithen made changes -
          Description OMDocument#serializeAndConsume doesn't consume the document but instead fully builds it.

          This is caused by the following piece of code:

                      while (children.hasNext()) {
                          OMNodeEx omNode = (OMNodeEx) children.next();
                          omNode.internalSerializeAndConsume(writer);
                      }

          As described in WSCOMMONS-346, the call to Iterator#next() actually builds the returned node, so that the call to internalSerializeAndConsume has the same effect as serialization with caching enabled. This means that the code fully builds the document.

          Note that the code actually doesn't make sense because once a child (in particular the document element) has been consumed, it is not possible to retrieve the next sibling. This means that even if WSCOMMONS-346 is solved, to code still wouldn't behave as expected. Worse, it would trigger an exception.
          OMDocument#serializeAndConsume doesn't consume the document but instead fully builds it.

          This is caused by the following piece of code:

                      while (children.hasNext()) {
                          OMNodeEx omNode = (OMNodeEx) children.next();
                          omNode.internalSerializeAndConsume(writer);
                      }

          As described in WSCOMMONS-346, the call to Iterator#next() actually builds the returned node, so that the call to internalSerializeAndConsume has the same effect as serialization with caching enabled. This means that the code fully builds the document.

          Note that the code actually doesn't make sense because once a child (in particular the document element) has been consumed, it is not possible to retrieve the next sibling. This means that even if WSCOMMONS-346 is solved, the code still wouldn't behave as expected. Worse, it would trigger an exception.
          Andreas Veithen made changes -
          Fix Version/s Axiom 1.2.10 [ 12314861 ]
          Andreas Veithen made changes -
          Fix Version/s Axiom 1.2.11 [ 12315420 ]
          Fix Version/s Axiom 1.2.10 [ 12314861 ]
          Andreas Veithen made changes -
          Project WS-Commons [ 12310250 ] Axiom [ 12311190 ]
          Key WSCOMMONS-449 AXIOM-24
          Affects Version/s Axiom 1.2.8 [ 12313556 ]
          Component/s AXIOM [ 12310703 ]
          Fix Version/s Axiom 1.2.11 [ 12315420 ]
          Jeff Turner made changes -
          Affects Version/s Axiom 1.2.8 [ 12315531 ]
          Fix Version/s Axiom 1.2.11 [ 12315534 ]
          Andreas Veithen made changes -
          Link This issue is blocked by AXIOM-346 [ AXIOM-346 ]
          Andreas Veithen made changes -
          Assignee Andreas Veithen [ veithen ]
          Component/s DOOM [ 12313880 ]
          Component/s LLOM [ 12313879 ]
          Andreas Veithen made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Andreas Veithen made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

            People

            • Assignee:
              Andreas Veithen
              Reporter:
              Andreas Veithen
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development