ARTEMIS-976: PostgresSequentialSequentialFileDriver SQLProvider NPE fix
(cherry picked from commit fc70f9414a
)
This commit is contained in:
parent
f082185d7f
commit
6d0f28291f
|
@ -44,8 +44,7 @@ class JDBCFileUtils {
|
||||||
static JDBCSequentialFileFactoryDriver getDBFileDriver(DataSource dataSource, SQLProvider provider) throws SQLException {
|
static JDBCSequentialFileFactoryDriver getDBFileDriver(DataSource dataSource, SQLProvider provider) throws SQLException {
|
||||||
JDBCSequentialFileFactoryDriver dbDriver;
|
JDBCSequentialFileFactoryDriver dbDriver;
|
||||||
if (provider instanceof PostgresSQLProvider) {
|
if (provider instanceof PostgresSQLProvider) {
|
||||||
dbDriver = new PostgresSequentialSequentialFileDriver();
|
dbDriver = new PostgresSequentialSequentialFileDriver(dataSource, provider);
|
||||||
dbDriver.setDataSource(dataSource);
|
|
||||||
} else {
|
} else {
|
||||||
dbDriver = new JDBCSequentialFileFactoryDriver(dataSource, provider);
|
dbDriver = new JDBCSequentialFileFactoryDriver(dataSource, provider);
|
||||||
}
|
}
|
||||||
|
@ -55,7 +54,7 @@ class JDBCFileUtils {
|
||||||
static JDBCSequentialFileFactoryDriver getDBFileDriver(Connection connection, SQLProvider provider) throws SQLException {
|
static JDBCSequentialFileFactoryDriver getDBFileDriver(Connection connection, SQLProvider provider) throws SQLException {
|
||||||
JDBCSequentialFileFactoryDriver dbDriver;
|
JDBCSequentialFileFactoryDriver dbDriver;
|
||||||
if (provider instanceof PostgresSQLProvider) {
|
if (provider instanceof PostgresSQLProvider) {
|
||||||
dbDriver = new PostgresSequentialSequentialFileDriver();
|
dbDriver = new PostgresSequentialSequentialFileDriver(connection, provider);
|
||||||
dbDriver.setConnection(connection);
|
dbDriver.setConnection(connection);
|
||||||
} else {
|
} else {
|
||||||
dbDriver = new JDBCSequentialFileFactoryDriver(connection, provider);
|
dbDriver = new JDBCSequentialFileFactoryDriver(connection, provider);
|
||||||
|
|
|
@ -17,14 +17,18 @@
|
||||||
package org.apache.activemq.artemis.jdbc.store.file;
|
package org.apache.activemq.artemis.jdbc.store.file;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.sql.Connection;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
|
|
||||||
|
import org.apache.activemq.artemis.jdbc.store.sql.SQLProvider;
|
||||||
import org.postgresql.PGConnection;
|
import org.postgresql.PGConnection;
|
||||||
import org.postgresql.largeobject.LargeObject;
|
import org.postgresql.largeobject.LargeObject;
|
||||||
import org.postgresql.largeobject.LargeObjectManager;
|
import org.postgresql.largeobject.LargeObjectManager;
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
@SuppressWarnings("SynchronizeOnNonFinalField")
|
@SuppressWarnings("SynchronizeOnNonFinalField")
|
||||||
public final class PostgresSequentialSequentialFileDriver extends JDBCSequentialFileFactoryDriver {
|
public final class PostgresSequentialSequentialFileDriver extends JDBCSequentialFileFactoryDriver {
|
||||||
|
|
||||||
|
@ -34,6 +38,18 @@ public final class PostgresSequentialSequentialFileDriver extends JDBCSequential
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PostgresSequentialSequentialFileDriver(DataSource dataSource, SQLProvider provider) {
|
||||||
|
super();
|
||||||
|
this.setDataSource(dataSource);
|
||||||
|
this.setSqlProvider(provider);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PostgresSequentialSequentialFileDriver(Connection connection, SQLProvider provider) {
|
||||||
|
super();
|
||||||
|
this.setConnection(connection);
|
||||||
|
this.setSqlProvider(provider);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void prepareStatements() throws SQLException {
|
protected void prepareStatements() throws SQLException {
|
||||||
this.deleteFile = connection.prepareStatement(sqlProvider.getDeleteFileSQL());
|
this.deleteFile = connection.prepareStatement(sqlProvider.getDeleteFileSQL());
|
||||||
|
|
Loading…
Reference in New Issue