esme-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vdic...@apache.org
Subject svn commit: r1022916 - /incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/Message.scala
Date Fri, 15 Oct 2010 13:45:09 GMT
Author: vdichev
Date: Fri Oct 15 13:45:09 2010
New Revision: 1022916

URL: http://svn.apache.org/viewvc?rev=1022916&view=rev
Log:
Fix exception on short urls.

Modified:
    incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/Message.scala

Modified: incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/Message.scala
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/Message.scala?rev=1022916&r1=1022915&r2=1022916&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/Message.scala (original)
+++ incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/Message.scala Fri Oct
15 13:45:09 2010
@@ -401,7 +401,12 @@ class Message extends LongKeyedMapper[Me
                   url.toString
                 else
                   "/u/" + id
-              <xml:group> <a class="tiplelement" href={href} target="_blank" title={url}>{url.toString.substring(0,20)}...</a>
</xml:group>
+              def truncateUrl(urlString: String, len: Int) =
+                if (urlString.length <= len)
+                  urlString
+                else
+                  urlString.substring(0, len - 3) + "..."
+              <xml:group> <a class="tiplelement" href={href} target="_blank" title={url}>{truncateUrl(url.toString,
20)}</a> </xml:group>
             }
           ).getOrElse(Text("") )
 



Mime
View raw message