Hi Stephen,

Stephen Colebourne wrote:

> This was changed here:
> https://github.com/JodaOrg/joda-time/commit/46b817a006e768865b1f0d2896e814dfa2d3244f
> 
> It basically makes the builder behave more correctly.
> 
> Your test code is adding an optional parser to the builder and then
> trying to retrieve a printer. That deosn't seem like a reasonable
> thing to expect to work.

Actually I don't know, how old this code is - resp. what version of joda-
time was used when it was developed. 

>> we tried to upgrade from joda-time 2.1 to 2.3, but we get now NPEs,
>> because our DateTimeFormatter instance suddenly has no longer a printer:
>>
>> ================= %< =================
>>  DateTimeFormatter FORMATTER = new DateTimeFormatterBuilder()
>>    .appendMonthOfYear(2)
>>    .appendOptional(
>>       new DateTimeFormatterBuilder().appendLiteral('-').toParser())
>>    .appendDayOfMonth(2)
>>    .toFormatter();
>>  assertNotNull(FORMATTER.getPrinter());
>> ================= %< =================

The formatter was actually never used to parse, we always used only the 
printer to support negative day of month values. Funny enough, those 
negative values are already printed with joda-time 2.1 without the optional 
part. So, in the end it seems to be a case of bitrot ;-)

Cheers and thanks for your help,
Jörg


------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________
Joda-interest mailing list
Joda-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to