directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1137167 - /directory/shared/trunk/dsml/engine/src/main/java/org/apache/directory/shared/dsmlv2/engine/Dsmlv2Engine.java
Date Sat, 18 Jun 2011 11:11:27 GMT
Author: kayyagari
Date: Sat Jun 18 11:11:26 2011
New Revision: 1137167

URL: http://svn.apache.org/viewvc?rev=1137167&view=rev
Log:
o fixed the incorrect search response generation (DIRSHARED-127)

Modified:
    directory/shared/trunk/dsml/engine/src/main/java/org/apache/directory/shared/dsmlv2/engine/Dsmlv2Engine.java

Modified: directory/shared/trunk/dsml/engine/src/main/java/org/apache/directory/shared/dsmlv2/engine/Dsmlv2Engine.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml/engine/src/main/java/org/apache/directory/shared/dsmlv2/engine/Dsmlv2Engine.java?rev=1137167&r1=1137166&r2=1137167&view=diff
==============================================================================
--- directory/shared/trunk/dsml/engine/src/main/java/org/apache/directory/shared/dsmlv2/engine/Dsmlv2Engine.java
(original)
+++ directory/shared/trunk/dsml/engine/src/main/java/org/apache/directory/shared/dsmlv2/engine/Dsmlv2Engine.java
Sat Jun 18 11:11:26 2011
@@ -620,32 +620,25 @@ public class Dsmlv2Engine
                 
                 SearchResponseDsml searchResponseDsml = new SearchResponseDsml( connection.getCodecService()
);
                 
-                boolean first = true;
-                
-                while ( searchResponses.next() )
+                if ( respWriter != null )
                 {
-                    if( first )
+                    StringBuilder sb = new StringBuilder();
+                    sb.append( "<searchResponse" );
+                    
+                    if ( request.getDecorated().getMessageId() > 0 )
                     {
-                        if ( respWriter != null )
-                        {
-                            StringBuilder sb = new StringBuilder();
-                            sb.append( "<searchResponse" );
-                            
-                            if ( request.getDecorated().getMessageId() > 0 )
-                            {
-                                sb.append( " requestID=\"" );
-                                sb.append( request.getDecorated().getMessageId() );
-                                sb.append( '"' );
-                            }
-                            
-                            sb.append( '>' );
-                            
-                            respWriter.write( sb.toString() );
-                        }
-                        
-                        first = false;
+                        sb.append( " requestID=\"" );
+                        sb.append( request.getDecorated().getMessageId() );
+                        sb.append( '"' );
                     }
                     
+                    sb.append( '>' );
+                    
+                    respWriter.write( sb.toString() );
+                }
+                
+                while ( searchResponses.next() )
+                {
                     Response searchResponse = searchResponses.get();
 
                     if ( searchResponse.getType() == MessageTypeEnum.SEARCH_RESULT_ENTRY
)
@@ -691,14 +684,15 @@ public class Dsmlv2Engine
                     resultCode = srDone.getLdapResult().getResultCode();
                     
                     SearchResultDoneDsml srdDsml = new SearchResultDoneDsml( connection.getCodecService(),
srDone );
-                    writeResponse( respWriter, srdDsml);
                     
                     if ( respWriter != null )
                     {
+                        writeResponse( respWriter, srdDsml);
                         respWriter.write( "</searchResponse>" );
                     }
                     else
                     {
+                        searchResponseDsml.addResponse( srdDsml );
                         batchResponse.addResponse( searchResponseDsml );
                     }
                 }



Mime
View raw message