directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r230698 - in /directory/protocol-providers/ldap/trunk: project.xml src/main/java/org/apache/ldap/server/protocol/DeleteHandler.java
Date Sun, 07 Aug 2005 20:50:52 GMT
Author: akarasulu
Date: Sun Aug  7 13:50:41 2005
New Revision: 230698

URL: http://svn.apache.org/viewcvs?rev=230698&view=rev
Log:
changes ...

 o changed returned error message according to Stefan's JIRA issue here:
        http://issues.apache.org/jira/browse/DIREVE-215
 o added nlog4j and started using it in the DeleteHandler to determine whether
   or not to send an extended message with stack trace to the client
 o formated code a bit removing extra lines

issues ...

 o we still have to figure out how we're going to use slf4j properly - here I
   used nlog4j directly but this will need to change


Modified:
    directory/protocol-providers/ldap/trunk/project.xml
    directory/protocol-providers/ldap/trunk/src/main/java/org/apache/ldap/server/protocol/DeleteHandler.java

Modified: directory/protocol-providers/ldap/trunk/project.xml
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/ldap/trunk/project.xml?rev=230698&r1=230697&r2=230698&view=diff
==============================================================================
--- directory/protocol-providers/ldap/trunk/project.xml (original)
+++ directory/protocol-providers/ldap/trunk/project.xml Sun Aug  7 13:50:41 2005
@@ -142,6 +142,12 @@
 
   <dependencies>
     <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>nlog4j</artifactId>
+      <version>1.2.14</version>
+      <url>http://slf4j.org/nlog4j</url>
+    </dependency>
+    <dependency>
       <groupId>directory-asn1</groupId>
       <artifactId>asn1-codec</artifactId>
       <version>0.3.1</version>

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?rev=230698&r1=230697&r2=230698&view=diff
==============================================================================
--- 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
Sun Aug  7 13:50:41 2005
@@ -28,6 +28,7 @@
 import org.apache.ldap.common.util.ExceptionUtils;
 import org.apache.mina.protocol.ProtocolSession;
 import org.apache.mina.protocol.handler.MessageHandler;
+import org.apache.log4j.Logger;
 
 /**
  * A single reply handler for {@link org.apache.ldap.common.message.DeleteRequest}s.
@@ -37,6 +38,9 @@
  */
 public class DeleteHandler implements MessageHandler
 {
+    private static final Logger LOG = Logger.getLogger( DeleteHandler.class );
+
+
     public void messageReceived( ProtocolSession session, Object request )
     {
         DeleteRequest req = ( DeleteRequest ) request;
@@ -46,14 +50,16 @@
         try
         {
             DirContext ctx = SessionRegistry.getSingleton().getLdapContext( session, null,
true );
-
             ctx.destroySubcontext( req.getName() );
         }
         catch( NamingException e )
         {
-            String msg = "failed to add entry " + req.getName() + ":\n";
+            String msg = "failed to delete entry " + req.getName() + ":\n";
 
-            msg += ExceptionUtils.getStackTrace( e );
+            if ( LOG.isDebugEnabled() )
+            {
+                msg += ExceptionUtils.getStackTrace( e );
+            }
 
             ResultCodeEnum code;
 
@@ -67,7 +73,6 @@
             }
 
             resp.getLdapResult().setResultCode( code );
-
             resp.getLdapResult().setErrorMessage( msg );
 
             if( e.getResolvedName() != null )
@@ -76,14 +81,11 @@
             }
 
             session.write( resp );
-
             return;
         }
 
         resp.getLdapResult().setResultCode( ResultCodeEnum.SUCCESS );
-
         resp.getLdapResult().setMatchedDn( req.getName() );
-
         session.write( resp );
     }
 }



Mime
View raw message