summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Ritchie <ritchiem@apache.org>2009-03-06 12:30:58 +0000
committerMartin Ritchie <ritchiem@apache.org>2009-03-06 12:30:58 +0000
commit87beda537fdf425b8cc8f0a6c8e4273742f0b3a2 (patch)
tree7e80de43441ee495a447788f067c10b3504afdc4
parent7d72d608659fc8b77f0eb0410500c3072b8f3ba1 (diff)
downloadqpid-python-87beda537fdf425b8cc8f0a6c8e4273742f0b3a2.tar.gz
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
-rw-r--r--java/broker/src/main/java/org/apache/qpid/server/queue/FileQueueBackingStore.java16
1 files changed, 9 insertions, 7 deletions
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())
{