package org.zanata.util;

/**
 * ShortStrings are meant for use in logging. They don't incur the cost of
 * shortening until toString() is called. This means they hold on to the entire
 * string, so don't bother keeping them around in memory for long.
 * 
 * @author Sean Flanigan <a
 *         href="mailto:sflaniga@redhat.com">sflaniga@redhat.com</a>
 * 
 */
public class ShortString
{

   static final int MAX_LENGTH = 66;
   private static final String ELLIPSIS = "…";
   private String input;

   public ShortString(String input)
   {
      this.input = input;
   }

   @Override
   public String toString()
   {
      return input = shorten(input);
   }

   public static String shorten(String s)
   {
      if (s.length() <= MAX_LENGTH)
         return s;
      return s.substring(0, MAX_LENGTH - ELLIPSIS.length()) + ELLIPSIS;
   }

}

@@ -19,16 +19,68 @@
 .util;%0A%0A
+import java.util.ArrayList;%0Aimport java.util.List;%0A%0A
 /**%0A * S
@@ -886,10 +886,321 @@
 ;%0A   %7D%0A%0A
+   /**%0A    * @param strings%0A    * @return%0A    */%0A   public static String shorten(List%3CString%3E strings)%0A   %7B%0A      List%3CString%3E shortStrings = new ArrayList%3CString%3E(strings.size());%0A      for (String s : strings)%0A      %7B%0A         shortStrings.add(shorten(s));%0A      %7D%0A      return shortStrings.toString();%0A   %7D%0A%0A
 %7D%0A

Change GetTransMemoryHandler to return multiple strings per TextFlow