[jboss-svn-commits] JBL Code SVN: r10089 - in labs/jbossforums/branches/forums101P26/forums/src: resources/portal-forums-war/WEB-INF and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Mar 9 08:31:09 EST 2007


Author: unibrew
Date: 2007-03-09 08:31:08 -0500 (Fri, 09 Mar 2007)
New Revision: 10089

Modified:
   labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/ui/ForumUtil.java
   labs/jbossforums/branches/forums101P26/forums/src/resources/portal-forums-war/WEB-INF/forums.taglib.xml
Log:
[JBFORUMS-190] New method to cope with empty Strings. Not used in 2.6 branch but might be useful in future.

Modified: labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/ui/ForumUtil.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/ui/ForumUtil.java	2007-03-09 13:08:37 UTC (rev 10088)
+++ labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/ui/ForumUtil.java	2007-03-09 13:31:08 UTC (rev 10089)
@@ -128,6 +128,15 @@
         return string.length()>length;
     }
     
+    public static String nullIfEmptyString( String string )
+    {
+        if (string==null || string.trim().length()==0)
+        {
+            return null;
+        }
+        return string.trim();
+    }
+    
     public static Post getLastPost(ForumsModule fm, Forum forum)
     {
         try

Modified: labs/jbossforums/branches/forums101P26/forums/src/resources/portal-forums-war/WEB-INF/forums.taglib.xml
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/resources/portal-forums-war/WEB-INF/forums.taglib.xml	2007-03-09 13:08:37 UTC (rev 10088)
+++ labs/jbossforums/branches/forums101P26/forums/src/resources/portal-forums-war/WEB-INF/forums.taglib.xml	2007-03-09 13:31:08 UTC (rev 10089)
@@ -125,6 +125,15 @@
         <function-class>org.jboss.portlet.forums.ui.ForumUtil</function-class>
         <function-signature>boolean isLongerThan( java.lang.String , int )</function-signature>
     </function>
+    
+    <!-- 
+        Simple method which trims given in parameter string.
+    -->
+    <function>
+        <function-name>nullIfEmptyString</function-name>
+        <function-class>org.jboss.portlet.forums.ui.ForumUtil</function-class>
+        <function-signature>java.lang.String nullIfEmptyString( java.lang.String )</function-signature>
+    </function>
     
 	<!-- 
 		 function to get theme URL location




More information about the jboss-svn-commits mailing list