You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Simon Laws (JIRA)" <de...@tuscany.apache.org> on 2011/09/14 10:26:09 UTC

[jira] [Updated] (TUSCANY-3791) Concurrent access to a DOM Node can result in and NPE

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

Simon Laws updated TUSCANY-3791:
--------------------------------

      Description: 
There are some cases where a DOM node is accessed without synchronization, for example,

public class Node2JAXB extends BaseTransformer<Node, Object> implements PullTransformer<Node, Object> {
    private JAXBContextHelper contextHelper;
    
    public Node2JAXB(ExtensionPointRegistry registry) {
        contextHelper = JAXBContextHelper.getInstance(registry);
    }

    public Object transform(Node source, TransformationContext context) {
        if (source == null)
            return null;
        try {
            JAXBContext jaxbContext = contextHelper.createJAXBContext(context, false);
            Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
            Object result = unmarshaller.unmarshal(source, JAXBContextHelper.getJavaType(context.getTargetDataType()));
            return JAXBContextHelper.createReturnValue(jaxbContext, context.getTargetDataType(), result);
        } catch (Exception e) {
            throw new TransformationException(e);
        }
    }

This is exacerbated in the properties case because the property factories don't cache the results of this transformation. 

  was:
There are some cases where a DOM node is accessed without serialization, for example,

public class Node2JAXB extends BaseTransformer<Node, Object> implements PullTransformer<Node, Object> {
    private JAXBContextHelper contextHelper;
    
    public Node2JAXB(ExtensionPointRegistry registry) {
        contextHelper = JAXBContextHelper.getInstance(registry);
    }

    public Object transform(Node source, TransformationContext context) {
        if (source == null)
            return null;
        try {
            JAXBContext jaxbContext = contextHelper.createJAXBContext(context, false);
            Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
            Object result = unmarshaller.unmarshal(source, JAXBContextHelper.getJavaType(context.getTargetDataType()));
            return JAXBContextHelper.createReturnValue(jaxbContext, context.getTargetDataType(), result);
        } catch (Exception e) {
            throw new TransformationException(e);
        }
    }

This is exacerbated in the properties case because the property factories don't cache the results of this transformation. 

    Fix Version/s:     (was: Java-SCA-2.x)
                   Java-SCA-2.0

Correct serialization to be synchronization in description and change target

> Concurrent access to a DOM Node can result in and NPE
> -----------------------------------------------------
>
>                 Key: TUSCANY-3791
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-3791
>             Project: Tuscany
>          Issue Type: Bug
>          Components: SCA Java Runtime
>         Environment: All
>            Reporter: Simon Laws
>             Fix For: Java-SCA-2.0
>
>
> There are some cases where a DOM node is accessed without synchronization, for example,
> public class Node2JAXB extends BaseTransformer<Node, Object> implements PullTransformer<Node, Object> {
>     private JAXBContextHelper contextHelper;
>     
>     public Node2JAXB(ExtensionPointRegistry registry) {
>         contextHelper = JAXBContextHelper.getInstance(registry);
>     }
>     public Object transform(Node source, TransformationContext context) {
>         if (source == null)
>             return null;
>         try {
>             JAXBContext jaxbContext = contextHelper.createJAXBContext(context, false);
>             Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
>             Object result = unmarshaller.unmarshal(source, JAXBContextHelper.getJavaType(context.getTargetDataType()));
>             return JAXBContextHelper.createReturnValue(jaxbContext, context.getTargetDataType(), result);
>         } catch (Exception e) {
>             throw new TransformationException(e);
>         }
>     }
> This is exacerbated in the properties case because the property factories don't cache the results of this transformation. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira