[
https://issues.apache.org/jira/browse/ARTEMIS-1636?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Justin Bertram resolved ARTEMIS-1636.
-------------------------------------
Assignee: Justin Bertram
Resolution: Invalid
As far as I can tell there are proper {{null}} checks everywhere.
> Coverity: Null pointer dereferences (FORWARD_NULL) in
> JournalStorageManager.java
> ---------------------------------------------------------------------------------
>
> Key: ARTEMIS-1636
> URL: https://issues.apache.org/jira/browse/ARTEMIS-1636
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Components: Broker
> Affects Versions: 2.5.0
> Reporter: Jiri Daněk
> Assignee: Justin Bertram
> Priority: Major
>
> There are multiple versions of the JournalStorageManager constructor.
> The first overload is being called only from test code, as far as I can tell.
> {noformat}
> public JournalStorageManager(final Configuration config,
> final CriticalAnalyzer analyzer,
> final ExecutorFactory executorFactory,
> final ScheduledExecutorService
> scheduledExecutorService,
> final ExecutorFactory ioExecutors) {
> this(config, analyzer, executorFactory, scheduledExecutorService,
> ioExecutors, null);
> }
> {noformat}
> This second overload is being called also from {{XmlDataExporter#process}}
> {noformat}
> public JournalStorageManager(final Configuration config, CriticalAnalyzer
> analyzer, final ExecutorFactory executorFactory, final ExecutorFactory
> ioExecutors) {
> this(config, analyzer, executorFactory, null, ioExecutors, null);
> }
> {noformat}
> The problem with the second one is, according to Coverity
> {noformat}
> ** CID 1464350: Null pointer dereferences (FORWARD_NULL)
> ________________________________________________________________________________________________________
> *** CID 1464350: Null pointer dereferences (FORWARD_NULL)
> /activemq-artemis/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/JournalStorageManager.java:
> 97 in
> org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager.<init>(org.apache.activemq.artemis.core.config.Configuration,
> org.apache.activemq.artemis.utils.critical.CriticalAnalyzer,
> org.apache.activemq.artemis.utils.ExecutorFactory,
> org.apache.activemq.artemis.utils.ExecutorFactory)()
> 91 final ScheduledExecutorService
> scheduledExecutorService,
> 92 final ExecutorFactory ioExecutors) {
> 93 this(config, analyzer, executorFactory,
> scheduledExecutorService, ioExecutors, null);
> 94 }
> 95
> 96 public JournalStorageManager(final Configuration config,
> CriticalAnalyzer analyzer, final ExecutorFactory executorFactory, final
> ExecutorFactory ioExecutors) {
> >>> CID 1464350: Null pointer dereferences (FORWARD_NULL)
> >>> Passing "null" to "JournalStorageManager", which dereferences it.
> 97 this(config, analyzer, executorFactory, null, ioExecutors, null);
> 98 }
> 99
> 100 public JournalStorageManager(final Configuration config,
> 101 final CriticalAnalyzer analyzer,
> 102 final ExecutorFactory executorFactory,
> {noformat}
> because in {{AbstractJournalStorageManager.java}} constructor, this happens
> {noformat}
> 1. deref_parm_in_call: Function init dereferences criticalErrorListener. (The
> virtual call resolves to
> org.apache.activemq.artemis.core.persistence.impl.journal.JDBCJournalStorageManager.init.)
> [show details]
> 226 init(config, criticalErrorListener);
> {noformat}
> and in the {{#init}} method
> {noformat}
> 59 protected synchronized void init(Configuration config,
> IOCriticalErrorListener criticalErrorListener) {
> 60 try {
> 61 final DatabaseStorageConfiguration dbConf =
> (DatabaseStorageConfiguration) config.getStoreConfiguration();
> 62 final JDBCJournalImpl bindingsJournal;
> 63 final JDBCJournalImpl messageJournal;
> 64 final JDBCSequentialFileFactory largeMessagesFactory;
> 1. Condition dbConf.getDataSource() != null, taking true branch.
> 65 if (dbConf.getDataSource() != null) {
> 66 SQLProvider.Factory sqlProviderFactory =
> dbConf.getSqlProviderFactory();
> 2. Condition sqlProviderFactory == null, taking true branch.
> 67 if (sqlProviderFactory == null) {
> 68 sqlProviderFactory = new
> PropertySQLProvider.Factory(dbConf.getDataSource());
> 69 }
> 70 bindingsJournal = new JDBCJournalImpl(dbConf.getDataSource(),
> sqlProviderFactory.create(dbConf.getBindingsTableName(),
> SQLProvider.DatabaseStoreType.BINDINGS_JOURNAL),
> dbConf.getBindingsTableName(), scheduledExecutorService,
> executorFactory.getExecutor(), criticalErrorListener);
> 71 messageJournal = new JDBCJournalImpl(dbConf.getDataSource(),
> sqlProviderFactory.create(dbConf.getMessageTableName(),
> SQLProvider.DatabaseStoreType.MESSAGE_JOURNAL), dbConf.getMessageTableName(),
> scheduledExecutorService, executorFactory.getExecutor(),
> criticalErrorListener);
> 3. deref_parm_in_call: Function JDBCSequentialFileFactory dereferences
> criticalErrorListener. [show details]
> 72 largeMessagesFactory = new
> JDBCSequentialFileFactory(dbConf.getDataSource(),
> sqlProviderFactory.create(dbConf.getLargeMessageTableName(),
> SQLProvider.DatabaseStoreType.LARGE_MESSAGE), executorFactory.getExecutor(),
> criticalErrorListener);
> 73 } else {
> {noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)