From b366de49e330e1ebd93bb10ee3ebbd1e35d249bb Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Thu, 23 Aug 2007 18:08:08 +0000
Subject: [PATCH] Message/MessageDescriptor performance improvements:

---
 opends/src/messages/src/org/opends/messages/Message.java |   17 +----------------
 1 files changed, 1 insertions(+), 16 deletions(-)

diff --git a/opends/src/messages/src/org/opends/messages/Message.java b/opends/src/messages/src/org/opends/messages/Message.java
index d673a36..65efcb9 100644
--- a/opends/src/messages/src/org/opends/messages/Message.java
+++ b/opends/src/messages/src/org/opends/messages/Message.java
@@ -172,7 +172,7 @@
   public String toString(Locale locale) {
     String s;
     String fmt = descriptor.getFormatString(locale);
-    if (needsFormatting(fmt)) {
+    if (descriptor.requiresFormatter()) {
       try {
         s = new Formatter(locale).format(locale, fmt, args).toString();
       } catch (IllegalFormatException e) {
@@ -371,19 +371,4 @@
     return result;
   }
 
-  /**
-   * Indicates whether or not formatting should be applied
-   * to the given format string.  Note that a format string
-   * might have literal specifiers (%% or %n for example) that
-   * require formatting but are not replaced by arguments.
-   * @param s candiate for formatting
-   * @return boolean where true indicates that the format
-   *         string requires formatting
-   */
-  protected boolean needsFormatting(String s) {
-    return s != null &&
-            ((args != null && args.length > 0)
-                   || s.matches(".*%[n|%].*")); // match Formatter literals
-  }
-
 }

--
Gitblit v1.10.0