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 2010/11/18 10:48:13 UTC

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

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, Java-SCA-1.x


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. 

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


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

Posted by "Simon Laws (JIRA)" <de...@tuscany.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-3791?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Simon Laws reassigned TUSCANY-3791:
-----------------------------------

    Assignee: Simon Laws

> 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
>            Assignee: 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

        

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

Posted by "Simon Laws (JIRA)" <de...@tuscany.apache.org>.
     [ 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

        

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

Posted by "Simon Laws (JIRA)" <de...@tuscany.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-3791?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Simon Laws closed TUSCANY-3791.
-------------------------------

    Resolution: Fixed

Changes were made a while back but I neglected to close the issue

> 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
>            Assignee: 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