All...

I searched the list but didn't see anyone else mentioning this problem so
maybe I'm doing something wrong.  I'm getting a NegativeArraySizeException
when formatting a Period.  The Period in question is 0ms.  Here's the
relevant code snippet:


PeriodFormatter durationFormat = new PeriodFormatterBuilder()
   .appendMinutes()
   .appendSeparatorIfFieldsBefore(":")
   .appendSecondsWithOptionalMillis()
   .toFormatter();

long startTime = System.currentTimeMillis();

<work done here>

Duration d = new Duration(startTime, System.currentTimeMillis());

System.out.println("Completed in " + durationFormat.print(d.toPeriod());

The result:
java.lang.NegativeArraySizeException
       at java.lang.AbstractStringBuilder.<init>(AbstractStringBuilder.java
:44)
       at java.lang.StringBuffer.<init>(StringBuffer.java:92)
       at org.joda.time.format.PeriodFormatter.print(PeriodFormatter.java
:240)
...

Am I doing something wrong?  This is with Joda-Time v1.4 running under Java
1.5.0_06.

Thanks,
Corey
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Joda-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to