impossibl / pgjdbc-ng

A new JDBC driver for PostgreSQL aimed at supporting the advanced features of JDBC and Postgres
https://impossibl.github.io/pgjdbc-ng
Other
596 stars 108 forks source link

Endlessly recursive error handling (0.8.9) #569

Open powczarek22 opened 2 years ago

powczarek22 commented 2 years ago

https://github.com/impossibl/pgjdbc-ng/blob/develop/driver/src/main/java/com/impossibl/postgres/jdbc/ErrorUtils.java

Pass an instance of NoticeException and it loops until stack overflow

public static SQLException makeSQLException(String message, Exception cause) {

    if (cause instanceof SQLException) {
      return (SQLException) cause;
    }

    if (cause instanceof NoticeException) {
      return makeSQLException(message, cause);
    }

    return new PGSQLSimpleException(message, cause);
  }