directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r159331 - in directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol: AddHandler.java CompareHandler.java DeleteHandler.java ModifyDnHandler.java ModifyHandler.java SearchHandler.java UnbindHandler.java
Date Mon, 28 Mar 2005 23:29:28 GMT
Author: akarasulu
Date: Mon Mar 28 15:29:25 2005
New Revision: 159331

URL: http://svn.apache.org/viewcvs?view=rev&rev=159331
Log:
fixed class type mismatch problems

Modified:
    directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/AddHandler.java
    directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/CompareHandler.java
    directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/DeleteHandler.java
    directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/ModifyDnHandler.java
    directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/ModifyHandler.java
    directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/SearchHandler.java
    directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/UnbindHandler.java

Modified: directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/AddHandler.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/AddHandler.java?view=diff&r1=159330&r2=159331
==============================================================================
--- directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/AddHandler.java
(original)
+++ directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/AddHandler.java
Mon Mar 28 15:29:25 2005
@@ -17,7 +17,6 @@
 package org.apache.ldap.server.protocol;
 
 import javax.naming.NamingException;
-import javax.naming.ldap.InitialLdapContext;
 import javax.naming.ldap.LdapContext;
 
 import org.apache.ldap.common.exception.LdapException;
@@ -41,20 +40,23 @@
     public void messageReceived( ProtocolSession session, Object request )
     {
         AddRequest req = ( AddRequest ) request;
+
         AddResponse resp = new AddResponseImpl( req.getMessageId() );
+
         resp.setLdapResult( new LdapResultImpl( resp ) );
 
         try
         {
-            InitialLdapContext ictx = SessionRegistry.getSingleton()
-                    .getLdapContext( session, null, true );
-            LdapContext ctx = ( LdapContext ) ictx.lookup( "" );
+            LdapContext ctx = SessionRegistry.getSingleton().getLdapContext( session, null,
true );
+
             ctx.createSubcontext( req.getName(), req.getEntry() );
         }
         catch( NamingException e )
         {
             String msg = "failed to add entry " + req.getName() + ":\n";
+
             msg += ExceptionUtils.getStackTrace( e );
+
             ResultCodeEnum code;
 
             if( e instanceof LdapException )
@@ -67,6 +69,7 @@
             }
 
             resp.getLdapResult().setResultCode( code );
+
             resp.getLdapResult().setErrorMessage( msg );
 
             if( e.getResolvedName() != null )
@@ -76,11 +79,14 @@
             }
 
             session.write( resp );
+
             return;
         }
 
         resp.getLdapResult().setResultCode( ResultCodeEnum.SUCCESS );
+
         resp.getLdapResult().setMatchedDn( req.getName() );
+
         session.write( resp );
     }
 }

Modified: directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/CompareHandler.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/CompareHandler.java?view=diff&r1=159330&r2=159331
==============================================================================
--- directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/CompareHandler.java
(original)
+++ directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/CompareHandler.java
Mon Mar 28 15:29:25 2005
@@ -20,7 +20,6 @@
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.DirContext;
-import javax.naming.ldap.InitialLdapContext;
 
 import org.apache.ldap.common.exception.LdapException;
 import org.apache.ldap.common.message.CompareRequest;
@@ -44,14 +43,15 @@
     public void messageReceived( ProtocolSession session, Object request )
     {
         CompareRequest req = ( CompareRequest ) request;
+
         CompareResponse resp = new CompareResponseImpl( req.getMessageId() );
+
         resp.setLdapResult( new LdapResultImpl( resp ) );
 
         try
         {
-            InitialLdapContext ictx = SessionRegistry.getSingleton()
-                    .getLdapContext( session, null, true );
-            DirContext ctx = ( DirContext ) ictx.lookup( "" );
+            DirContext ctx = SessionRegistry.getSingleton().getLdapContext( session, null,
true );
+
             Attribute attr = ctx.getAttributes( req.getName() ).get( req.getAttributeId()
);
 
             if ( attr == null )
@@ -70,7 +70,9 @@
         catch ( NamingException e )
         {
             String msg = "failed to add entry " + req.getName() + ":\n";
+
             msg += ExceptionUtils.getStackTrace( e );
+
             ResultCodeEnum code;
 
             if ( e instanceof LdapException )
@@ -83,6 +85,7 @@
             }
 
             resp.getLdapResult().setResultCode( code );
+
             resp.getLdapResult().setErrorMessage( msg );
 
             if ( e.getResolvedName() != null )
@@ -91,10 +94,12 @@
             }
 
             session.write( resp );
+
             return;
         }
 
         resp.getLdapResult().setMatchedDn( req.getName() );
+
         session.write( resp );
     }
 }

Modified: directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/DeleteHandler.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/DeleteHandler.java?view=diff&r1=159330&r2=159331
==============================================================================
--- directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/DeleteHandler.java
(original)
+++ directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/DeleteHandler.java
Mon Mar 28 15:29:25 2005
@@ -18,7 +18,6 @@
 
 import javax.naming.NamingException;
 import javax.naming.directory.DirContext;
-import javax.naming.ldap.InitialLdapContext;
 
 import org.apache.ldap.common.exception.LdapException;
 import org.apache.ldap.common.message.DeleteRequest;
@@ -46,15 +45,16 @@
 
         try
         {
-            InitialLdapContext ictx = SessionRegistry.getSingleton()
-                    .getLdapContext( session, null, true );
-            DirContext ctx = ( DirContext ) ictx.lookup( "" );
+            DirContext ctx = ( DirContext ) SessionRegistry.getSingleton().getLdapContext(
session, null, true );
+
             ctx.destroySubcontext( req.getName() );
         }
         catch( NamingException e )
         {
             String msg = "failed to add entry " + req.getName() + ":\n";
+
             msg += ExceptionUtils.getStackTrace( e );
+
             ResultCodeEnum code;
 
             if( e instanceof LdapException )
@@ -67,20 +67,23 @@
             }
 
             resp.getLdapResult().setResultCode( code );
+
             resp.getLdapResult().setErrorMessage( msg );
 
             if( e.getResolvedName() != null )
             {
-                resp.getLdapResult().setMatchedDn(
-                        e.getResolvedName().toString() );
+                resp.getLdapResult().setMatchedDn( e.getResolvedName().toString() );
             }
 
             session.write( resp );
+
             return;
         }
 
         resp.getLdapResult().setResultCode( ResultCodeEnum.SUCCESS );
+
         resp.getLdapResult().setMatchedDn( req.getName() );
+
         session.write( resp );
     }
 }

Modified: directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/ModifyDnHandler.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/ModifyDnHandler.java?view=diff&r1=159330&r2=159331
==============================================================================
--- directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/ModifyDnHandler.java
(original)
+++ directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/ModifyDnHandler.java
Mon Mar 28 15:29:25 2005
@@ -20,6 +20,7 @@
 import javax.naming.NamingException;
 import javax.naming.directory.DirContext;
 import javax.naming.ldap.InitialLdapContext;
+import javax.naming.ldap.LdapContext;
 
 import org.apache.ldap.common.exception.LdapException;
 import org.apache.ldap.common.message.LdapResultImpl;
@@ -44,20 +45,23 @@
     public void messageReceived( ProtocolSession session, Object request )
     {
         ModifyDnRequest req = ( ModifyDnRequest ) request;
+
         ModifyDnResponse resp = new ModifyDnResponseImpl( req.getMessageId() );
+
         resp.setLdapResult( new LdapResultImpl( resp ) );
 
         try
         {
-            InitialLdapContext ictx = SessionRegistry.getSingleton()
-                    .getLdapContext( session, null, true );
-            DirContext ctx = ( DirContext ) ictx.lookup( "" );
+            LdapContext ctx = SessionRegistry.getSingleton().getLdapContext( session, null,
true );
+
             String deleteRDN = String.valueOf( req.getDeleteOldRdn() );
+
             ctx.addToEnvironment( "java.naming.ldap.deleteRDN", deleteRDN );
 
             if ( req.isMove() )
             {
                 LdapName oldDn = new LdapName( req.getName() );
+
                 LdapName newDn = new LdapName( req.getNewSuperior() );
 
                 if ( req.getNewRdn() != null )
@@ -74,15 +78,20 @@
             else
             {
                 LdapName newDn = new LdapName( req.getName() );
+
                 newDn.remove( newDn.size() - 1 );
+
                 newDn.add( req.getNewRdn() );
+
                 ctx.rename( new LdapName( req.getName() ), newDn );
             }
         }
         catch ( NamingException e )
         {
             String msg = "failed to add entry " + req.getName() + ":\n";
+
             msg += ExceptionUtils.getStackTrace( e );
+
             ResultCodeEnum code;
 
             if ( e instanceof LdapException )
@@ -95,6 +104,7 @@
             }
 
             resp.getLdapResult().setResultCode( code );
+
             resp.getLdapResult().setErrorMessage( msg );
 
             if ( e.getResolvedName() != null )
@@ -103,11 +113,14 @@
             }
 
             session.write( resp );
+
             return;
         }
 
         resp.getLdapResult().setResultCode( ResultCodeEnum.SUCCESS );
+
         resp.getLdapResult().setMatchedDn( req.getName() );
+
         session.write( resp );
     }
 }

Modified: directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/ModifyHandler.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/ModifyHandler.java?view=diff&r1=159330&r2=159331
==============================================================================
--- directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/ModifyHandler.java
(original)
+++ directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/ModifyHandler.java
Mon Mar 28 15:29:25 2005
@@ -18,9 +18,8 @@
 
 
 import javax.naming.NamingException;
-import javax.naming.directory.DirContext;
 import javax.naming.directory.ModificationItem;
-import javax.naming.ldap.InitialLdapContext;
+import javax.naming.ldap.LdapContext;
 
 import org.apache.ldap.common.exception.LdapException;
 import org.apache.ldap.common.message.LdapResultImpl;
@@ -46,21 +45,25 @@
     public void messageReceived( ProtocolSession session, Object request )
     {
         ModifyRequest req = ( ModifyRequest ) request;
+
         ModifyResponse resp = new ModifyResponseImpl( req.getMessageId() );
+
         resp.setLdapResult( new LdapResultImpl( resp ) );
 
         try
         {
-            InitialLdapContext ictx = SessionRegistry.getSingleton()
-                    .getLdapContext( session, null, true );
-            DirContext ctx = ( DirContext ) ictx.lookup( "" );
+            LdapContext ctx = SessionRegistry.getSingleton().getLdapContext( session, null,
true );
+
             Object[] mods = req.getModificationItems().toArray( EMPTY );
+
             ctx.modifyAttributes( req.getName(), ( ModificationItem[] ) mods );
         }
         catch ( NamingException e )
         {
             String msg = "failed to add entry " + req.getName() + ":\n";
+
             msg += ExceptionUtils.getStackTrace( e );
+
             ResultCodeEnum code;
 
             if ( e instanceof LdapException )
@@ -73,6 +76,7 @@
             }
 
             resp.getLdapResult().setResultCode( code );
+
             resp.getLdapResult().setErrorMessage( msg );
 
             if ( e.getResolvedName() != null )
@@ -81,12 +85,16 @@
             }
 
             session.write( resp );
+
             return;
         }
 
         resp.getLdapResult().setResultCode( ResultCodeEnum.SUCCESS );
+
         resp.getLdapResult().setMatchedDn( req.getName() );
+
         session.write( resp );
+
         return;
     }
 }

Modified: directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/SearchHandler.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/SearchHandler.java?view=diff&r1=159330&r2=159331
==============================================================================
--- directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/SearchHandler.java
(original)
+++ directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/SearchHandler.java
Mon Mar 28 15:29:25 2005
@@ -27,7 +27,6 @@
 import javax.naming.directory.Attribute;
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
-import javax.naming.ldap.InitialLdapContext;
 import javax.naming.ldap.LdapContext;
 
 import org.apache.ldap.common.exception.LdapException;
@@ -60,41 +59,51 @@
     public void messageReceived( ProtocolSession session, Object request )
     {
         LdapContext ctx;
+
         SearchRequest req = ( SearchRequest ) request;
+
         NamingEnumeration list = null;
 
         // check the attributes to see if a referral's ref attribute is included
+
         String[] ids = null;
+
         Collection retAttrs = new HashSet();
+
         retAttrs.addAll( req.getAttributes() );
+
         if( retAttrs.size() > 0 && !retAttrs.contains( "ref" ) )
         {
             retAttrs.add( "ref" );
-            ids = ( String[] ) retAttrs
-                    .toArray( ArrayUtils.EMPTY_STRING_ARRAY );
+
+            ids = ( String[] ) retAttrs.toArray( ArrayUtils.EMPTY_STRING_ARRAY );
         }
         else if( retAttrs.size() > 0 )
         {
-            ids = ( String[] ) retAttrs
-                    .toArray( ArrayUtils.EMPTY_STRING_ARRAY );
+            ids = ( String[] ) retAttrs.toArray( ArrayUtils.EMPTY_STRING_ARRAY );
         }
 
         // prepare all the search controls
+
         SearchControls controls = new SearchControls();
+
         controls.setCountLimit( req.getSizeLimit() );
+
         controls.setTimeLimit( req.getTimeLimit() );
+
         controls.setSearchScope( req.getScope().getValue() );
+
         controls.setReturningObjFlag( req.getTypesOnly() );
+
         controls.setReturningAttributes( ids );
+
         controls.setDerefLinkFlag( true );
 
         try
         {
-            InitialLdapContext ictx = SessionRegistry.getSingleton()
-                    .getLdapContext( session, null, true );
-            ctx = ( LdapContext ) ictx.lookup( "" );
-            ctx.addToEnvironment( DEREFALIASES_KEY, req.getDerefAliases()
-                    .getName() );
+            ctx = SessionRegistry.getSingleton().getLdapContext( session, null, true );
+
+            ctx.addToEnvironment( DEREFALIASES_KEY, req.getDerefAliases().getName() );
 
             /*
              * Eve JNDI Provider Specific Hack!
@@ -113,40 +122,52 @@
              * the filter.
              */
             ctx.addToEnvironment( "__filter__", req.getFilter() );
+
             list = ctx.search( req.getBase(), null, controls );
+
             ctx.removeFromEnvironment( "__filter__" );
 
             if( list.hasMore() )
             {
                 Iterator it = new SearchResponseIterator( req, list );
+
                 while( it.hasNext() )
                 {
                     session.write( it.next() );
                 }
+
                 return;
             }
             else
             {
                 list.close();
-                SearchResponseDone resp = new SearchResponseDoneImpl( req
-                        .getMessageId() );
+
+                SearchResponseDone resp = new SearchResponseDoneImpl( req.getMessageId()
);
+
                 resp.setLdapResult( new LdapResultImpl( resp ) );
+
                 resp.getLdapResult().setResultCode( ResultCodeEnum.SUCCESS );
+
                 resp.getLdapResult().setMatchedDn( req.getBase() );
+
                 Iterator it = Collections.singleton( resp ).iterator();
+
                 while( it.hasNext() )
                 {
                     session.write( it.next() );
                 }
+
                 return;
             }
         }
         catch( NamingException e )
         {
             String msg = "failed on search operation:\n" + req + "\n";
+
             msg += ExceptionUtils.getStackTrace( e );
-            SearchResponseDone resp = new SearchResponseDoneImpl( req
-                    .getMessageId() );
+
+            SearchResponseDone resp = new SearchResponseDoneImpl( req.getMessageId() );
+
             ResultCodeEnum rc = null;
 
             if( e instanceof LdapException )
@@ -159,12 +180,14 @@
             }
 
             resp.setLdapResult( new LdapResultImpl( resp ) );
+
             resp.getLdapResult().setResultCode( rc );
+
             resp.getLdapResult().setErrorMessage( msg );
+
             if( e.getResolvedName() != null )
             {
-                resp.getLdapResult().setMatchedDn(
-                        e.getResolvedName().toString() );
+                resp.getLdapResult().setMatchedDn( e.getResolvedName().toString() );
             }
             else
             {
@@ -172,6 +195,7 @@
             }
 
             Iterator it = Collections.singleton( resp ).iterator();
+
             while( it.hasNext() )
             {
                 session.write( it.next() );
@@ -179,12 +203,15 @@
         }
     }
 
+
     SearchResponseDone getResponse( SearchRequest req, NamingException e )
     {
         String msg = "failed on search operation:\n" + req + "\n";
+
         msg += ExceptionUtils.getStackTrace( e );
-        SearchResponseDone resp = new SearchResponseDoneImpl( req
-                .getMessageId() );
+
+        SearchResponseDone resp = new SearchResponseDoneImpl( req.getMessageId() );
+
         ResultCodeEnum rc = null;
 
         if( e instanceof LdapException )
@@ -197,12 +224,14 @@
         }
 
         resp.setLdapResult( new LdapResultImpl( resp ) );
+
         resp.getLdapResult().setResultCode( rc );
+
         resp.getLdapResult().setErrorMessage( msg );
+
         if( e.getResolvedName() != null )
         {
-            resp.getLdapResult()
-                    .setMatchedDn( e.getResolvedName().toString() );
+            resp.getLdapResult().setMatchedDn( e.getResolvedName().toString() );
         }
         else
         {
@@ -248,21 +277,27 @@
                      * local variable for the following call to next()
                      */
                     Attribute ref = result.getAttributes().get( "ref" );
+
                     if( ref == null || ref.size() > 0 )
                     {
                         SearchResponseEntry respEntry;
-                        respEntry = new SearchResponseEntryImpl( req
-                                .getMessageId() );
+
+                        respEntry = new SearchResponseEntryImpl( req.getMessageId() );
+
                         respEntry.setAttributes( result.getAttributes() );
+
                         respEntry.setObjectName( result.getName() );
+
                         prefetched = respEntry;
                     }
                     else
                     {
                         SearchResponseReference respRef;
-                        respRef = new SearchResponseReferenceImpl( req
-                                .getMessageId() );
+
+                        respRef = new SearchResponseReferenceImpl( req.getMessageId() );
+
                         respRef.setReferral( new ReferralImpl( respRef ) );
+
                         for( int ii = 0; ii < ref.size(); ii ++ )
                         {
                             String url;
@@ -270,6 +305,7 @@
                             try
                             {
                                 url = ( String ) ref.get( ii );
+
                                 respRef.getReferral().addLdapUrl( url );
                             }
                             catch( NamingException e )
@@ -281,10 +317,13 @@
                                 catch( Throwable t )
                                 {
                                 }
+
                                 prefetched = null;
+
                                 respDone = getResponse( req, e );
                             }
                         }
+
                         prefetched = respRef;
                     }
                 }
@@ -298,6 +337,7 @@
                 catch( Exception e2 )
                 {
                 }
+
                 respDone = getResponse( req, e );
             }
         }
@@ -310,6 +350,7 @@
         public Object next()
         {
             Object next = prefetched;
+
             SearchResult result = null;
 
             // if we're done we got nothing to give back
@@ -322,6 +363,7 @@
             if( respDone != null )
             {
                 done = true;
+
                 return respDone;
             }
 
@@ -348,12 +390,17 @@
                     catch( Throwable t )
                     {
                     }
+
                     respDone = new SearchResponseDoneImpl( req.getMessageId() );
+
                     respDone.setLdapResult( new LdapResultImpl( respDone ) );
-                    respDone.getLdapResult().setResultCode(
-                            ResultCodeEnum.SUCCESS );
+
+                    respDone.getLdapResult().setResultCode( ResultCodeEnum.SUCCESS );
+
                     respDone.getLdapResult().setMatchedDn( req.getBase() );
+
                     prefetched = null;
+
                     return next;
                 }
             }
@@ -366,8 +413,11 @@
                 catch( Throwable t )
                 {
                 }
+
                 prefetched = null;
+
                 respDone = getResponse( req, e );
+
                 return next;
             }
 
@@ -376,19 +426,23 @@
              * local variable for the following call to next()
              */
             Attribute ref = result.getAttributes().get( "ref" );
+
             if( ref == null || ref.size() > 0 )
             {
-                SearchResponseEntry respEntry = new SearchResponseEntryImpl(
-                        req.getMessageId() );
+                SearchResponseEntry respEntry = new SearchResponseEntryImpl( req.getMessageId()
);
+
                 respEntry.setAttributes( result.getAttributes() );
+
                 respEntry.setObjectName( result.getName() );
+
                 prefetched = respEntry;
             }
             else
             {
-                SearchResponseReference respRef = new SearchResponseReferenceImpl(
-                        req.getMessageId() );
+                SearchResponseReference respRef = new SearchResponseReferenceImpl( req.getMessageId()
);
+
                 respRef.setReferral( new ReferralImpl( respRef ) );
+
                 for( int ii = 0; ii < ref.size(); ii ++ )
                 {
                     String url;
@@ -396,6 +450,7 @@
                     try
                     {
                         url = ( String ) ref.get( ii );
+
                         respRef.getReferral().addLdapUrl( url );
                     }
                     catch( NamingException e )
@@ -407,11 +462,15 @@
                         catch( Throwable t )
                         {
                         }
+
                         prefetched = null;
+
                         respDone = getResponse( req, e );
+
                         return next;
                     }
                 }
+
                 prefetched = respRef;
             }
 

Modified: directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/UnbindHandler.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/UnbindHandler.java?view=diff&r1=159330&r2=159331
==============================================================================
--- directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/UnbindHandler.java
(original)
+++ directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/UnbindHandler.java
Mon Mar 28 15:29:25 2005
@@ -18,7 +18,7 @@
 
 
 import javax.naming.NamingException;
-import javax.naming.ldap.InitialLdapContext;
+import javax.naming.ldap.LdapContext;
 
 import org.apache.mina.protocol.ProtocolSession;
 import org.apache.mina.protocol.DemuxingProtocolHandler.MessageHandler;
@@ -39,13 +39,15 @@
 
         try
         {
-            InitialLdapContext ictx = SessionRegistry.getSingleton()
-                    .getLdapContext( session, null, false );
-            if ( ictx != null )
+            LdapContext ctx = SessionRegistry.getSingleton().getLdapContext( session, null,
false );
+
+            if ( ctx != null )
             {
-                ictx.close();
+                ctx.close();
             }
+
             registry.terminateSession( session );
+
             registry.remove( session );
         }
         catch ( NamingException e )



Mime
View raw message