Bug 534224 - (RHQ-1040) PropertySimple should have no public no-arg constructor
PropertySimple should have no public no-arg constructor
Status: CLOSED WONTFIX
Product: RHQ Project
Classification: Other
Component: Core Server (Show other bugs)
unspecified
All All
low Severity medium (vote)
: ---
: ---
Assigned To: RHQ Project Maintainer
http://jira.rhq-project.org/browse/RH...
: FutureFeature, Improvement
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-11-03 06:39 EST by Heiko W. Rupp
Modified: 2010-08-18 10:54 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-08-18 10:54:47 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Heiko W. Rupp 2008-11-03 06:39:00 EST
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 16:32:48 EST
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 06:55:51 EST
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 15:22:36 EST
This bug was previously known as http://jira.rhq-project.org/browse/RHQ-1040
Comment 4 wes hayutin 2010-02-16 12:08:49 EST
mass add of key word FutureFeature to help track
Comment 5 wes hayutin 2010-02-16 16:15:14 EST
mass move to component = core server
Comment 6 Corey Welton 2010-08-18 10:54:47 EDT
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.