directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r568799 - /directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java
Date Thu, 23 Aug 2007 01:35:32 GMT
Author: elecharny
Date: Wed Aug 22 18:35:31 2007
New Revision: 568799

URL: http://svn.apache.org/viewvc?rev=568799&view=rev
Log:
In decodeOccurred, avoid to pass an incorrect messgae, to avoid a classCastException.

Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java?rev=568799&r1=568798&r2=568799&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java
Wed Aug 22 18:35:31 2007
@@ -27,6 +27,7 @@
 import java.util.Hashtable;
 import java.util.Set;
 
+import org.apache.directory.shared.asn1.Asn1Object;
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.asn1.codec.stateful.DecoderCallback;
 import org.apache.directory.shared.asn1.codec.stateful.DecoderMonitor;
@@ -151,7 +152,14 @@
         {
             public void decodeOccurred( StatefulDecoder decoder, Object decoded )
             {
-                cb.decodeOccurred( decoder, transformer.transform( decoded ) );
+            	if ( decoded instanceof Asn1Object )
+            	{
+            		cb.decodeOccurred( decoder, transformer.transform( decoded ) );
+            	}
+            	else
+            	{
+            		cb.decodeOccurred( decoder, decoded );
+            	}
             }
         } );
     }
@@ -230,7 +238,8 @@
             }
             else
             {
-                throw new MessageException( "decoder failture: " + e.getMessage() );
+            	// TODO : this is certainly not the way we should handle such an exception !
+            	throw new ResponseCarryingMessageException( e.getMessage() );
             }
         }
     }



Mime
View raw message