Regression since joda-time 2.2

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Regression since joda-time 2.2

Jörg Schaible
Hello,

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());
================= %< =================

A test with version 2.2 reveals the same problem. Reverting to 2.1 let our
unit tests pass.

I could not see anything directly related to this new behavior in the
release notes, so I assume a regression or was there an intentional change?

- Jörg


------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and
AppDynamics. Performance Central is your source for news, insights,
analysis and resources for efficient Application Performance Management.
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Regression since joda-time 2.2

jodastephen
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.

thanks
Stephen




On 27 August 2013 11:11, Jörg Schaible <[hidden email]> wrote:

> Hello,
>
> 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());
> ================= %< =================
>
> A test with version 2.2 reveals the same problem. Reverting to 2.1 let our
> unit tests pass.
>
> I could not see anything directly related to this new behavior in the
> release notes, so I assume a regression or was there an intentional change?
>
> - Jörg
>
>
> ------------------------------------------------------------------------------
> Introducing Performance Central, a new site from SourceForge and
> AppDynamics. Performance Central is your source for news, insights,
> analysis and resources for efficient Application Performance Management.
> Visit us today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
> _______________________________________________
> Joda-interest mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/joda-interest

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Regression since joda-time 2.2

Jörg Schaible
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Loading...