From 80c58327faaa4873369f6bb949e62792c2f708e0 Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Wed, 15 Aug 2007 21:34:53 +0000
Subject: [PATCH] This commit is a step toward getting OpenDS internationalized. There are still issues to be resolved before we can declare that we are internationalized but this commit covers the bulk of changes needed at this time.

---
 opends/src/server/org/opends/server/extensions/SHA1PasswordStorageScheme.java |   55 ++++++++++++++++++++++++-------------------------------
 1 files changed, 24 insertions(+), 31 deletions(-)

diff --git a/opends/src/server/org/opends/server/extensions/SHA1PasswordStorageScheme.java b/opends/src/server/org/opends/server/extensions/SHA1PasswordStorageScheme.java
index 3ecd9e2..e977c5d 100644
--- a/opends/src/server/org/opends/server/extensions/SHA1PasswordStorageScheme.java
+++ b/opends/src/server/org/opends/server/extensions/SHA1PasswordStorageScheme.java
@@ -25,6 +25,7 @@
  *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
  */
 package org.opends.server.extensions;
+import org.opends.messages.Message;
 
 
 
@@ -39,8 +40,8 @@
 import org.opends.server.types.ByteString;
 import org.opends.server.types.ByteStringFactory;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.ErrorLogCategory;
-import org.opends.server.types.ErrorLogSeverity;
+
+
 import org.opends.server.types.InitializationException;
 import org.opends.server.types.ResultCode;
 import org.opends.server.util.Base64;
@@ -50,8 +51,7 @@
 import static org.opends.server.loggers.ErrorLogger.*;
 import static org.opends.server.loggers.debug.DebugLogger.*;
 import org.opends.server.loggers.debug.DebugTracer;
-import static org.opends.server.messages.ExtensionsMessages.*;
-import static org.opends.server.messages.MessageHandler.*;
+import static org.opends.messages.ExtensionMessages.*;
 import static org.opends.server.util.StaticUtils.*;
 
 
@@ -122,10 +122,9 @@
         TRACER.debugCaught(DebugLogLevel.ERROR, e);
       }
 
-      int msgID = MSGID_PWSCHEME_CANNOT_INITIALIZE_MESSAGE_DIGEST;
-      String message = getMessage(msgID, MESSAGE_DIGEST_ALGORITHM_SHA_1,
-                                  String.valueOf(e));
-      throw new InitializationException(msgID, message, e);
+      Message message = ERR_PWSCHEME_CANNOT_INITIALIZE_MESSAGE_DIGEST.get(
+          MESSAGE_DIGEST_ALGORITHM_SHA_1, String.valueOf(e));
+      throw new InitializationException(message, e);
     }
 
     digestLock = new ReentrantLock();
@@ -166,11 +165,10 @@
         TRACER.debugCaught(DebugLogLevel.ERROR, e);
       }
 
-      int    msgID   = MSGID_PWSCHEME_CANNOT_ENCODE_PASSWORD;
-      String message = getMessage(msgID, CLASS_NAME, getExceptionMessage(e));
-
+      Message message = ERR_PWSCHEME_CANNOT_ENCODE_PASSWORD.get(
+          CLASS_NAME, getExceptionMessage(e));
       throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
-                                   message, msgID, e);
+                                   message, e);
     }
     finally
     {
@@ -209,11 +207,10 @@
         TRACER.debugCaught(DebugLogLevel.ERROR, e);
       }
 
-      int    msgID   = MSGID_PWSCHEME_CANNOT_ENCODE_PASSWORD;
-      String message = getMessage(msgID, CLASS_NAME, getExceptionMessage(e));
-
+      Message message = ERR_PWSCHEME_CANNOT_ENCODE_PASSWORD.get(
+          CLASS_NAME, getExceptionMessage(e));
       throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
-                                   message, msgID, e);
+                                   message, e);
     }
     finally
     {
@@ -268,9 +265,8 @@
         TRACER.debugCaught(DebugLogLevel.ERROR, e);
       }
 
-      logError(ErrorLogCategory.EXTENSIONS, ErrorLogSeverity.MILD_ERROR,
-               MSGID_PWSCHEME_CANNOT_BASE64_DECODE_STORED_PASSWORD,
-               storedPassword.stringValue(), String.valueOf(e));
+      logError(ERR_PWSCHEME_CANNOT_BASE64_DECODE_STORED_PASSWORD.get(
+          storedPassword.stringValue(), String.valueOf(e)));
 
       return false;
     }
@@ -299,10 +295,9 @@
   public ByteString encodeAuthPassword(ByteString plaintext)
          throws DirectoryException
   {
-    int    msgID   = MSGID_PWSCHEME_DOES_NOT_SUPPORT_AUTH_PASSWORD;
-    String message = getMessage(msgID, getStorageSchemeName());
-    throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message,
-                                 msgID);
+    Message message =
+        ERR_PWSCHEME_DOES_NOT_SUPPORT_AUTH_PASSWORD.get(getStorageSchemeName());
+    throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message);
   }
 
 
@@ -338,10 +333,9 @@
   public ByteString getPlaintextValue(ByteString storedPassword)
          throws DirectoryException
   {
-    int msgID = MSGID_PWSCHEME_NOT_REVERSIBLE;
-    String message = getMessage(msgID, STORAGE_SCHEME_NAME_SHA_1);
-    throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message,
-                                 msgID);
+    Message message =
+        ERR_PWSCHEME_NOT_REVERSIBLE.get(STORAGE_SCHEME_NAME_SHA_1);
+    throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message);
   }
 
 
@@ -354,10 +348,9 @@
                                                   String authValue)
          throws DirectoryException
   {
-    int    msgID   = MSGID_PWSCHEME_DOES_NOT_SUPPORT_AUTH_PASSWORD;
-    String message = getMessage(msgID, getStorageSchemeName());
-    throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message,
-                                 msgID);
+    Message message =
+        ERR_PWSCHEME_DOES_NOT_SUPPORT_AUTH_PASSWORD.get(getStorageSchemeName());
+    throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message);
   }
 
 

--
Gitblit v1.10.0