Commit 8b220087 authored by Guillaume Surrel's avatar Guillaume Surrel
Browse files

Fix: The server now validates that the delivery-tag refers to a delivered message.

parent b367b363
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2008 - 2009 ScalAgent Distributed Technologies
* Copyright (C) 2008 - 2011 ScalAgent Distributed Technologies
* Copyright (C) 2008 - 2009 CNES
*
* This library is free software; you can redistribute it and/or
......@@ -417,7 +417,8 @@ public class Proxy implements DeliveryListener {
}
}
public void basicAck(long deliveryTag, boolean multiple, int channelNumber) {
public void basicAck(long deliveryTag, boolean multiple, int channelNumber)
throws PreconditionFailedException {
if (logger.isLoggable(BasicLevel.DEBUG))
logger.log(BasicLevel.DEBUG, "Proxy.basicAck(" + deliveryTag + ", " + channelNumber + ')');
......@@ -439,6 +440,7 @@ public class Proxy implements DeliveryListener {
return;
}
}
throw new PreconditionFailedException("Acknowledgement error: invalid tag.");
} else {
Map<QueueShell, List<Long>> deliveryMap = new HashMap<QueueShell, List<Long>>();
while (iter.hasNext()) {
......@@ -455,6 +457,9 @@ public class Proxy implements DeliveryListener {
break;
}
}
if (deliveryMap.size() == 0) {
throw new PreconditionFailedException("Acknowledgement error: invalid tag.");
}
Iterator<QueueShell> iterQueues = deliveryMap.keySet().iterator();
while (iterQueues.hasNext()) {
QueueShell queue = iterQueues.next();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment