Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-1998

JDBC 4 isWrapper() and unWrap() methods allow unwrapping to Derby implementation classes.

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.2.1.6
    • Fix Version/s: None
    • Component/s: JDBC
    • Urgency:
      Normal

      Description

      I do not believe that the unwrapping mechanism of JDBC 4 should allow or encourage unwrapping a JDBC 4 object as one of Derby's pribvate implementation types.

      Since Derby does not wrap objects in any way I would say there is a stong case for saying that the isWrapper() method should always return false and the unWrap() method always throw an exception.

      For example in EmbedStatement40 this code will allow "unwrapping" to
      EmbedStatement40, EmbedStatement, EngineStatement, ConnectionChild, Object, Statement

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

      { checkStatus(); return interfaces.isInstance(this); }

      public <T> T unwrap(java.lang.Class<T> interfaces)
      throws SQLException{
      checkStatus();
      try

      { return interfaces.cast(this); }

      catch (ClassCastException cce)

      { throw newSQLException(SQLState.UNABLE_TO_UNWRAP,interfaces); }

      }

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              djd Daniel John Debrunner
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: