Revision 2030 org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/BaseListenerSupport.java

View differences:

BaseListenerSupport.java
3 3
import java.util.EventListener;
4 4
import java.util.HashSet;
5 5
import java.util.Set;
6
import org.slf4j.Logger;
7
import org.slf4j.LoggerFactory;
6 8

  
7 9
public class BaseListenerSupport {
10

  
11
    protected static final Logger LOGGER = LoggerFactory.getLogger(BaseListenerSupport.class);
8 12
    
9 13
    public interface NotificationListener extends EventListener {
10 14
        public void notify(EventListener event);
......
35 39
    public void notifyEvent(EventListener event) {
36 40
        for (EventListener listener : this.listeners) {
37 41
            if( listener instanceof NotificationListener ) {
38
                ((NotificationListener)listener).notify(event);
42
                try {
43
                    ((NotificationListener)listener).notify(event);
44
                } catch(Throwable th) {
45
                    LOGGER.warn("Problems notifying "+(event==null? "NULL":event.getClass().getSimpleName())+" to "+listener.getClass().getSimpleName());
46
                }
39 47
            }
40 48
        }
41 49
    }

Also available in: Unified diff