directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: r535678 - /directory/apacheds/branches/kerberos-encryption-types/protocol-changepw/src/main/java/org/apache/directory/server/changepw/protocol/ChangePasswordProtocolHandler.java
Date Sun, 06 May 2007 23:23:57 GMT
Author: erodriguez
Date: Sun May  6 16:23:57 2007
New Revision: 535678

URL: http://svn.apache.org/viewvc?view=rev&rev=535678
Log:
Improved Change Password exception logging.

Modified:
    directory/apacheds/branches/kerberos-encryption-types/protocol-changepw/src/main/java/org/apache/directory/server/changepw/protocol/ChangePasswordProtocolHandler.java

Modified: directory/apacheds/branches/kerberos-encryption-types/protocol-changepw/src/main/java/org/apache/directory/server/changepw/protocol/ChangePasswordProtocolHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/kerberos-encryption-types/protocol-changepw/src/main/java/org/apache/directory/server/changepw/protocol/ChangePasswordProtocolHandler.java?view=diff&rev=535678&r1=535677&r2=535678
==============================================================================
--- directory/apacheds/branches/kerberos-encryption-types/protocol-changepw/src/main/java/org/apache/directory/server/changepw/protocol/ChangePasswordProtocolHandler.java
(original)
+++ directory/apacheds/branches/kerberos-encryption-types/protocol-changepw/src/main/java/org/apache/directory/server/changepw/protocol/ChangePasswordProtocolHandler.java
Sun May  6 16:23:57 2007
@@ -29,6 +29,8 @@
 import javax.security.auth.kerberos.KerberosPrincipal;
 
 import org.apache.directory.server.changepw.ChangePasswordConfiguration;
+import org.apache.directory.server.changepw.exceptions.ChangePasswordException;
+import org.apache.directory.server.changepw.exceptions.ErrorType;
 import org.apache.directory.server.changepw.messages.ChangePasswordErrorModifier;
 import org.apache.directory.server.changepw.messages.ChangePasswordRequest;
 import org.apache.directory.server.changepw.service.ChangePasswordChain;
@@ -61,7 +63,7 @@
     private String contextKey = "context";
 
 
-    public ChangePasswordProtocolHandler(ChangePasswordConfiguration config, PrincipalStore
store)
+    public ChangePasswordProtocolHandler( ChangePasswordConfiguration config, PrincipalStore
store )
     {
         this.config = config;
         this.store = store;
@@ -124,11 +126,16 @@
 
             session.write( changepwContext.getReply() );
         }
-        catch ( Exception e )
+        catch ( KerberosException ke )
         {
-            log.error( e.getMessage() );
-
-            KerberosException ke = ( KerberosException ) e;
+            if ( log.isDebugEnabled() )
+            {
+                log.debug( ke.getMessage(), ke );
+            }
+            else
+            {
+                log.warn( ke.getMessage() );
+            }
 
             ErrorMessage errorMessage = getErrorMessage( config.getChangepwPrincipal(), ke
);
 
@@ -137,6 +144,13 @@
 
             session.write( modifier.getChangePasswordError() );
         }
+        catch ( Exception e )
+        {
+            log.error( "Unexpected exception:  " + e.getMessage(), e );
+
+            session.write( getErrorMessage( config.getChangepwPrincipal(), new ChangePasswordException(
+                ErrorType.KRB5_KPASSWD_UNKNOWN_ERROR ) ) );
+        }
     }
 
 
@@ -176,7 +190,8 @@
     {
         short resultCode = ( short ) exception.getErrorCode();
 
-        byte[] resultString = { (byte) 0x00 };
+        byte[] resultString =
+            { ( byte ) 0x00 };
 
         if ( exception.getExplanatoryData() == null || exception.getExplanatoryData().length
== 0 )
         {
@@ -186,7 +201,7 @@
             }
             catch ( UnsupportedEncodingException uee )
             {
-                log.error(  uee.getMessage() );
+                log.error( uee.getMessage() );
             }
         }
         else



Mime
View raw message