tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 53526] New: .ConnectionPool.terminateTransaction unsafe == check of Boolean
Date Mon, 09 Jul 2012 20:08:39 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=53526

          Priority: P2
            Bug ID: 53526
          Assignee: dev@tomcat.apache.org
           Summary: .ConnectionPool.terminateTransaction unsafe == check
                    of Boolean
          Severity: normal
    Classification: Unclassified
                OS: Windows XP
          Reporter: sebb@apache.org
          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: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message