aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthew Pitts (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (ARIES-1438) NPE in XAJpaTemplate#txExpr if Coordinator is null
Date Tue, 27 Oct 2015 12:06:27 GMT

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

Matthew Pitts updated ARIES-1438:
---------------------------------
    Description: 
XAJpaTemplate uses the following code to initialize the transaction and later calls Coordinator#end
in a finally block.

{code:java}
TransactionAttribute ta = TransactionAttribute.fromType(type);
Coordination coord = null;
try {
    tranToken = ta.begin(tm);
    coord = coordinator.begin(this.getClass().getName(), 0);
{code}

However, if the call to _ta.begin(tm)_ fails, then the _coord_ reference will be null, thus
provoking an NPE during the finally block. This will then suppress the original exception.

A null-check on _coord_ prior to the invocation of Coordinator#end should suffix to fix this,
but perhaps there's another problem here.

  was:
XAJpaTemplate uses the following code to initialize the transaction and later calls Coordinator#end
in a finally block.

{code:java}
TransactionAttribute ta = TransactionAttribute.fromType(type);
Coordination coord = null;
try {
    tranToken = ta.begin(tm);
    coord = coordinator.begin(this.getClass().getName(), 0);
{code}

However, if the call to {code}ta.begin(tm){code} fails, then the {i}coord{i} reference will
be null, thus provoking an NPE during the finally block. This will then suppress the original
exception.

A null-check on {i}coord{i} prior to the invocation of Coordinator#end should suffix to fix
this, but perhaps there's another problem here.


> NPE in XAJpaTemplate#txExpr if Coordinator is null
> --------------------------------------------------
>
>                 Key: ARIES-1438
>                 URL: https://issues.apache.org/jira/browse/ARIES-1438
>             Project: Aries
>          Issue Type: Bug
>          Components: JPA
>    Affects Versions: jpa-2.2.0
>            Reporter: Matthew Pitts
>
> XAJpaTemplate uses the following code to initialize the transaction and later calls Coordinator#end
in a finally block.
> {code:java}
> TransactionAttribute ta = TransactionAttribute.fromType(type);
> Coordination coord = null;
> try {
>     tranToken = ta.begin(tm);
>     coord = coordinator.begin(this.getClass().getName(), 0);
> {code}
> However, if the call to _ta.begin(tm)_ fails, then the _coord_ reference will be null,
thus provoking an NPE during the finally block. This will then suppress the original exception.
> A null-check on _coord_ prior to the invocation of Coordinator#end should suffix to fix
this, but perhaps there's another problem here.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message