You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling Connection.rollback(savepoint) or Connection.releaseSavepoint(savepoint) with a savepoint that was returned by Connection.setSavepoint() will fail with a ClassCastException.
Expected Behavior
No exception, instead the operation should succeed as it does when not using the wrapper library.
What plugins are used? What other connection properties were set?
None
Current Behavior
Exception in thread "main" java.lang.ClassCastException: class software.amazon.jdbc.wrapper.SavepointWrapper cannot be cast to class org.postgresql.jdbc.PSQLSavepoint (software.amazon.jdbc.wrapper.SavepointWrapper and org.postgresql.jdbc.PSQLSavepoint are in unnamed module of loader 'app')
at org.postgresql.jdbc.PgConnection.rollback(PgConnection.java:1809)
at software.amazon.jdbc.wrapper.ConnectionWrapper.lambda$rollback$39(ConnectionWrapper.java:678)
at software.amazon.jdbc.util.WrapperUtils.lambda$runWithPlugins$1(WrapperUtils.java:169)
at software.amazon.jdbc.plugin.DefaultConnectionPlugin.execute(DefaultConnectionPlugin.java:98)
at software.amazon.jdbc.ConnectionPluginManager.lambda$execute$3(ConnectionPluginManager.java:327)
at software.amazon.jdbc.ConnectionPluginManager.lambda$makePluginChainFunc$0(ConnectionPluginManager.java:267)
at software.amazon.jdbc.ConnectionPluginManager.executeWithSubscribedPlugins(ConnectionPluginManager.java:249)
at software.amazon.jdbc.ConnectionPluginManager.execute(ConnectionPluginManager.java:324)
at software.amazon.jdbc.util.WrapperUtils.executeWithPlugins(WrapperUtils.java:226)
at software.amazon.jdbc.util.WrapperUtils.runWithPlugins(WrapperUtils.java:162)
at software.amazon.jdbc.wrapper.ConnectionWrapper.rollback(ConnectionWrapper.java:672)
at AwsWrapperTest.main(AwsWrapperTest.java:9)
Reproduction Steps
Run code below, using your own values for the parameters to DriverManager.getConnection.
importjava.sql.*;
publicclassAwsWrapperTest {
publicstaticvoidmain(String[] args) throwsSQLException {
Connectionconnection = DriverManager.getConnection("jdbc:aws-wrapper:postgresql://localhost:49153/postgres", "username", "password");
connection.setAutoCommit(false);
Savepointsavepoint = connection.setSavepoint();
connection.rollback(savepoint);
// connection.releaseSavepoint(savepoint); // fails too when used instead of previous line
}
}
Describe the bug
Calling
Connection.rollback(savepoint)
orConnection.releaseSavepoint(savepoint)
with a savepoint that was returned byConnection.setSavepoint()
will fail with aClassCastException
.Expected Behavior
No exception, instead the operation should succeed as it does when not using the wrapper library.
What plugins are used? What other connection properties were set?
None
Current Behavior
Reproduction Steps
Run code below, using your own values for the parameters to
DriverManager.getConnection
.Possible Solution
No response
Additional Information/Context
PostgreSQL version 15.1.
PostgreSQL JDBC driver "org.postgresql:postgresql:42.5.2"
The AWS Advanced JDBC Driver version used
1.0.1
JDK version used
openjdk version "17.0.3" 2022-04-19 OpenJDK Runtime Environment Temurin-17.0.3+7 (build 17.0.3+7) OpenJDK 64-Bit Server VM Temurin-17.0.3+7 (build 17.0.3+7, mixed mode, sharing)
Operating System and version
Windows 11
The text was updated successfully, but these errors were encountered: