Commit 444f6fed authored by Guus der Kinderen's avatar Guus der Kinderen

The compare() result of Deliverable was based on a field value that is never...

The compare() result of Deliverable was based on a field value that is never set. As a result, the compare() method will have non-specific behavior. It is likely not used at all (or if it is, a bug is looming somewhere). Removing it is the safest course of action.
parent 74ed3b77
......@@ -1164,10 +1164,9 @@ public class HttpSession extends LocalClientSession {
}
}
private class Deliverable implements Comparable<Deliverable> {
private class Deliverable {
private final String text;
private final Collection<String> packets;
private long requestID;
public Deliverable(String text) {
this.text = text;
......@@ -1180,22 +1179,13 @@ public class HttpSession extends LocalClientSession {
for (Packet packet : elements) {
// Rewrite packet namespace according XEP-0206
if (packet instanceof Presence) {
final StringBuilder sb = new StringBuilder();
sb.append("<presence xmlns=\"jabber:client\"");
sb.append(packet.toXML().substring(9));
this.packets.add(sb.toString());
this.packets.add("<presence xmlns=\"jabber:client\"" + packet.toXML().substring(9));
}
else if (packet instanceof IQ) {
final StringBuilder sb = new StringBuilder();
sb.append("<iq xmlns=\"jabber:client\"");
sb.append(packet.toXML().substring(3));
this.packets.add(sb.toString());
this.packets.add("<iq xmlns=\"jabber:client\"" + packet.toXML().substring(3));
}
else if (packet instanceof Message) {
final StringBuilder sb = new StringBuilder();
sb.append("<message xmlns=\"jabber:client\"");
sb.append(packet.toXML().substring(8));
this.packets.add(sb.toString());
this.packets.add("<message xmlns=\"jabber:client\"" + packet.toXML().substring(8));
}
else {
this.packets.add(packet.toXML());
......@@ -1216,14 +1206,6 @@ public class HttpSession extends LocalClientSession {
}
}
public void setRequestID(long requestID) {
this.requestID = requestID;
}
public long getRequestID() {
return requestID;
}
public Collection<Packet> getPackets() {
// Check if the Deliverable is about Packets or raw XML
if (packets == null) {
......@@ -1255,10 +1237,6 @@ public class HttpSession extends LocalClientSession {
}
return answer;
}
public int compareTo(Deliverable o) {
return (int) (o.getRequestID() - requestID);
}
}
private class Delivered {
......
Markdown is supported
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