Beans with scope longer than request and serialization

UI Components for JSF
Post Reply
mkuthan
Posts: 10
Joined: 25 Jun 2010, 10:54

07 Sep 2010, 09:41

Hi,

Recently I ran Findbugs against my project. In managed beans with scope larger than request, the following bad practice is recognized:
... defines non-transient non-serializable instance field ...

There are a few problematic PF classes like UploadedFile and DataTable. They don't implement java.io.Serializable. How can I use them in view or session scope beans safely?

Marcin
JSF RI 2.0.3
PF 2.2.M1
Glassfish 3.0.1

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

07 Sep 2010, 10:39

Hi,

DefaultUploadedFile class implements Serializable for datatable JSF components do not implement Serializable since it is not a good practice to use component binding on scopes longer than request.

mkuthan
Posts: 10
Joined: 25 Jun 2010, 10:54

07 Sep 2010, 11:27

Hi Cagaty

1. I agree that binding components to beans with longer lifecycle than request should be avoided.
2. FileUploadEvent uses UploadedFile interface (which is correct) not DefaultUploadedFile class. UploadedFile interface should extend Serializable directly, IMHO.

Marcin
JSF RI 2.0.3
PF 2.2.M1
Glassfish 3.0.1

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Google [Bot] and 35 guests