Author: elecharny Date: Thu Aug 6 22:59:42 2009 New Revision: 801833 URL: http://svn.apache.org/viewvc?rev=801833&view=rev Log: o A fix for DIRMINA-734 (reverted commit 787043) o This revert also fixed some issues in MdcFilterTests, so revert commit 798998 (some tests were ignored)
Modified: mina/trunk/core/src/main/java/org/apache/mina/filter/executor/ExecutorFilter.java mina/trunk/core/src/test/java/org/apache/mina/filter/logging/MdcInjectionFilterTest.java Modified: mina/trunk/core/src/main/java/org/apache/mina/filter/executor/ExecutorFilter.java URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/filter/executor/ExecutorFilter.java?rev=801833&r1=801832&r2=801833&view=diff ============================================================================== --- mina/trunk/core/src/main/java/org/apache/mina/filter/executor/ExecutorFilter.java (original) +++ mina/trunk/core/src/main/java/org/apache/mina/filter/executor/ExecutorFilter.java Thu Aug 6 22:59:42 2009 @@ -136,6 +136,15 @@ private static final boolean MANAGEABLE_EXECUTOR = true; private static final boolean NOT_MANAGEABLE_EXECUTOR = false; + /** A list of default EventTypes to be handled by the executor */ + private static IoEventType[] DEFAULT_EVENT_SET = new IoEventType[] { + IoEventType.EXCEPTION_CAUGHT, + IoEventType.MESSAGE_RECEIVED, + IoEventType.MESSAGE_SENT, + IoEventType.SESSION_CLOSED, + IoEventType.SESSION_IDLE, + IoEventType.SESSION_OPENED + }; /** * (Convenience constructor) Creates a new instance with a new @@ -521,31 +530,17 @@ */ private void initEventTypes(IoEventType... eventTypes) { if ((eventTypes == null) || (eventTypes.length == 0)) { - // Covers the case of a default initialization - IoEventType[] all = IoEventType.values(); - IoEventType[] tmpEventTypes = new IoEventType[all.length-1]; - int i=0; - - for (IoEventType type : all) { - if (type != IoEventType.SESSION_CREATED) { - tmpEventTypes[i] = type; - i++; - } - } - this.eventTypes = EnumSet.of(tmpEventTypes[0], tmpEventTypes); - } - else - { - // The constructor was called with a list of Events to be filtered - // Copy the list of handled events in the event set - this.eventTypes = EnumSet.of(eventTypes[0], eventTypes); - - // Check that we don't have the SESSION_CREATED event in the set - if (this.eventTypes.contains( IoEventType.SESSION_CREATED )) { - this.eventTypes = null; - throw new IllegalArgumentException(IoEventType.SESSION_CREATED - + " is not allowed."); - } + eventTypes = DEFAULT_EVENT_SET; + } + + // Copy the list of handled events in the event set + this.eventTypes = EnumSet.of(eventTypes[0], eventTypes); + + // Check that we don't have the SESSION_CREATED event in the set + if (this.eventTypes.contains( IoEventType.SESSION_CREATED )) { + this.eventTypes = null; + throw new IllegalArgumentException(IoEventType.SESSION_CREATED + + " is not allowed."); } } Modified: mina/trunk/core/src/test/java/org/apache/mina/filter/logging/MdcInjectionFilterTest.java URL: http://svn.apache.org/viewvc/mina/trunk/core/src/test/java/org/apache/mina/filter/logging/MdcInjectionFilterTest.java?rev=801833&r1=801832&r2=801833&view=diff ============================================================================== --- mina/trunk/core/src/test/java/org/apache/mina/filter/logging/MdcInjectionFilterTest.java (original) +++ mina/trunk/core/src/test/java/org/apache/mina/filter/logging/MdcInjectionFilterTest.java Thu Aug 6 22:59:42 2009 @@ -58,7 +58,6 @@ import org.apache.mina.transport.socket.nio.NioSocketConnector; import org.junit.After; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -106,7 +105,6 @@ } @Test - @Ignore public void testExecutorFilterAtTheEnd() throws IOException, InterruptedException { DefaultIoFilterChainBuilder chain = new DefaultIoFilterChainBuilder(); MdcInjectionFilter mdcInjectionFilter = new MdcInjectionFilter(); @@ -154,7 +152,6 @@ } @Test - @Ignore public void testTwoExecutorFilters() throws IOException, InterruptedException { DefaultIoFilterChainBuilder chain = new DefaultIoFilterChainBuilder(); MdcInjectionFilter mdcInjectionFilter = new MdcInjectionFilter();