Bug 534224 (RHQ-1040)

Summary: PropertySimple should have no public no-arg constructor
Product: [Other] RHQ Project Reporter: Heiko W. Rupp <hrupp>
Component: Core ServerAssignee: RHQ Project Maintainer <rhq-maint>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: low    
Version: unspecifiedKeywords: FutureFeature, Improvement
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: All   
URL: http://jira.rhq-project.org/browse/RHQ-1040
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-08-18 14:54:47 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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.