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
commit2c5b19111b7ab9bca45f4f5797a6834d3b7d136d (patch)
tree45c3513a0c03a8fa2c8a80defa573a87cf57a5f7
parentba042a2ceb03fb1edb2dab8273070c07af63bacd (diff)
downloadqpid-python-2c5b19111b7ab9bca45f4f5797a6834d3b7d136d.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@750876 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/queue/FileQueueBackingStore.java16
1 files changed, 9 insertions, 7 deletions
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())
{