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/protocols/asn1/ASN1Enumerated.java |   60 +++++++++++++++++++++++++++---------------------------------
 1 files changed, 27 insertions(+), 33 deletions(-)

diff --git a/opends/src/server/org/opends/server/protocols/asn1/ASN1Enumerated.java b/opends/src/server/org/opends/server/protocols/asn1/ASN1Enumerated.java
index 653270a..28a8dfa 100644
--- a/opends/src/server/org/opends/server/protocols/asn1/ASN1Enumerated.java
+++ b/opends/src/server/org/opends/server/protocols/asn1/ASN1Enumerated.java
@@ -25,11 +25,11 @@
  *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
  */
 package org.opends.server.protocols.asn1;
+import org.opends.messages.Message;
 
 
 
-import static org.opends.server.messages.MessageHandler.*;
-import static org.opends.server.messages.ProtocolMessages.*;
+import static org.opends.messages.ProtocolMessages.*;
 import static org.opends.server.protocols.asn1.ASN1Constants.*;
 import static org.opends.server.util.ServerConstants.*;
 import static org.opends.server.util.StaticUtils.*;
@@ -149,16 +149,15 @@
   {
     if (value == null)
     {
-      int    msgID   = MSGID_ASN1_ENUMERATED_SET_VALUE_NULL;
-      String message = getMessage(msgID);
-      throw new ASN1Exception(msgID, message);
+      Message message = ERR_ASN1_ENUMERATED_SET_VALUE_NULL.get();
+      throw new ASN1Exception(message);
     }
 
     if ((value.length < 1) || (value.length > 4))
     {
-      int    msgID   = MSGID_ASN1_ENUMERATED_SET_VALUE_INVALID_LENGTH;
-      String message = getMessage(msgID, value.length);
-      throw new ASN1Exception(msgID, message);
+      Message message =
+          ERR_ASN1_ENUMERATED_SET_VALUE_INVALID_LENGTH.get(value.length);
+      throw new ASN1Exception(message);
     }
 
     intValue = 0;
@@ -187,17 +186,16 @@
   {
     if (element == null)
     {
-      int    msgID   = MSGID_ASN1_ENUMERATED_DECODE_ELEMENT_NULL;
-      String message = getMessage(msgID);
-      throw new ASN1Exception(msgID, message);
+      Message message = ERR_ASN1_ENUMERATED_DECODE_ELEMENT_NULL.get();
+      throw new ASN1Exception(message);
     }
 
     byte[] value = element.value();
     if ((value.length < 1) || (value.length > 4))
     {
-      int    msgID   = MSGID_ASN1_ENUMERATED_DECODE_ELEMENT_INVALID_LENGTH;
-      String message = getMessage(msgID, value.length);
-      throw new ASN1Exception(msgID, message);
+      Message message =
+          ERR_ASN1_ENUMERATED_DECODE_ELEMENT_INVALID_LENGTH.get(value.length);
+      throw new ASN1Exception(message);
     }
 
     int intValue = 0;
@@ -229,16 +227,15 @@
     // a valid ASN.1 enumerated element.
     if (encodedElement == null)
     {
-      int    msgID   = MSGID_ASN1_ENUMERATED_DECODE_ARRAY_NULL;
-      String message = getMessage(msgID);
-      throw new ASN1Exception(msgID, message);
+      Message message = ERR_ASN1_ENUMERATED_DECODE_ARRAY_NULL.get();
+      throw new ASN1Exception(message);
     }
 
     if (encodedElement.length < 3)
     {
-      int    msgID   = MSGID_ASN1_ENUMERATED_SHORT_ELEMENT;
-      String message = getMessage(msgID, encodedElement.length);
-      throw new ASN1Exception(msgID, message);
+      Message message =
+          ERR_ASN1_ENUMERATED_SHORT_ELEMENT.get(encodedElement.length);
+      throw new ASN1Exception(message);
     }
 
 
@@ -252,15 +249,13 @@
       int numLengthBytes = length;
       if (numLengthBytes > 4)
       {
-        int    msgID   = MSGID_ASN1_INVALID_NUM_LENGTH_BYTES;
-        String message = getMessage(msgID, numLengthBytes);
-        throw new ASN1Exception(msgID, message);
+        Message message = ERR_ASN1_INVALID_NUM_LENGTH_BYTES.get(numLengthBytes);
+        throw new ASN1Exception(message);
       }
       else if (encodedElement.length < (2 + numLengthBytes))
       {
-        int    msgID   = MSGID_ASN1_TRUNCATED_LENGTH;
-        String message = getMessage(msgID, numLengthBytes);
-        throw new ASN1Exception(msgID, message);
+        Message message = ERR_ASN1_TRUNCATED_LENGTH.get(numLengthBytes);
+        throw new ASN1Exception(message);
       }
 
       length = 0x00;
@@ -276,19 +271,18 @@
     // in the value.
     if ((encodedElement.length - valueStartPos) != length)
     {
-      int    msgID   = MSGID_ASN1_LENGTH_MISMATCH;
-      String message = getMessage(msgID, length,
-                                  (encodedElement.length - valueStartPos));
-      throw new ASN1Exception(msgID, message);
+      Message message = ERR_ASN1_LENGTH_MISMATCH.get(
+          length, (encodedElement.length - valueStartPos));
+      throw new ASN1Exception(message);
     }
 
 
     // Make sure that the decoded length is between 1 and 4 bytes.
     if ((length < 1) || (length > 4))
     {
-      int    msgID   = MSGID_ASN1_ENUMERATED_DECODE_ARRAY_INVALID_LENGTH;
-      String message = getMessage(msgID, length);
-      throw new ASN1Exception(msgID, message);
+      Message message =
+          ERR_ASN1_ENUMERATED_DECODE_ARRAY_INVALID_LENGTH.get(length);
+      throw new ASN1Exception(message);
     }
 
 

--
Gitblit v1.10.0