From 2c5b19111b7ab9bca45f4f5797a6834d3b7d136d Mon Sep 17 00:00:00 2001 From: Martin Ritchie Date: Fri, 6 Mar 2009 12:30:58 +0000 Subject: QPID-1634 : FileQueueBackingStore had two issues. Delete wasn't using the getFileHandle() method so it was attempting to delete a bin rather than the message data. Our Broker Unit tests don't create the right type of ByteBuffer so whilst they passed the buffer.getData().array() failed as array() is not supported in the ByteBuffer types we actually use at runtime. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@750876 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/qpid/server/queue/FileQueueBackingStore.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'qpid/java') diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/FileQueueBackingStore.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/FileQueueBackingStore.java index bce06fad14..7c83788883 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/FileQueueBackingStore.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/FileQueueBackingStore.java @@ -226,13 +226,16 @@ public class FileQueueBackingStore implements QueueBackingStore for (int index = 0; index < bodyCount; index++) { ContentChunk chunk = message.getContentChunk(index); - chunk.reduceToFit(); + int length = chunk.getSize(); - byte[] chunkData = chunk.getData().array(); + byte[] chunk_underlying = new byte[length]; + + ByteBuffer chunk_buf = chunk.getData(); + + chunk_buf.duplicate().rewind().get(chunk_underlying); - int length = chunk.getSize(); writer.writeInt(length); - writer.write(chunkData, 0, length); + writer.write(chunk_underlying, 0, length); } } catch (FileNotFoundException e) @@ -301,9 +304,8 @@ public class FileQueueBackingStore implements QueueBackingStore } public void delete(Long messageId) - { - String id = String.valueOf(messageId); - File handle = new File(_flowToDiskLocation, id); + { + File handle = getFileHandle(messageId); if (handle.exists()) { -- cgit v1.2.1