users@jaxb.java.net

Re: JAXB and calendar datas

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Wed, 03 Mar 2004 09:57:10 -0800

> This took me to the source code for MSV, and I believe that the code in
> question is the class com.sun.msv.datatype.xsd.datetime.CalendarFormatter
> and the function is as follows:
>
> protected void formatSeconds(Object _cal, StringBuffer buf) {
> Calendar cal = (Calendar)_cal;
> formatTwoDigits(cal.get(Calendar.SECOND),buf);
> if (cal.isSet(Calendar.MILLISECOND)) { // milliseconds
> int n = cal.get(Calendar.MILLISECOND);
> if(n!=0) {
> String ms = Integer.toString(n);
> while (ms.length() < 3)
> ms = "0" + ms; // left 0 paddings.
>
> buf.append('.');
> buf.append(ms);
> }
> }
> }
>
>
> Thus as you can see it doesn't print the 000 when the milliseconds are not
> set but it also doesn't print milliseconds when they are 0.

D'oh!

Thank you very much for looking into this.

So I guess this is a bug, right?

regards,
--
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net