Menu

#436 PostgreSQLOidDataType should unwrap PGConnection instead of casting to it.

v2.7.*
closed-fixed
None
2.7.3
5
2022-07-26
2020-07-17
No

PostgreSQLOidDataType casts statement.getConnection() to an instance of PGConnection. It should use statement.getConnection().unwrap(PGConnection.class) instead. The cast will fail if there are intermediate connection wrappers involved (such as DBCP2).
From:

LargeObjectManager lobj = ((org.postgresql.PGConnection)
    statement.getConnection()).getLargeObjectAPI();

To:

LargeObjectManager lobj = statement.getConnection().unwrap(org.postgresql.PGConnection.class)
                                               .getLargeObjectAPI();

Discussion

  • Jeff Jensen

    Jeff Jensen - 2021-10-30
    • status: open --> open-fixed
    • assigned_to: Jeff Jensen
    • Fixed Release: (not fixed) --> 2.7.3
     
  • Jeff Jensen

    Jeff Jensen - 2021-10-30

    Thank you for the report and fix.
    If you have a test for this, would greatly appreciate your contribution on that too.

     
  • Jeff Jensen

    Jeff Jensen - 2021-10-30
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB