Skip to content

DataSourceUtils discards IllegalStateException stacktrace #28258

@OrangeDog

Description

@OrangeDog

throw new CannotGetJdbcConnectionException("Failed to obtain JDBC Connection: " + ex.getMessage());

I'm unsure why SQLException is retained as a cause but IllegalStateException is discarded. It makes things like this very hard to debug:

org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection: Session/EntityManager is closed
    at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:86)
    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:330)
    at org.springframework.boot.actuate.jdbc.DataSourceHealthIndicator.getProduct(DataSourceHealthIndicator.java:122)
    at org.springframework.boot.actuate.jdbc.DataSourceHealthIndicator.doDataSourceHealthCheck(DataSourceHealthIndicator.java:105)
    ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: dataIssues in data modules (jdbc, orm, oxm, tx)status: supersededAn issue that has been superseded by another

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions