Bug 8346 - TransactionTagSupport has several issues. See description for more details.
Summary: TransactionTagSupport has several issues. See description for more details.
Alias: None
Product: Taglibs
Classification: Unclassified
Component: Standard Taglib (show other bugs)
Version: unspecified
Hardware: All All
: P3 critical (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2002-04-21 17:36 UTC by Ryan Lubke
Modified: 2004-11-16 19:05 UTC (History)
1 user (show)

Proposed fix for the issues described in bug. (3.01 KB, patch)
2002-04-21 17:38 UTC, Ryan Lubke
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan Lubke 2002-04-21 17:36:36 UTC
Issue 1:

The current logic for setting the isolation level is flawed in two ways:
 ** setIsolationLevel(String isolation) **
      if(test1) {
      if (test2) {
      if (test3) {
      } else {

    With the above logic, an exception is thrown no matter what value
    is provided.

   b.  The expected values in the current block do not match the values
       defined in the spec, i.e.:

        if ("TRANSACTION_READ_COMMITTED".equals(isolation) {

2.  TransactionTagSupport.doStartTag()
    An int variable origIsolation is defined as an instance variable.
    The doStartTag() declares a local variable origIsolation and sets
    this variable with the original transaction isolation of the
    connection.  However, this value is lost due to its scope,
    so when doFinally() calls setTransactionIsolationLevel it does
    so with the instance variable's value (0) and causes an exception (
    which is swallowed). 

3.  TransactionTagSupport.doStartTag() and doFinally()

    The spec clearly states the following on page 10-138:
    "If the isolation attribute is specified, the current transaction
     isolation level is saved (so it can later be restored) and set to the
     specified level (using the Connection method setTransactionIsolation())."

    The current class has logic that if the current transaction isolation
    is the same as the user provided, it doesn't call setTransactionIsolation().
    This is true for doFinally() when it attempts to revert to the original
    transaction isolation.

    Perhaps this is a spec issue, but as it stands now, the current behavior
    is invalid.

I will attach a patch that has a fix for these issues.
Comment 1 Ryan Lubke 2002-04-21 17:38:16 UTC
Created attachment 1651 [details]
Proposed fix for the issues described in bug.
Comment 2 Jan Luehe 2002-04-24 17:50:42 UTC