Author: ronvoe122
Date: 2008-10-29 02:50:41-0700
New Revision: 10634
Modified:
trunk/src/java/org/tigris/scarab/om/Activity.java
Log:
SCB1454: bugfix: prevent a StringIndexOutOfBoundsException in the history screen. It was raised, when the history contained changes of comments which were shorter than 50 characters (eg. SCB845).
Modified: trunk/src/java/org/tigris/scarab/om/Activity.java
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/java/org/tigris/scarab/om/Activity.java?view=diff&rev=10634&p1=trunk/src/java/org/tigris/scarab/om/Activity.java&p2=trunk/src/java/org/tigris/scarab/om/Activity.java&r1=10633&r2=10634
==============================================================================
--- trunk/src/java/org/tigris/scarab/om/Activity.java (original)
+++ trunk/src/java/org/tigris/scarab/om/Activity.java 2008-10-29 02:50:41-0700
@@ -193,6 +193,13 @@
{
return ActivityType.getActivityType(this.getActivityType());
}
+
+ public static String firstChars( String s, int n )
+ {
+ int end = s.length() > n ? n : s.length();
+ return s.substring(0, end ) + "...";
+ }
+
public String getOldValue(ScarabLocalizationTool l10n)
throws Exception
{
@@ -211,7 +218,7 @@
value = getAttachment().getData();
} else if( getType().equals(ActivityType.COMMENT_CHANGED))
{
- value = getOldValue()!=null ? getOldValue().substring(0, 50) + "..." : "";
+ value = getOldValue()!=null ? firstChars( getOldValue(), 50 ) : "";
} else {
value = getOldValue()!=null ? getOldValue() : "";
}
@@ -237,7 +244,7 @@
value = getAttachment().getData();
} else if( getType().equals(ActivityType.COMMENT_CHANGED))
{
- value = getNewValue()!=null ? getNewValue().substring(0, 50) + "...": "";
+ value = getNewValue()!=null ? firstChars( getNewValue(), 50 ) : "";
} else if( getType().equals(ActivityType.OTHER))
{
value = super.getDescription()!=null ? super.getDescription() : "";
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.