Hi,

I am trying to use joda-time for xml schema duration type parsing. After 
creating some junit tests I wasn't able to parse the value 
"PT1003199059S" with "new 
PeriodFormatterBuilder().rejectSignedValues(true).append(ISOPeriodFormat.standard()
 
).toFormatter();" Therefore I played around with the 
PeriodFormatterBuilder and built a new test which is:

  public void testPeriod() {

      PeriodFormatterBuilder pfmtbuilder1 = new 
PeriodFormatterBuilder().rejectSignedValues(true)
   .appendLiteral("P")
   .appendYears()
   .appendSuffix("Y")
   .appendMonths()
   .appendSuffix("M")
   .appendWeeks()
   .appendSuffix("W")
   .appendDays()
   .appendSuffix("D")
   .appendSeparatorIfFieldsAfter("T")
   .appendHours()
   .appendSuffix("H")
   .appendMinutes()
   .appendSuffix("M")
   .appendSecondsWithOptionalMillis()
   .appendSuffix("S");

      PeriodFormatterBuilder pfmtbuilder2 = new 
PeriodFormatterBuilder().rejectSignedValues(true);             
PeriodFormatter pfmt1 = pfmtbuilder1.toFormatter();
   PeriodFormatter pfmt2 = 
pfmtbuilder2.append(ISOPeriodFormat.standard() ).toFormatter();

   pfmt1.parsePeriod("PT1003199059S");
   pfmt2.parsePeriod("PT1003199059S");
}


In my opinion both PeriodFormatters should be equal because I copied the 
code of pfmtbuilder1 from ISOPeriodFormat.standard() but 
pfmt2.parsePeriod("PT1003199059S") always fails.

Is this a bug of joda-time or is this behaviour intented? My version of 
joda-time is 1.6.


-- 
/Bjoern Ricks

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Joda-interest mailing list
Joda-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to