From 7ca00f304007ff8cc9d22ada3675bf5d8b259508 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knut=20Olav=20L=C3=B8ite?= Date: Wed, 1 May 2024 15:49:33 +0200 Subject: [PATCH] fix: ClassCastException in Spring Data JDBC sample --- .../java/com/google/cloud/spanner/sample/JdbcConfiguration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/spring-data-jdbc/src/main/java/com/google/cloud/spanner/sample/JdbcConfiguration.java b/samples/spring-data-jdbc/src/main/java/com/google/cloud/spanner/sample/JdbcConfiguration.java index 2066647b5..a5c24adcd 100644 --- a/samples/spring-data-jdbc/src/main/java/com/google/cloud/spanner/sample/JdbcConfiguration.java +++ b/samples/spring-data-jdbc/src/main/java/com/google/cloud/spanner/sample/JdbcConfiguration.java @@ -64,7 +64,7 @@ public static boolean isCloudSpannerPG(JdbcOperations operations) { "The selected Cloud Spanner database does not use the PostgreSQL dialect"); } catch (DataAccessException exception) { if (exception.getCause() instanceof JdbcSqlException) { - JdbcSqlException jdbcSqlException = (JdbcSqlException) exception; + JdbcSqlException jdbcSqlException = (JdbcSqlException) exception.getCause(); if (jdbcSqlException.getCode() == Code.PERMISSION_DENIED || jdbcSqlException.getCode() == Code.NOT_FOUND) { throw new RuntimeException(