tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [Bug 53526] New: .ConnectionPool.terminateTransaction unsafe == check of Boolean
Date Mon, 09 Jul 2012 20:08:39 GMT

          Priority: P2
            Bug ID: 53526
           Summary: .ConnectionPool.terminateTransaction unsafe == check
                    of Boolean
          Severity: normal
    Classification: Unclassified
                OS: Windows XP
          Hardware: PC
            Status: NEW
           Version: unspecified
         Component: jdbc-pool
           Product: Tomcat Modules

The method ConnectionPool.terminateTransaction(PooledConnection con) uses == to
check the value of a Boolean, viz:

if (con.getPoolProperties().getDefaultAutoCommit()==Boolean.FALSE) {

This is not 100% safe - if the user sets the property as follows:

String value; // e.g. derived from property file
setDefaultAutoCommit(new Boolean(value));

then the condition will never be true, even if value="false".

Although it is better to use Boolean.valueOf(value), which would not have the
same problem, the code ought to work regardless.

You are receiving this mail because:
You are the assignee for the bug.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message