You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Luca Menegus <lu...@dbmsrl.com> on 2012/05/08 19:03:02 UTC

private final DateFormat in PropertyDisplayBlocks (BUG)

Hi, 
in class org.apache.tapestry5.corelib.pages.PropertyDisplayBlocks the DateFormat is declared as : 

private final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, locale); 

Which is not correct because DateFormat is not thread safe and pages aren't pooled any more. 

Regards, 
Luca 


PS: I'm not prividing a patch because the fix is trivial 

Re: private final DateFormat in PropertyDisplayBlocks (BUG)

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Tue, 08 May 2012 17:34:29 -0300, Luca Menegus <lu...@dbmsrl.com>  
wrote:

>> Thanks! By the way, DateFormats not being thread-safe is a huge WTF.
>
> IMHO the whole Date, Calendar and DateFormat stuff are not really usable  
> (or at least are REALLY error prone).

Date and Calendar are the worst design classes in Java. A lesson in how  
not to write OOP code.

> What do you think about implementing first class support for joda-time  
> [1] in tapestry?

I think it would be a very nice idea. JIRA please! :)

> Cons:
> * That would introduce a new dependency on the joda-time library

We can provide it as a separate package.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: private final DateFormat in PropertyDisplayBlocks (BUG)

Posted by Dimitris Zenios <di...@gmail.com>.
I managed to add JodaTime into my tapestry 5 application with many
little modifications.I had to create a coercer from dateTime to date
and reverse and just contribute beanDisplayBlock and beanEditBlock to
provide ways of showing and editing jodaTime.In the end it has exactly
the same effect as using normal dates.

On Wed, May 9, 2012 at 1:43 AM, Chris Mylonas <ch...@opencsta.org> wrote:
> Pros:
> ASL
>
>
> On 09/05/2012, at 6:34 AM, Luca Menegus wrote:
>
>>> Thanks! By the way, DateFormats not being thread-safe is a huge WTF.
>>
>> IMHO the whole Date, Calendar and DateFormat stuff are not really usable (or at least are REALLY error prone).
>> What do you think about implementing first class support for joda-time [1] in tapestry?
>>
>> Cons:
>> * That would introduce a new dependency on the joda-time library
>>
>> Pros:
>> * provide and easy and proper way to handle time related data to every tapestry user
>> * provide advanced integration with the hibernate ORM framework [3]
>> * be a little ahead of times as the next java time spec is largely based on the joda experience [4] (Will it ever see the light?!)
>> * spring already supports joda (Have a look at [5], but also their validation framework and spring-data-jpa use/support joda)
>>
>> BTW it is true that it is not so difficult to plug joda into your T5 app (and Jumpstart already has an example integration [2])
>>
>>
>>
>> [1] http://joda-time.sourceforge.net/
>> [2] http://jumpstart.doublenegative.com.au/jumpstart/examples/jodatime/1
>> [3] http://usertype.sourceforge.net/
>> [4] http://jcp.org/en/jsr/detail?id=310
>> [5] http://static.springsource.org/spring/docs/3.0.x/javadoc-api/index.html?org/springframework/format/datetime/joda/package-summary.html
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: private final DateFormat in PropertyDisplayBlocks (BUG)

Posted by Chris Mylonas <ch...@opencsta.org>.
Pros:
ASL


On 09/05/2012, at 6:34 AM, Luca Menegus wrote:

>> Thanks! By the way, DateFormats not being thread-safe is a huge WTF.
> 
> IMHO the whole Date, Calendar and DateFormat stuff are not really usable (or at least are REALLY error prone).
> What do you think about implementing first class support for joda-time [1] in tapestry?
> 
> Cons:
> * That would introduce a new dependency on the joda-time library
> 
> Pros:
> * provide and easy and proper way to handle time related data to every tapestry user
> * provide advanced integration with the hibernate ORM framework [3]
> * be a little ahead of times as the next java time spec is largely based on the joda experience [4] (Will it ever see the light?!)
> * spring already supports joda (Have a look at [5], but also their validation framework and spring-data-jpa use/support joda)
> 
> BTW it is true that it is not so difficult to plug joda into your T5 app (and Jumpstart already has an example integration [2])
> 
> 
> 
> [1] http://joda-time.sourceforge.net/
> [2] http://jumpstart.doublenegative.com.au/jumpstart/examples/jodatime/1
> [3] http://usertype.sourceforge.net/
> [4] http://jcp.org/en/jsr/detail?id=310
> [5] http://static.springsource.org/spring/docs/3.0.x/javadoc-api/index.html?org/springframework/format/datetime/joda/package-summary.html
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: private final DateFormat in PropertyDisplayBlocks (BUG)

Posted by Luca Menegus <lu...@dbmsrl.com>.
> Thanks! By the way, DateFormats not being thread-safe is a huge WTF.

IMHO the whole Date, Calendar and DateFormat stuff are not really usable (or at least are REALLY error prone).
What do you think about implementing first class support for joda-time [1] in tapestry?

Cons:
* That would introduce a new dependency on the joda-time library

Pros:
* provide and easy and proper way to handle time related data to every tapestry user
* provide advanced integration with the hibernate ORM framework [3]
* be a little ahead of times as the next java time spec is largely based on the joda experience [4] (Will it ever see the light?!)
* spring already supports joda (Have a look at [5], but also their validation framework and spring-data-jpa use/support joda)

BTW it is true that it is not so difficult to plug joda into your T5 app (and Jumpstart already has an example integration [2])



[1] http://joda-time.sourceforge.net/
[2] http://jumpstart.doublenegative.com.au/jumpstart/examples/jodatime/1
[3] http://usertype.sourceforge.net/
[4] http://jcp.org/en/jsr/detail?id=310
[5] http://static.springsource.org/spring/docs/3.0.x/javadoc-api/index.html?org/springframework/format/datetime/joda/package-summary.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: private final DateFormat in PropertyDisplayBlocks (BUG)

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Tue, 08 May 2012 15:49:07 -0300, Luca Menegus <lu...@dbmsrl.com>  
wrote:

> https://issues.apache.org/jira/browse/TAP5-1926

Thanks! By the way, DateFormats not being thread-safe is a huge WTF.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: private final DateFormat in PropertyDisplayBlocks (BUG)

Posted by Luca Menegus <lu...@dbmsrl.com>.
https://issues.apache.org/jira/browse/TAP5-1926

Thanks,
 luca


----- Original Message -----
> From: "Howard Lewis Ship" <hl...@gmail.com>
> To: "Tapestry users" <us...@tapestry.apache.org>
> Sent: Tuesday, 8 May, 2012 8:36:12 PM
> Subject: Re: private final DateFormat in PropertyDisplayBlocks (BUG)
> 
> Please add an issue in JIRA and this will be fixed.  Good catch.
> 
> On Tue, May 8, 2012 at 10:03 AM, Luca Menegus
> <lu...@dbmsrl.com> wrote:
> > Hi,
> > in class org.apache.tapestry5.corelib.pages.PropertyDisplayBlocks
> > the DateFormat is declared as :
> >
> > private final DateFormat dateFormat =
> > DateFormat.getDateInstance(DateFormat.MEDIUM, locale);
> >
> > Which is not correct because DateFormat is not thread safe and
> > pages aren't pooled any more.
> >
> > Regards,
> > Luca
> >
> >
> > PS: I'm not prividing a patch because the fix is trivial
> 
> 
> 
> --
> Howard M. Lewis Ship
> 
> Creator of Apache Tapestry
> 
> The source for Tapestry training, mentoring and support. Contact me
> to
> learn how I can get you up and productive in Tapestry fast!
> 
> (971) 678-5210
> http://howardlewisship.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: private final DateFormat in PropertyDisplayBlocks (BUG)

Posted by Howard Lewis Ship <hl...@gmail.com>.
Please add an issue in JIRA and this will be fixed.  Good catch.

On Tue, May 8, 2012 at 10:03 AM, Luca Menegus <lu...@dbmsrl.com> wrote:
> Hi,
> in class org.apache.tapestry5.corelib.pages.PropertyDisplayBlocks the DateFormat is declared as :
>
> private final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, locale);
>
> Which is not correct because DateFormat is not thread safe and pages aren't pooled any more.
>
> Regards,
> Luca
>
>
> PS: I'm not prividing a patch because the fix is trivial



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org