Scarab commit: svn commit: r10735 - trunk/src/java/org/tigris/scarab/om/NotificationStatus.java

Hussayn Dabbous <[email protected]>
Newsgroups gmane.comp.java.scarab.cvs
Message-ID <[email protected]>
Author: dabbous
Date: 2009-05-29 15:57:02-0700
New Revision: 10735

Modified:
   trunk/src/java/org/tigris/scarab/om/NotificationStatus.java

Log:
SCB2873: truncate the Comment string when the reproted error message length exceed the allowed 256 characters

Modified: trunk/src/java/org/tigris/scarab/om/NotificationStatus.java
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/java/org/tigris/scarab/om/NotificationStatus.java?view=diff&pathrev=10735&r1=10734&r2=10735
==============================================================================
--- trunk/src/java/org/tigris/scarab/om/NotificationStatus.java	(original)
+++ trunk/src/java/org/tigris/scarab/om/NotificationStatus.java	2009-05-29 15:57:02-0700
@@ -49,6 +49,7 @@
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
+import org.apache.commons.lang.ObjectUtils;
 import org.apache.torque.TorqueException;
 import org.apache.torque.om.Persistent;
 import org.apache.torque.util.Criteria;
@@ -75,7 +76,9 @@
     static public final Integer MARK_DELETED   = new Integer(6);
     
     static private final Integer ARCHIVER_ID   = new Integer(-1);
-       
+
+    static public final int MAX_COMMENT_STATUS_LENGTH = 255;
+    
     private ActivityType activityType;
     private Long issueId;
     
@@ -276,4 +279,18 @@
         return rdo;
     }    
 
+    /**
+     * Set the value of Comment
+     *
+     * @param v new value
+     */
+    public void setComment(String v) 
+    {
+        if(v != null && v.length() > MAX_COMMENT_STATUS_LENGTH)
+        {
+            v = v.substring(0, MAX_COMMENT_STATUS_LENGTH - 4) + " ...";
+        }
+        super.setComment(v);
+    }
+
 }

------------------------------------------------------
http://scarab.tigris.org/ds/viewMessage.do?dsForumId=3577&dsMessageId=2357014
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.