activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [activemq-artemis] branch master updated: ARTEMIS-2410 max-saved-replicated-journals-size=0 throws ArrayIndexOutOfBoundsException
Date Thu, 01 Aug 2019 16:54:35 GMT
This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/master by this push:
     new 51fdcca  ARTEMIS-2410 max-saved-replicated-journals-size=0 throws ArrayIndexOutOfBoundsException
     new d77edb8  This closes #2739
51fdcca is described below

commit 51fdcca4642ac495202934754f2a9664cd9a7b2e
Author: Shailendra Kumar Singh <shailendra14k@gmail.com>
AuthorDate: Thu Jul 4 12:18:11 2019 +0530

    ARTEMIS-2410 max-saved-replicated-journals-size=0 throws ArrayIndexOutOfBoundsException
---
 .../apache/activemq/artemis/core/server/files/FileMoveManager.java  | 6 +++---
 .../activemq/artemis/core/server/files/FileMoveManagerTest.java     | 6 +++++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/files/FileMoveManager.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/files/FileMoveManager.java
index 32587e5..f29e4a1 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/files/FileMoveManager.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/files/FileMoveManager.java
@@ -92,12 +92,10 @@ public class FileMoveManager {
          return;
       }
 
-      // Since we will create one folder, we are already taking that one into consideration
-      internalCheckOldFolders(1);
-
       int whereToMove = getMaxID() + 1;
 
       if (maxFolders == 0) {
+         internalCheckOldFolders(0);
          ActiveMQServerLogger.LOGGER.backupDeletingData(folder.getPath());
          for (String fileMove : files) {
             File fileFrom = new File(folder, fileMove);
@@ -105,6 +103,8 @@ public class FileMoveManager {
             deleteTree(fileFrom);
          }
       } else {
+         // Since we will create one folder, we are already taking that one into consideration
+         internalCheckOldFolders(1);
          File folderTo = getFolder(whereToMove);
          folderTo.mkdirs();
 
diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/files/FileMoveManagerTest.java
b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/files/FileMoveManagerTest.java
index bb062fc..20ff357 100644
--- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/files/FileMoveManagerTest.java
+++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/files/FileMoveManagerTest.java
@@ -272,17 +272,21 @@ public class FileMoveManagerTest {
             File folderF = new File(dataLocation, "folder" + f);
             folderF.mkdirs();
 
+            File replicaFolder = new File(dataLocation, FileMoveManager.PREFIX + f);
+            replicaFolder.mkdir();
+
             // FILES_PER_FOLDER + f, I'm just creating more files as f grows.
             // this is just to make each folder unique somehow
             for (int i = 0; i < FILES_PER_FOLDER + f; i++) {
                createFile(folderF, i);
+               createFile(replicaFolder, i);
             }
          }
 
          manager.doMove();
 
-         // We will always have maximum of 3 folders
          Assert.assertEquals(0, manager.getNumberOfFolders());
+         Assert.assertEquals(0, manager.getFiles().length);
       }
 
       Assert.assertEquals(0, manager.getMaxID());


Mime
View raw message