Bug 534224 (RHQ-1040) - PropertySimple should have no public no-arg constructor
Summary: PropertySimple should have no public no-arg constructor
Keywords:
Status: CLOSED WONTFIX
Alias: RHQ-1040
Product: RHQ Project
Classification: Other
Component: Core Server
Version: unspecified
Hardware: All
OS: All
low
medium
Target Milestone: ---
: ---
Assignee: RHQ Project Maintainer
QA Contact:
URL: http://jira.rhq-project.org/browse/RH...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-11-03 11:39 UTC by Heiko W. Rupp
Modified: 2010-08-18 14:54 UTC (History)
0 users

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-08-18 14:54:47 UTC
Embargoed:


Attachments (Terms of Use)

Description Heiko W. Rupp 2008-11-03 11:39:00 UTC
The current implementation has a public no-arg constructor for PropertySimple().
This allows for the following 

PropertySimple ps = new PropertySimple();
ps.setStringValue("fooBar");
config.put(ps);

yielding in a NPE later on when doing the writeExternal(), as there has never been a name set for this property.

We should require the name here, especially as the superclass marks the name as required:

    @Column(name = "NAME", nullable = false)
    private String name;

Comment 1 Joseph Marques 2008-11-04 21:32:48 UTC
a protected no-arg ctor is needed according to the JPA spec.  Seam requires the no-arg ctor to be public if you want to use it for bijection.  so, this method needs to stay.  please close this case if you agree, or post back if i'm missing the point.

Comment 2 Heiko W. Rupp 2008-11-18 11:55:51 UTC
Hm.
I understand the Seam requirement, which is sad to be there.

Again, a PropertySimple without a name is incomplete. So we should prevent its usage when no name is present.

As just requiring the name via a constructor with arguments (and hiding the empty one) is not possible, one can perhaps print an error in writeExternal() and some @PrePersist hooks.

I've at least added a comment about this in rev2022

Comment 3 Red Hat Bugzilla 2009-11-10 20:22:36 UTC
This bug was previously known as http://jira.rhq-project.org/browse/RHQ-1040


Comment 4 wes hayutin 2010-02-16 17:08:49 UTC
mass add of key word FutureFeature to help track

Comment 5 wes hayutin 2010-02-16 21:15:14 UTC
mass move to component = core server

Comment 6 Corey Welton 2010-08-18 14:54:47 UTC
Per 17-Aug-2010 triage, closing this bug.  It can be reopened if considered a critical issue.


Note You need to log in before you can comment on or make changes to this bug.