Bug 182477 - [validation] Warning when a transient field is defined in the session bean
Summary: [validation] Warning when a transient field is defined in the session bean
Status: RESOLVED FIXED
Alias: None
Product: WTP Java EE Tools
Classification: WebTools
Component: jst.j2ee (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: 3.0.3   Edit
Assignee: Masashi Sato CLA
QA Contact: Chuck Bridgham CLA
URL:
Whiteboard:
Keywords: contributed, helpwanted
Depends on:
Blocks:
 
Reported: 2007-04-15 22:04 EDT by Masashi Sato CLA
Modified: 2008-10-01 12:24 EDT (History)
3 users (show)

See Also:
cbridgha: review+


Attachments
Patch (4.41 KB, patch)
2008-08-25 02:17 EDT, Masashi Sato CLA
bjorn.freeman-benson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Masashi Sato CLA 2007-04-15 22:04:00 EDT
Build ID: I20070323-1616

Steps To Reproduce:
1. Create an EJB project of EJB 2.0 specification
2. Create a session Bean.
3. Add a transient field to the session bean.
4. Build the project

The following message is displayed in the Problems view.

CHKJ2452W: A transient field should not be the {0} type (EJB 2.0: 7.4.1).

This warning is reproduced regardless of the type of the field. Also, the type name is not replaced in the message. 




More information:
Comment 1 Kaloyan Raev CLA 2008-07-18 07:36:51 EDT
EJB 2.0 spec is quite old already to investigate team resources on this. 
However, any patch contributions by the community will be appreciated.
Comment 2 Masashi Sato CLA 2008-08-25 02:17:40 EDT
Created attachment 110771 [details]
Patch

I investigated the bug.

There is the following descriptions in EJB specifications. 

---------------------------------------------
The Bean Provider must assume that the content of transient fields may be lost
between the ejbPassivate and ejbActivate notifications. Therefore, the Bean
Provider should not store in a transient field a reference to any of the
following objects: SessionContext object; environment JNDI naming context and
any its subcontexts; home and component interfaces; and the User-Transaction
interface.
---------------------------------------------

Therefore, there is processing that judges whether the type is JNDI naming context. 
But, the method is not actually implemented, and it always returns by true.

I attach a patch that corrects the judgment processing as well as other types.
The message problem (not embedding type name) is also corrected in the patch.
Please refer to the patch for details.
Comment 3 Kaloyan Raev CLA 2008-08-26 05:22:58 EDT
Thanks for the patch, Masashi!

Chuck, the patch looks good for me, but please have a review since the
validation code is in the j2ee.core plugin. 
Comment 4 Chuck Bridgham CLA 2008-09-29 14:29:35 EDT
looks good - approved
Comment 5 Kaloyan Raev CLA 2008-10-01 12:24:37 EDT
Committed to HEAD and R3_0_maintenance. Released to build.