Cocoon 3
  1. Cocoon 3
  2. COCOON3-23

StackOverflowError on CachingPipeline.setup(OutputStream)

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.0-alpha-1
    • Fix Version/s: 3.0.0-alpha-2
    • Component/s: cocoon-pipeline
    • Labels:
      None

      Description

      CachingPipeline.setup(OutputStream) calls itself resulting in a StackOverflowError [1]. I suppose that it should create a CachingOutputStream first and then call super.setup like setup(OutputStream outputStream, Map<String, Object> parameters) does [2]. [3] is a short code fragment to reproduce.

      [1]
      @Override
      public void setup(OutputStream outputStream) {
          this.setup(outputStream);
      }

      [2]
      @Override
      public void setup(OutputStream outputStream, Map<String, Object> parameters) {
           // create a caching output stream to intercept the result
           this.cachingOutputStream = new CachingOutputStream(outputStream);

           super.setup(this.cachingOutputStream, parameters);
      }

      [3]
      Pipeline pipeline = new CachingPipeline();
      pipeline.addComponent(new StringGenerator("<x></x>"));
      pipeline.addComponent(new XMLSerializer());

      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      pipeline.setup(baos);
      pipeline.execute();

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Closed Closed
        5h 30m 1 Steven Dolg 30/Jan/09 20:16
        Steven Dolg made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]
        Steven Dolg made changes -
        Fix Version/s 3.0.0-alpha-2 [ 12313446 ]
        Steven Dolg made changes -
        Attachment cocoon3-23.patch [ 12399157 ]
        Hide
        Steven Dolg added a comment -
        This implementation makes no sense of course.

        The method is already correctly implemented in the base class AbstractPipeline and actually there is no need to overwrite it.

        I provided a patch, that completely removes the method setup(Outputstream) of the CachingPipeline and adds a unit test to check that calling setup(Outputstream) on a CachingPipeline works correctly.

        The patch is just for the case that someone wants to apply it locally. I'll commit this change right away.


        Thanks for finding this one...
        Show
        Steven Dolg added a comment - This implementation makes no sense of course. The method is already correctly implemented in the base class AbstractPipeline and actually there is no need to overwrite it. I provided a patch, that completely removes the method setup(Outputstream) of the CachingPipeline and adds a unit test to check that calling setup(Outputstream) on a CachingPipeline works correctly. The patch is just for the case that someone wants to apply it locally. I'll commit this change right away. Thanks for finding this one...
        Steven Dolg made changes -
        Field Original Value New Value
        Assignee Cocoon Developers Team [ cocoon ] Steven Dolg [ steven.dolg ]
        Alexander Daniel created issue -

          People

          • Assignee:
            Steven Dolg
            Reporter:
            Alexander Daniel
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development