Bug 113083 - c.a.kernel.MDUtil/ACSObject.getContainer assumes any composite role is a subtype of ACSObject
c.a.kernel.MDUtil/ACSObject.getContainer assumes any composite role is a subt...
Status: CLOSED RAWHIDE
Product: Red Hat Web Application Framework
Classification: Retired
Component: other (Show other bugs)
nightly
All Linux
medium Severity high
: ---
: ---
Assigned To: ccm-bugs-list
Jon Orris
:
Depends On:
Blocks: 106481
  Show dependency treegraph
 
Reported: 2004-01-08 05:37 EST by Daniel Berrange
Modified: 2007-04-18 13:01 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-01-26 17:29:06 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Fix for MDUtil bug (1020 bytes, patch)
2004-01-08 05:39 EST, Daniel Berrange
no flags Details | Diff

  None (edit)
Description Daniel Berrange 2004-01-08 05:37:33 EST
Description of problem:
I have an object type:

object type Term extends ACSObject {
    Integer[1..1] uniqueID = trm_terms.unique_id INTEGER;
    Boolean[1..1] inAtoZ = trm_terms.is_atoz BIT;

    String[0..1] shortcut = trm_terms.shortcut VARCHAR(50);

    Boolean[1..1] isPreferred = trm_terms.is_preferred BIT;
    Term[0..1] preferred = join trm_terms.preferred_term_id
                             to trm_terms.term_id;

    composite Domain[1..1] domain = join trm_terms.domain
                                      to trm_domains.key;

    component Category[1..1] \model = join trm_terms.model_category_id 
                                       to cat_categories.category_id;

    reference key (trm_terms.term_id);

    unique(uniqueID, domain);
}


Now the 'Domain' object type here is a domain object - not an
ACSObject. However, the ACSObject.getContainer() code, which uses
MDUtil assumes that any composite, required, role is an ACSObject.
Thus, when I try to create a term it fails with a ClassCastException:

java.lang.ClassCastException: com.arsdigita.london.terms.Domain
        at com.arsdigita.kernel.ACSObject.getContainer(ACSObject.java:310)
        at com.arsdigita.kernel.ACSObject.beforeSave(ACSObject.java:478)
        at
com.arsdigita.domain.DomainObject$SaveObserver.beforeSave(DomainObject.java:601)
        at
com.arsdigita.persistence.BeforeSaveEvent.doInvoke(DataEvent.java:187)
        at com.arsdigita.persistence.DataEvent.invoke(DataEvent.java:39)
        at
com.arsdigita.persistence.DataObjectImpl.fireObserver(DataObjectImpl.java:500)
        at com.arsdigita.persistence.DataEvent.fire(DataEvent.java:48)
        at
com.arsdigita.persistence.Session$FlushEventProcessor.flush(Session.java:685)
        at
com.redhat.persistence.Session.flushInternal(Session.java(Compiled Code))
        at com.redhat.persistence.Session.flush(Session.java:562)
        at com.redhat.persistence.Cursor.next(Cursor.java:107)
        at
com.arsdigita.persistence.DataQueryImpl.next(DataQueryImpl.java:465)
        at com.arsdigita.domain.DomainQuery.next(DomainQuery.java:94)
        at
com.arsdigita.london.terms.TermsTest.testDomainTerms(TermsTest.java:118)
        at
com.arsdigita.tools.junit.framework.BaseTestCase.runBare(BaseTestCase.java:47)
        at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
        at
com.arsdigita.tools.junit.extensions.BaseTestSetup$1.protect(BaseTestSetup.java:74)
        at
com.arsdigita.tools.junit.extensions.BaseTestSetup.run(BaseTestSetup.java:79)


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:
Comment 1 Daniel Berrange 2004-01-08 05:39:21 EST
Created attachment 96826 [details]
Fix for MDUtil bug
Comment 2 Richard Li 2004-01-08 13:24:01 EST
thanks; ashah reviewed patch; applied @39208

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