myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jankeesvanan...@apache.org
Subject svn commit: r800040 - /myfaces/core/trunk/api/src/main/java/javax/faces/validator/ValidatorException.java
Date Sun, 02 Aug 2009 12:21:52 GMT
Author: jankeesvanandel
Date: Sun Aug  2 12:21:51 2009
New Revision: 800040

URL: http://svn.apache.org/viewvc?rev=800040&view=rev
Log:
MYFACES-2280 ValidatorException should support collections of messages.

Modified:
    myfaces/core/trunk/api/src/main/java/javax/faces/validator/ValidatorException.java   (contents,
props changed)

Modified: myfaces/core/trunk/api/src/main/java/javax/faces/validator/ValidatorException.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/validator/ValidatorException.java?rev=800040&r1=800039&r2=800040&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/java/javax/faces/validator/ValidatorException.java (original)
+++ myfaces/core/trunk/api/src/main/java/javax/faces/validator/ValidatorException.java Sun
Aug  2 12:21:51 2009
@@ -26,9 +26,9 @@
 /**
  * see Javadoc of <a href="http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/index.html">JSF
Specification</a>
  *
- * @author Manfred Geiler (latest modification by $Author$)
+ * @author Manfred Geiler (latest modification by $Author: mconcini $)
  * @author Thomas Spiegl
- * @version $Revision$ $Date$
+ * @version $Revision: 798178 $ $Date: 2009-07-27 16:52:07 +0200 (ma, 27 jul 2009) $
  */
 public class ValidatorException
         extends FacesException
@@ -92,33 +92,33 @@
     
     private static String facesMessagesToString(Collection<FacesMessage> messages)
     {
-        if(messages == null || messages.isEmpty())
+        if (messages == null || messages.isEmpty())
         {
             return "";
         }
-        StringBuffer buffer = new StringBuffer("");
-        
-        for(FacesMessage message : messages)
+        StringBuilder sb = new StringBuilder();
+
+        String separator = "";
+        for (FacesMessage message : messages)
         {
-            if(message != null)
+            if (message != null)
             {
                 String summary = message.getSummary();
                 String detail = message.getDetail();
                 
                 if (summary != null)
                 {
+                    sb.append(separator);
+                    sb.append(summary);
                     if (detail != null)
                     {
-                        buffer.append(summary + ": " + detail);
-                    }
-                    else
-                    {
-                        buffer.append(summary);
+                        sb.append(": ");
+                        sb.append(detail);
                     }
+                    separator = ", ";
                 }
             }
-            
         }
-        return buffer.toString();
+        return sb.toString();
     }
 }

Propchange: myfaces/core/trunk/api/src/main/java/javax/faces/validator/ValidatorException.java
            ('svn:keywords' removed)



Mime
View raw message