Commit 6ddc4325 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gaston

Modified #invokeInterceptors to be more error proof.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@1242 b35dd754-fafc-0310-a699-88a17e54d16e
parent b728c241
......@@ -12,6 +12,7 @@
package org.jivesoftware.messenger.interceptor;
import org.jivesoftware.messenger.Session;
import org.jivesoftware.util.Log;
import org.xmpp.packet.Packet;
import java.util.*;
......@@ -171,16 +172,34 @@ public class InterceptorManager {
throws PacketRejectedException {
// Invoke the global interceptors for this packet
for (PacketInterceptor interceptor : globalInterceptors) {
try {
interceptor.interceptPacket(packet, session, read, processed);
}
catch (PacketRejectedException e) {
// Throw this exception since we don't really want to catch it
throw e;
}
catch (Exception e) {
Log.error("Error in interceptor", e);
}
}
// Invoke the interceptors that are related to the address of the session
String username = session.getAddress().getNode();
if (username != null) {
Collection<PacketInterceptor> userInterceptors = usersInterceptors.get(username);
if (userInterceptors != null && !userInterceptors.isEmpty()) {
for (PacketInterceptor interceptor : userInterceptors) {
try {
interceptor.interceptPacket(packet, session, read, processed);
}
catch (PacketRejectedException e) {
// Throw this exception since we don't really want to catch it
throw e;
}
catch (Exception e) {
Log.error("Error in interceptor", e);
}
}
}
}
}
......
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