[ 
https://issues.apache.org/jira/browse/TUSCANY-1677?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Raymond Feng resolved TUSCANY-1677.
-----------------------------------

    Resolution: Fixed

Fixed in a slightly different way.

> XML Parser not being closed with void return types causing memory leaks  
> -------------------------------------------------------------------------
>
>                 Key: TUSCANY-1677
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1677
>             Project: Tuscany
>          Issue Type: Bug
>            Reporter: Lou Amodeo
>            Assignee: Raymond Feng
>             Fix For: Java-SCA-1.0
>
>         Attachments: Output2OutputTransformer.java
>
>
> 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;
>                 }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to