You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Raymond Feng (JIRA)" <tu...@ws.apache.org> on 2007/09/13 19:01:45 UTC

[jira] Resolved: (TUSCANY-1677) XML Parser not being closed with void return types causing memory leaks

     [ 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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org