From 229ca6afd760dd57219ce75b1a51216a656da549 Mon Sep 17 00:00:00 2001 From: Robert Davies Date: Thu, 1 Nov 2007 22:42:33 +0000 Subject: [PATCH] Fix for https://issues.apache.org/activemq/browse/AMQ-1246 git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@591160 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/activemq/kaha/impl/index/hash/HashPage.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/hash/HashPage.java b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/hash/HashPage.java index 5d24f978de..a165147fa0 100644 --- a/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/hash/HashPage.java +++ b/activemq-core/src/main/java/org/apache/activemq/kaha/impl/index/hash/HashPage.java @@ -40,6 +40,7 @@ class HashPage { private int binId; private int persistedSize; private List hashIndexEntries; + private static final HashEntry nullEntry = new HashEntry(); /* * for persistence only */ @@ -192,6 +193,11 @@ class HashPage { void addHashEntry(int index, HashEntry entry) throws IOException { // index = index >= 0 ? index : 0; // index = (index == 0 || index< size()) ? index : size()-1; + if (index > hashIndexEntries.size()) { + for (int i = hashIndexEntries.size(); i < (index+1);i++) { + hashIndexEntries.add(nullEntry); + } + } hashIndexEntries.add(index, entry); }