[jboss-user] [JBoss Seam] - s:selectDate render problem

rmemoria do-not-reply at jboss.com
Fri Mar 9 09:51:56 EST 2007


Hi,

I had no idea how to warn about bugs found+corrected in the source code, so I'm sending it here.

A few posts ago I related a problem wiht the s:selectDate tag and the Romanian language. Acctually I found that the DateFormatSymbols.ShortWeekdays using the romanian locale returns strings with length of 1 char:

D,L,Ma,Mi,J,V,S

I checked the method ui.org.jboss.seam.ui.UISelectDate.commaSeparate and found a problem there:

The code in use:

    private String commaSeparate(String[] values, int maxLength)
  |     {
  |        StringBuilder sb = new StringBuilder();
  |        for (String val : values)
  |        {
  |           if (!"".equals(val))
  |           {
  |              if (sb.length() > 0) sb.append(',');
  |              sb.append(maxLength == -1 ? val : val.substring(0, maxLength));
  |           }
  |        }
  |        return sb.toString();
  |     }

I just replaced the 
             sb.append(maxLength == -1 ? val : val.substring(0, maxLength));
by

   sb.append((maxLength == -1) || (val.length() < maxLength) ? val : val.substring(0, maxLength));
and now it's working fine.

Best,
Ricardo

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4026616#4026616

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4026616



More information about the jboss-user mailing list