You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2015/10/25 19:45:54 UTC

[Bug 58533] New: DelegatingConnection should propagate SQLException (not return null)

https://bz.apache.org/bugzilla/show_bug.cgi?id=58533

            Bug ID: 58533
           Summary: DelegatingConnection should propagate SQLException
                    (not return null)
           Product: Tomcat 8
           Version: trunk
          Hardware: PC
                OS: Mac OS X 10.1
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: anthony@whitford.com

I noticed code in org.apache.tomcat.dbcp.dbcp2.DelegatingConnection like:

    @Override
    public PreparedStatement prepareStatement(String sql) throws SQLException {
        checkOpen();
        try {
            DelegatingPreparedStatement dps = new DelegatingPreparedStatement(
                    this, _conn.prepareStatement(sql));
            initializeStatement(dps);
            return dps;
        }
        catch (SQLException e) {
            handleException(e);
            return null;
        }
    }

If there is a SQLException, I would expect that that gets propagated (just like
the signature suggests), not get a null.  I think this violates the spec.

This issue exists for 2 prepareStatement and 2 prepareCall implementations.

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


[Bug 58533] DelegatingConnection should propagate SQLException (not return null)

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58533

Konstantin Kolinko <kn...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED

--- Comment #1 from Konstantin Kolinko <kn...@gmail.com> ---
1. These classes are copied from Apache Commons DBCP project.

If there is a bug in them, it needs to be reported (and fixed) in that project
first.

http://tomcat.apache.org/bugreport.html#Third_party_components

2. The handleException(e); method called in that fragment of code rethrows the
exception. So the behaviour is already as you are expecting it.

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