From 87beda537fdf425b8cc8f0a6c8e4273742f0b3a2 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/qpid@750876 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/qpid/server/queue/FileQueueBackingStore.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'java') diff --git a/java/broker/src/main/java/org/apache/qpid/server/queue/FileQueueBackingStore.java b/java/broker/src/main/java/org/apache/qpid/server/queue/FileQueueBackingStore.java index bce06fad14..7c83788883 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/queue/FileQueueBackingStore.java +++ b/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