Return-Path: X-Original-To: apmail-aries-dev-archive@www.apache.org Delivered-To: apmail-aries-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6AD03184CA for ; Mon, 15 Feb 2016 18:23:18 +0000 (UTC) Received: (qmail 54219 invoked by uid 500); 15 Feb 2016 18:23:18 -0000 Delivered-To: apmail-aries-dev-archive@aries.apache.org Received: (qmail 54164 invoked by uid 500); 15 Feb 2016 18:23:18 -0000 Mailing-List: contact dev-help@aries.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@aries.apache.org Delivered-To: mailing list dev@aries.apache.org Received: (qmail 54129 invoked by uid 99); 15 Feb 2016 18:23:18 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Feb 2016 18:23:18 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 2254B2C1F57 for ; Mon, 15 Feb 2016 18:23:18 +0000 (UTC) Date: Mon, 15 Feb 2016 18:23:18 +0000 (UTC) From: "Matthew Pitts (JIRA)" To: dev@aries.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (ARIES-1497) jpa-support XAJpaTemplate does not properly handle RollbackException MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/ARIES-1497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15147673#comment-15147673 ] Matthew Pitts commented on ARIES-1497: -------------------------------------- I did not make any changes to ResourceLocalJpaTemplate. Since it uses the EntityManager TX methods directly, it would see the javax.persistence.RollbackException I believe, which is a RuntimeException. It may need updating to deal with that situation unless EntityManager.getTransaction().rollback() can be called after a RollbackException. > jpa-support XAJpaTemplate does not properly handle RollbackException > -------------------------------------------------------------------- > > Key: ARIES-1497 > URL: https://issues.apache.org/jira/browse/ARIES-1497 > Project: Aries > Issue Type: Bug > Components: JPA > Affects Versions: jpa-2.3.0 > Reporter: Matthew Pitts > Attachments: jpa-support-RollbackException-handling.patch > > > There are a couple of problems addressed here: > 1. No checked exceptions ever reach the safeRollback method in XAJpaTemplate. This is due to the fact that safeFinish catches and wraps via wrapThrowable. This means that the shouldRollback logic will always (or almost always) be true, because no checked exceptions have the opportunity to bubble-up as-is from safeFinish. > 2. Because of the above problem, javax.transaction.RollbackException events are not properly handled since they result in another rollback attempt. > The proposed fix (and patch) is to allow RollbackExceptions to bubble up from safeFinish, thus allowing for their direct passing to safeRollback. Basically, because this is a checked exception, shouldRollback will be false during safeRollback handling, thus preventing a rollback attempt while this exception is propagating. Additionally, because safeRollback calls safeFinish which ultimately calls the corresponding TransactionAttribute.finish method, then the logic therein to issue a rollback in the event of STATUS_MARKED_ROLLBACK will be executed when this exception is propagating. Thus, no other special handling is really required. > Please validate and correct my statement of the problem and my fix. -- This message was sent by Atlassian JIRA (v6.3.4#6332)