ARTEMIS-4302 NPE on JournalTransaction::forget
This commit is contained in:
parent
5553b6264c
commit
7c46b303b1
|
@ -79,6 +79,11 @@
|
|||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.activemq</groupId>
|
||||
<artifactId>artemis-unit-test-support</artifactId>
|
||||
|
|
|
@ -356,12 +356,13 @@ public class JournalTransaction {
|
|||
* Used by load, when the transaction was not loaded correctly
|
||||
*/
|
||||
public void forget() {
|
||||
// The transaction was not committed or rolled back in the file, so we
|
||||
// reverse any pos counts we added
|
||||
for (JournalFile jf : pendingFiles) {
|
||||
jf.decPosCount();
|
||||
if (pendingFiles != null) {
|
||||
// The transaction was not committed or rolled back in the file, so we
|
||||
// reverse any pos counts we added
|
||||
for (JournalFile jf : pendingFiles) {
|
||||
jf.decPosCount();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.activemq.artemis.core.journal.impl;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
public class JournalTransactionForget {
|
||||
@Test
|
||||
public void testForgetTX() {
|
||||
JournalTransaction transaction = new JournalTransaction(1, Mockito.mock(JournalRecordProvider.class));
|
||||
transaction.forget();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue