Bug 8346 - TransactionTagSupport has several issues. See description for more details.
Summary: TransactionTagSupport has several issues. See description for more details.
Status: CLOSED FIXED
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
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-04-21 17:36 UTC by Ryan Lubke
Modified: 2004-11-16 19:05 UTC (History)
1 user (show)



Attachments
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) **
 a. 
      if(test1) {
        //do
      }
      if (test2) {
        //do
      }
      if (test3) {
        //do
      } else {
        Exception
      }

    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
Fixed.