[pgjdbc/pgjdbc] cea523: fix: NPE inPGXAConnection$ConnectionHandler.invok... - Mailing list pgsql-jdbc

From Craig Ringer
Subject [pgjdbc/pgjdbc] cea523: fix: NPE inPGXAConnection$ConnectionHandler.invok...
Date
Msg-id 5c0ba08c18c2c_7e872b13463a45747716@hookshot-fe-88eb02d.cp1-iad.github.net.mail
Whole thread Raw
List pgsql-jdbc
Branch: refs/heads/master
  Home:   https://github.com/pgjdbc/pgjdbc
  Commit: cea5231ba794c362cbd5285b299ba3f82ad29e73
      https://github.com/pgjdbc/pgjdbc/commit/cea5231ba794c362cbd5285b299ba3f82ad29e73
  Author: Craig Ringer <craig@2ndquadrant.com>
  Date:   2018-12-08 (Sat, 08 Dec 2018)

  Changed paths:
    M pgjdbc/src/main/java/org/postgresql/xa/PGXAConnection.java
    M pgjdbc/src/test/java/org/postgresql/test/xa/XADataSourceTest.java

  Log Message:
  -----------
  fix: NPE in PGXAConnection$ConnectionHandler.invoke() of .equals(null) (#1365)

The PGXAConnection inner class call-filtering proxy ConnectionHandler
special cases calls to equals() by testing if the argument is itself
a proxy that should be unwrapped.

However it fails to test if the argument is null before calling getClass()
on it, resulting in an NPE like

    java.lang.NullPointerException: null
    at org.postgresql.xa.PGXAConnection$ConnectionHandler.invoke(PGXAConnection.java:139)

Fix by testing for null. While we're at it, also defensively check to ensure
there's exactly one argument to .equals. It's not sensible to pass more and
will error later anyway.



      **NOTE:** This service has been marked for deprecation:
https://developer.github.com/changes/2018-04-25-github-services-deprecation/

      Functionality will be removed from GitHub.com on January 31st, 2019.

pgsql-jdbc by date:

Previous
From: Vladimir Sitnikov
Date:
Subject: [pgjdbc/pgjdbc] cdfd49: chore: use openjdk7 to boostrap Travis CIimages f...
Next
From: Dave Cramer
Date:
Subject: [pgjdbc/pgjdbc] 467855: Update pull_request_template.md