From f2160f4bd1c8ac67e5a86a6710d431e8932877f9 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Fri, 28 May 2010 11:47:51 +0000
Subject: [PATCH] Synchronize SDK on java.net with internal repository.

---
 sdk/src/org/opends/sdk/LocalizableMessage.java |  270 +++++++++++++++++++++++++----------------------------
 1 files changed, 128 insertions(+), 142 deletions(-)

diff --git a/sdk/src/org/opends/sdk/LocalizableMessage.java b/sdk/src/org/opends/sdk/LocalizableMessage.java
index 58fbf4b..d38f7ec 100755
--- a/sdk/src/org/opends/sdk/LocalizableMessage.java
+++ b/sdk/src/org/opends/sdk/LocalizableMessage.java
@@ -40,25 +40,24 @@
 
 
 /**
- * A localizable message whose {@code String} representation can be
- * retrieved in one or more locales. A message is localized each time it
- * is converted to a {@code String} using one of its {@link #toString}
- * methods.
+ * A localizable message whose {@code String} representation can be retrieved in
+ * one or more locales. A message is localized each time it is converted to a
+ * {@code String} using one of its {@link #toString} methods.
  * <p>
- * Localizable messages are particularly useful in situations where a
- * message a destined for multiple recipients, potentially in different
- * locales. For example, a server application may record a message in
- * its log file using its default locale, but also send the same message
- * to the client using the client's locale (if known).
+ * Localizable messages are particularly useful in situations where a message a
+ * destined for multiple recipients, potentially in different locales. For
+ * example, a server application may record a message in its log file using its
+ * default locale, but also send the same message to the client using the
+ * client's locale (if known).
  * <p>
- * In most cases messages are intended for use in a locale-sensitive
- * manner although this class defines convenience methods for creating
- * uninternationalized messages whose {@code String} representation is
- * always the same regardless of the requested locale.
+ * In most cases messages are intended for use in a locale-sensitive manner
+ * although this class defines convenience methods for creating
+ * uninternationalized messages whose {@code String} representation is always
+ * the same regardless of the requested locale.
  * <p>
- * This class implements {@code CharSequence} so that messages can be
- * supplied as arguments to other messages. This way messages can be
- * composed of fragments of other messages if necessary.
+ * This class implements {@code CharSequence} so that messages can be supplied
+ * as arguments to other messages. This way messages can be composed of
+ * fragments of other messages if necessary.
  *
  * @see LocalizableMessageBuilder
  */
@@ -67,11 +66,11 @@
 {
   static
   {
-    LocalizableMessageDescriptor.MESSAGE_FACTORY = new LocalizableMessageDescriptor.MessageFactory()
+    LocalizableMessageDescriptor.messageFactory = new LocalizableMessageDescriptor.MessageFactory()
     {
 
-      public LocalizableMessage newMessage(LocalizableMessageDescriptor descriptor,
-          Object... args)
+      public LocalizableMessage newMessage(
+          final LocalizableMessageDescriptor descriptor, final Object... args)
       {
         return new LocalizableMessage(descriptor, args);
       }
@@ -91,30 +90,28 @@
 
 
   /**
-   * Creates an uninternationalized message whose {@code String}
-   * representation is always the same regardless of the requested
-   * locale.
+   * Creates an uninternationalized message whose {@code String} representation
+   * is always the same regardless of the requested locale.
    * <p>
-   * Note that the types for {@code args} must be consistent with any
-   * argument specifiers appearing in {@code formatString} according to
-   * the rules of {@link java.util.Formatter}. A mismatch in type
-   * information will cause this message to render without argument
-   * substitution. Before using this method you should be sure that the
-   * message you are creating is not locale sensitive. If it is locale
-   * sensitive consider defining an appropriate
+   * Note that the types for {@code args} must be consistent with any argument
+   * specifiers appearing in {@code formatString} according to the rules of
+   * {@link java.util.Formatter}. A mismatch in type information will cause this
+   * message to render without argument substitution. Before using this method
+   * you should be sure that the message you are creating is not locale
+   * sensitive. If it is locale sensitive consider defining an appropriate
    * {@link LocalizableMessageDescriptor}.
    *
    * @param formatString
    *          The raw message format string.
    * @param args
    *          The raw message parameters.
-   * @return An uninternationalized messages whose {@code String}
-   *         representation is always the same regardless of the
-   *         requested locale.
+   * @return An uninternationalized messages whose {@code String} representation
+   *         is always the same regardless of the requested locale.
    * @throws NullPointerException
    *           If {@code formatString} was {@code null}.
    */
-  public static LocalizableMessage raw(CharSequence formatString, Object... args)
+  public static LocalizableMessage raw(final CharSequence formatString,
+      final Object... args) throws NullPointerException
   {
     Validator.ensureNotNull(formatString);
     return new LocalizableMessageDescriptor.Raw(formatString).get(args);
@@ -123,15 +120,14 @@
 
 
   /**
-   * Creates a new message whose content is the {@code String}
-   * representation of the provided {@code Object}.
+   * Creates a new message whose content is the {@code String} representation of
+   * the provided {@code Object}.
    *
    * @param object
-   *          The object to be converted to a message, may be {@code
-   *          null}.
+   *          The object to be converted to a message, may be {@code null}.
    * @return The new message.
    */
-  public static LocalizableMessage valueOf(Object object)
+  public static LocalizableMessage valueOf(final Object object)
   {
     if (object instanceof LocalizableMessage)
     {
@@ -152,8 +148,8 @@
   /**
    * Returns whether we are running post 1.5 on AIX or not.
    *
-   * @return {@code true} if we are running post 1.5 on AIX and {@code
-   *         false} otherwise.
+   * @return {@code true} if we are running post 1.5 on AIX and {@code false}
+   *         otherwise.
    */
   private static boolean isAIXPost5()
   {
@@ -169,8 +165,7 @@
     {
       System.err.println("Cannot get the java version: " + t);
     }
-    final boolean isAIX = "aix".equalsIgnoreCase(System
-        .getProperty("os.name"));
+    final boolean isAIX = "aix".equalsIgnoreCase(System.getProperty("os.name"));
     return !isJDK15 && isAIX;
   }
 
@@ -185,15 +180,16 @@
 
 
   /**
-   * Creates a new parameterized message instance. See the class header
-   * for instructions on how to create messages outside of this package.
+   * Creates a new parameterized message instance. See the class header for
+   * instructions on how to create messages outside of this package.
    *
    * @param descriptor
    *          The message descriptor.
    * @param args
    *          The message parameters.
    */
-  private LocalizableMessage(LocalizableMessageDescriptor descriptor, Object... args)
+  private LocalizableMessage(final LocalizableMessageDescriptor descriptor,
+      final Object... args)
   {
     this.descriptor = descriptor;
     this.args = args;
@@ -202,18 +198,17 @@
 
 
   /**
-   * Returns the {@code char} value at the specified index of the
-   * {@code String} representation of this message in the default
-   * locale.
+   * Returns the {@code char} value at the specified index of the {@code String}
+   * representation of this message in the default locale.
    *
    * @param index
    *          The index of the {@code char} value to be returned.
    * @return The specified {@code char} value.
    * @throws IndexOutOfBoundsException
-   *           If the {@code index} argument is negative or not less
-   *           than {@code length()}.
+   *           If the {@code index} argument is negative or not less than
+   *           {@code length()}.
    */
-  public char charAt(int index) throws IndexOutOfBoundsException
+  public char charAt(final int index) throws IndexOutOfBoundsException
   {
     return charAt(Locale.getDefault(), index);
   }
@@ -221,9 +216,8 @@
 
 
   /**
-   * Returns the {@code char} value at the specified index of the
-   * {@code String} representation of this message in the specified
-   * locale.
+   * Returns the {@code char} value at the specified index of the {@code String}
+   * representation of this message in the specified locale.
    *
    * @param locale
    *          The locale.
@@ -231,12 +225,12 @@
    *          The index of the {@code char} value to be returned.
    * @return The specified {@code char} value.
    * @throws IndexOutOfBoundsException
-   *           If the {@code index} argument is negative or not less
-   *           than {@code length()}.
+   *           If the {@code index} argument is negative or not less than
+   *           {@code length()}.
    * @throws NullPointerException
    *           If {@code locale} was {@code null}.
    */
-  public char charAt(Locale locale, int index)
+  public char charAt(final Locale locale, final int index)
       throws IndexOutOfBoundsException, NullPointerException
   {
     return toString(locale).charAt(index);
@@ -245,18 +239,16 @@
 
 
   /**
-   * Compares this message with the specified message for order in the
-   * default locale. Returns a negative integer, zero, or a positive
-   * integer as this object is less than, equal to, or greater than the
-   * specified object.
+   * Compares this message with the specified message for order in the default
+   * locale. Returns a negative integer, zero, or a positive integer as this
+   * object is less than, equal to, or greater than the specified object.
    *
    * @param message
    *          The message to be compared.
-   * @return A negative integer, zero, or a positive integer as this
-   *         object is less than, equal to, or greater than the
-   *         specified object.
+   * @return A negative integer, zero, or a positive integer as this object is
+   *         less than, equal to, or greater than the specified object.
    */
-  public int compareTo(LocalizableMessage message)
+  public int compareTo(final LocalizableMessage message)
   {
     return toString().compareTo(message.toString());
   }
@@ -264,16 +256,17 @@
 
 
   /**
-   * Returns {@code true} if the provided object is a message whose
-   * {@code String} representation is equal to the {@code String}
-   * representation of this message in the default locale.
+   * Returns {@code true} if the provided object is a message whose {@code
+   * String} representation is equal to the {@code String} representation of
+   * this message in the default locale.
    *
    * @param o
    *          The object to be compared for equality with this message.
-   * @return {@code true} if this message is the equal to {@code o},
-   *         otherwise {@code false}.
+   * @return {@code true} if this message is the equal to {@code o}, otherwise
+   *         {@code false}.
    */
-  public boolean equals(Object o)
+  @Override
+  public boolean equals(final Object o)
   {
     if (this == o)
     {
@@ -298,38 +291,35 @@
    * @param formatter
    *          The {@link Formatter}.
    * @param flags
-   *          The flags modify the output format. The value is
-   *          interpreted as a bitmask. Any combination of the following
-   *          flags may be set:
+   *          The flags modify the output format. The value is interpreted as a
+   *          bitmask. Any combination of the following flags may be set:
    *          {@link java.util.FormattableFlags#LEFT_JUSTIFY},
    *          {@link java.util.FormattableFlags#UPPERCASE}, and
-   *          {@link java.util.FormattableFlags#ALTERNATE}. If no flags
-   *          are set, the default formatting of the implementing class
-   *          will apply.
+   *          {@link java.util.FormattableFlags#ALTERNATE}. If no flags are set,
+   *          the default formatting of the implementing class will apply.
    * @param width
-   *          The minimum number of characters to be written to the
-   *          output. If the length of the converted value is less than
-   *          the {@code width} then the output will be padded by white
-   *          space until the total number of characters equals width.
-   *          The padding is at the beginning by default. If the
-   *          {@link java.util.FormattableFlags#LEFT_JUSTIFY} flag is
-   *          set then the padding will be at the end. If {@code width}
+   *          The minimum number of characters to be written to the output. If
+   *          the length of the converted value is less than the {@code width}
+   *          then the output will be padded by white space until the total
+   *          number of characters equals width. The padding is at the beginning
+   *          by default. If the {@link java.util.FormattableFlags#LEFT_JUSTIFY}
+   *          flag is set then the padding will be at the end. If {@code width}
    *          is {@code -1} then there is no minimum.
    * @param precision
-   *          The maximum number of characters to be written to the
-   *          output. The precision is applied before the width, thus
-   *          the output will be truncated to {@code precision}
-   *          characters even if the {@code width} is greater than the
-   *          {@code precision}. If {@code precision} is {@code -1} then
-   *          there is no explicit limit on the number of characters.
+   *          The maximum number of characters to be written to the output. The
+   *          precision is applied before the width, thus the output will be
+   *          truncated to {@code precision} characters even if the {@code
+   *          width} is greater than the {@code precision}. If {@code precision}
+   *          is {@code -1} then there is no explicit limit on the number of
+   *          characters.
    * @throws IllegalFormatException
-   *           If any of the parameters are invalid. For specification
-   *           of all possible formatting errors, see the <a
-   *           href="../util/Formatter.html#detail">Details</a> section
-   *           of the formatter class specification.
+   *           If any of the parameters are invalid. For specification of all
+   *           possible formatting errors, see the <a
+   *           href="../util/Formatter.html#detail">Details</a> section of the
+   *           formatter class specification.
    */
-  public void formatTo(Formatter formatter, int flags, int width,
-      int precision) throws IllegalFormatException
+  public void formatTo(final Formatter formatter, final int flags,
+      final int width, final int precision) throws IllegalFormatException
   {
     // Ignores flags, width and precision for now.
     // see javadoc for Formattable
@@ -340,12 +330,12 @@
 
 
   /**
-   * Returns the hash code value for this message calculated using the
-   * hash code of the {@code String} representation of this message in
-   * the default locale.
+   * Returns the hash code value for this message calculated using the hash code
+   * of the {@code String} representation of this message in the default locale.
    *
    * @return The hash code value for this message.
    */
+  @Override
   public int hashCode()
   {
     return toString().hashCode();
@@ -354,11 +344,11 @@
 
 
   /**
-   * Returns the length of the {@code String} representation of this
-   * message in the default locale.
+   * Returns the length of the {@code String} representation of this message in
+   * the default locale.
    *
-   * @return The length of the {@code String} representation of this
-   *         message in the default locale.
+   * @return The length of the {@code String} representation of this message in
+   *         the default locale.
    */
   public int length()
   {
@@ -368,17 +358,17 @@
 
 
   /**
-   * Returns the length of the {@code String} representation of this
-   * message in the specified locale.
+   * Returns the length of the {@code String} representation of this message in
+   * the specified locale.
    *
    * @param locale
    *          The locale.
-   * @return The length of the {@code String} representation of this
-   *         message in the specified locale.
+   * @return The length of the {@code String} representation of this message in
+   *         the specified locale.
    * @throws NullPointerException
    *           If {@code locale} was {@code null}.
    */
-  public int length(Locale locale) throws NullPointerException
+  public int length(final Locale locale) throws NullPointerException
   {
     return toString(locale).length();
   }
@@ -386,13 +376,12 @@
 
 
   /**
-   * Returns a new {@code CharSequence} which is a subsequence of the
-   * {@code String} representation of this message in the default
-   * locale. The subsequence starts with the {@code char} value at the
-   * specified index and ends with the {@code char} value at index
-   * {@code end - 1} . The length (in {@code char}s) of the returned
-   * sequence is {@code end - start}, so if {@code start == end} then an
-   * empty sequence is returned.
+   * Returns a new {@code CharSequence} which is a subsequence of the {@code
+   * String} representation of this message in the default locale. The
+   * subsequence starts with the {@code char} value at the specified index and
+   * ends with the {@code char} value at index {@code end - 1} . The length (in
+   * {@code char}s) of the returned sequence is {@code end - start}, so if
+   * {@code start == end} then an empty sequence is returned.
    *
    * @param start
    *          The start index, inclusive.
@@ -400,11 +389,11 @@
    *          The end index, exclusive.
    * @return The specified subsequence.
    * @throws IndexOutOfBoundsException
-   *           If {@code start} or {@code end} are negative, if {@code
-   *           end} is greater than {@code length()}, or if {@code
-   *           start} is greater than {@code end}.
+   *           If {@code start} or {@code end} are negative, if {@code end} is
+   *           greater than {@code length()}, or if {@code start} is greater
+   *           than {@code end}.
    */
-  public CharSequence subSequence(int start, int end)
+  public CharSequence subSequence(final int start, final int end)
       throws IndexOutOfBoundsException
   {
     return subSequence(Locale.getDefault(), start, end);
@@ -413,13 +402,12 @@
 
 
   /**
-   * Returns a new {@code CharSequence} which is a subsequence of the
-   * {@code String} representation of this message in the specified
-   * locale. The subsequence starts with the {@code char} value at the
-   * specified index and ends with the {@code char} value at index
-   * {@code end - 1} . The length (in {@code char}s) of the returned
-   * sequence is {@code end - start}, so if {@code start == end} then an
-   * empty sequence is returned.
+   * Returns a new {@code CharSequence} which is a subsequence of the {@code
+   * String} representation of this message in the specified locale. The
+   * subsequence starts with the {@code char} value at the specified index and
+   * ends with the {@code char} value at index {@code end - 1} . The length (in
+   * {@code char}s) of the returned sequence is {@code end - start}, so if
+   * {@code start == end} then an empty sequence is returned.
    *
    * @param locale
    *          The locale.
@@ -429,14 +417,14 @@
    *          The end index, exclusive.
    * @return The specified subsequence.
    * @throws IndexOutOfBoundsException
-   *           If {@code start} or {@code end} are negative, if {@code
-   *           end} is greater than {@code length()}, or if {@code
-   *           start} is greater than {@code end}.
+   *           If {@code start} or {@code end} are negative, if {@code end} is
+   *           greater than {@code length()}, or if {@code start} is greater
+   *           than {@code end}.
    * @throws NullPointerException
    *           If {@code locale} was {@code null}.
    */
-  public CharSequence subSequence(Locale locale, int start, int end)
-      throws IndexOutOfBoundsException, NullPointerException
+  public CharSequence subSequence(final Locale locale, final int start,
+      final int end) throws IndexOutOfBoundsException, NullPointerException
   {
     return toString(locale).subSequence(start, end);
   }
@@ -444,11 +432,12 @@
 
 
   /**
-   * Returns the {@code String} representation of this message in the
-   * default locale.
+   * Returns the {@code String} representation of this message in the default
+   * locale.
    *
    * @return The {@code String} representation of this message.
    */
+  @Override
   public String toString()
   {
     return toString(Locale.getDefault());
@@ -457,8 +446,8 @@
 
 
   /**
-   * Returns the {@code String} representation of this message in the
-   * specified locale.
+   * Returns the {@code String} representation of this message in the specified
+   * locale.
    *
    * @param locale
    *          The locale.
@@ -466,7 +455,7 @@
    * @throws NullPointerException
    *           If {@code locale} was {@code null}.
    */
-  public String toString(Locale locale) throws NullPointerException
+  public String toString(final Locale locale) throws NullPointerException
   {
     String s;
     final String fmt = descriptor.getFormatString(locale);
@@ -504,19 +493,16 @@
                 newArgs[i] = args[i];
               }
             }
-            s = new Formatter(locale).format(locale, fmt, newArgs)
-                .toString();
+            s = new Formatter(locale).format(locale, fmt, newArgs).toString();
           }
           else
           {
-            s = new Formatter(locale).format(locale, fmt, args)
-                .toString();
+            s = new Formatter(locale).format(locale, fmt, args).toString();
           }
         }
         else
         {
-          s = new Formatter(locale).format(locale, fmt, args)
-              .toString();
+          s = new Formatter(locale).format(locale, fmt, args).toString();
         }
       }
       catch (final IllegalFormatException e)

--
Gitblit v1.10.0