Uploaded image for project: 'Tuscany'
  1. Tuscany
  2. TUSCANY-1677

XML Parser not being closed with void return types causing memory leaks

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • Java-SCA-1.0
    • None
    • None
    • Patch Available

    Description

      I am seeing a memory leak due to the XML Stream reader not being closed when void return types are used. I modified the Output2OutputTransformer
      to close() the stream when a void return is encountered. Here is snippit. I attached the source code..

      if ((!sourceWrapped) && targetWrapped) {
      // Unwrapped --> Wrapped
      WrapperInfo wrapper = targetOp.getWrapper();
      Object targetWrapper = targetWrapperHandler.create(wrapper.getOutputWrapperElement(), context);

      List<ElementInfo> childElements = wrapper.getOutputChildElements();
      if (childElements.isEmpty())

      { // void output if (targetWrapper instanceof OMElement) ((OMElement)targetWrapper).getXMLStreamReader().close(); return targetWrapper; }

      ElementInfo argElement = childElements.get(0);
      DataType<XMLType> argType = wrapper.getUnwrappedOutputType();
      Object child = response;
      child = mediator.mediate(response, sourceType.getLogical(), argType, context.getMetadata());
      targetWrapperHandler.setChild(targetWrapper, 0, argElement, child);
      return targetWrapper;
      } else if (sourceWrapped && (!targetWrapped)) {
      // Wrapped to Unwrapped
      Object sourceWrapper = response;
      List<ElementInfo> childElements = sourceOp.getWrapper().getOutputChildElements();
      if (childElements.isEmpty())

      { // The void output if (sourceWrapper instanceof OMElement) ((OMElement)sourceWrapper).getXMLStreamReader().close(); return null; }

      Attachments

        Activity

          People

            rfeng Zhaohui Feng
            lou.amodeo@gmail.com Lou Amodeo
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: