directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r169948 - in /directory/network: branches/api_integration/src/java/org/apache/mina/filter/codec/DemuxingProtocolCodecFactory.java trunk/src/java/org/apache/mina/protocol/codec/DemuxingProtocolCodecFactory.java
Date Fri, 13 May 2005 05:16:07 GMT
Author: trustin
Date: Thu May 12 22:16:06 2005
New Revision: 169948

URL: http://svn.apache.org/viewcvs?rev=169948&view=rev
Log:
Fixed: DemuxingProtocolCodecFactory.register( Class ) doesn't correctly register a type which
implement both MessageEncoder and MessageDecoder.



Modified:
    directory/network/branches/api_integration/src/java/org/apache/mina/filter/codec/DemuxingProtocolCodecFactory.java
    directory/network/trunk/src/java/org/apache/mina/protocol/codec/DemuxingProtocolCodecFactory.java

Modified: directory/network/branches/api_integration/src/java/org/apache/mina/filter/codec/DemuxingProtocolCodecFactory.java
URL: http://svn.apache.org/viewcvs/directory/network/branches/api_integration/src/java/org/apache/mina/filter/codec/DemuxingProtocolCodecFactory.java?rev=169948&r1=169947&r2=169948&view=diff
==============================================================================
--- directory/network/branches/api_integration/src/java/org/apache/mina/filter/codec/DemuxingProtocolCodecFactory.java
(original)
+++ directory/network/branches/api_integration/src/java/org/apache/mina/filter/codec/DemuxingProtocolCodecFactory.java
Thu May 12 22:16:06 2005
@@ -52,19 +52,30 @@
     
     public void register( Class encoderOrDecoderClass )
     {
+        if( encoderOrDecoderClass == null )
+        {
+            throw new NullPointerException( "encoderOrDecoderClass" );
+        }
+
+        boolean registered = false;
         if( MessageEncoder.class.isAssignableFrom( encoderOrDecoderClass ) )
         {
             register( new DefaultConstructorMessageEncoderFactory( encoderOrDecoderClass
) );
+            registered = true;
         }
-        else if( MessageDecoder.class.isAssignableFrom( encoderOrDecoderClass ) )
+        
+        if( MessageDecoder.class.isAssignableFrom( encoderOrDecoderClass ) )
         {
             register( new DefaultConstructorMessageDecoderFactory( encoderOrDecoderClass
) );
+            registered = true;
         }
-        else
+        
+        if( !registered )
         {
-            throw new IllegalArgumentException();
+            throw new IllegalArgumentException( "Unregisterable type: " + encoderOrDecoderClass
);
         }
     }
+
     
     public void register( MessageEncoder encoder )
     {

Modified: directory/network/trunk/src/java/org/apache/mina/protocol/codec/DemuxingProtocolCodecFactory.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/protocol/codec/DemuxingProtocolCodecFactory.java?rev=169948&r1=169947&r2=169948&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/protocol/codec/DemuxingProtocolCodecFactory.java
(original)
+++ directory/network/trunk/src/java/org/apache/mina/protocol/codec/DemuxingProtocolCodecFactory.java
Thu May 12 22:16:06 2005
@@ -58,17 +58,27 @@
     
     public void register( Class encoderOrDecoderClass )
     {
+        if( encoderOrDecoderClass == null )
+        {
+            throw new NullPointerException( "encoderOrDecoderClass" );
+        }
+
+        boolean registered = false;
         if( MessageEncoder.class.isAssignableFrom( encoderOrDecoderClass ) )
         {
             register( new DefaultConstructorMessageEncoderFactory( encoderOrDecoderClass
) );
+            registered = true;
         }
-        else if( MessageDecoder.class.isAssignableFrom( encoderOrDecoderClass ) )
+        
+        if( MessageDecoder.class.isAssignableFrom( encoderOrDecoderClass ) )
         {
             register( new DefaultConstructorMessageDecoderFactory( encoderOrDecoderClass
) );
+            registered = true;
         }
-        else
+        
+        if( !registered )
         {
-            throw new IllegalArgumentException();
+            throw new IllegalArgumentException( "Unregisterable type: " + encoderOrDecoderClass
);
         }
     }
     



Mime
View raw message