File tree Expand file tree Collapse file tree
main/java/org/buddycloud/channelserver/queue
test/java/org/buddycloud/channelserver/queue Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,18 +71,19 @@ private int getId() {
7171
7272 public void process (Packet packet ) throws ComponentException {
7373
74- logger .debug ("Packet payload " + packet .toXML () + " going to federation." );
74+ logger .debug ("Packet payload " + packet .toXML ()
75+ + " going to federation." );
7576
7677 String to = packet .getTo ().toString ();
77- String uniqueId = packet .getID ();
78-
79- if (true == performIdMapping (packet )) {
78+ String uniqueId = packet .getID ();
79+
80+ if (true == performIdMapping (packet )) {
8081
8182 uniqueId = generateUniqueId (packet );
8283 idMap .put (uniqueId , packet .getID ());
8384 packet .setID (uniqueId );
84- }
85-
85+ }
86+
8687 sentRemotePackets .put (uniqueId , packet .getFrom ());
8788 try {
8889 extractNodeDetails (packet );
@@ -123,7 +124,8 @@ private boolean performIdMapping(Packet packet) {
123124 return false ;
124125 }
125126 IQ iq = (IQ ) packet ;
126- if (true == iq .getType ().equals (IQ .Type .result )) {
127+ if ((true == iq .getType ().equals (IQ .Type .result ))
128+ || (true == iq .getType ().equals (IQ .Type .error ))) {
127129 return false ;
128130 }
129131 return true ;
Original file line number Diff line number Diff line change @@ -296,4 +296,26 @@ public void testIqResultPacketsDontGetIdMapped() throws Exception {
296296
297297 Assert .assertTrue (originalId .equals (packetExternal .getID ()));
298298 }
299+
300+
301+ @ Test
302+ public void testIqErrorPacketsDontGetIdMapped () throws Exception {
303+ channelsEngine .clear ();
304+
305+ String originalId = "id:12345" ;
306+ IQ packet = new IQ ();
307+ packet .setFrom (new JID ("romeo@montague.lit/street" ));
308+ packet .setTo (new JID ("topics.capulet.lit" ));
309+ packet .setType (IQ .Type .error );
310+ packet .setID (originalId );
311+ packet .getElement ().addAttribute ("remote-server-discover" , "false" );
312+
313+ queueManager .addChannelMap (new JID ("topics.capulet.lit" ));
314+
315+ queueManager .process (packet .createCopy ());
316+
317+ IQ packetExternal = (IQ ) channelsEngine .poll ();
318+
319+ Assert .assertTrue (originalId .equals (packetExternal .getID ()));
320+ }
299321}
You can’t perform that action at this time.
0 commit comments