Uploaded image for project: 'Commons DBCP'
  1. Commons DBCP
  2. DBCP-347

DelegatingStatement class has incomplete isWrapperFor method

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.3.1, 1.4.1, 1.5.1, 2.0
    • Labels:
      None
    • Environment:

      Windows 7. java version "1.6.0_21". Dell Latitude E6410.

      Description

      Currently org.apache.commons.dbcp.DelegatingStatement#isWrapperFor checks only if:

      1. Requested class is assignable from the DelegatingStatement instance: iface.isAssignableFrom(getClass())
      2. Wrapped object is a wrapper for the requested class: _stmt.isWrapperFor(iface)

      I think there should be another option checked i.e. requested class is assignable from the wrapped object's class. For example: iface.isAssignableFrom(_stmt.getClass())
      This is especially that in fact unwrap method properly assumes this possiblity i.e.: return iface.cast(_stmt);

      The whole method should be:

      public boolean isWrapperFor(Class<?> iface) throws SQLException

      { return iface.isAssignableFrom(getClass()) || iface.isAssignableFrom(_stmt.getClass()) || _stmt.isWrapperFor(iface); }

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              rposcro Robert Poskrobek
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified