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.