Bug 113083 - c.a.kernel.MDUtil/ACSObject.getContainer assumes any composite role is a subtype of ACSObject
Summary: c.a.kernel.MDUtil/ACSObject.getContainer assumes any composite role is a subt...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Web Application Framework
Classification: Retired
Component: other
Version: nightly
Hardware: All
OS: Linux
medium
high
Target Milestone: ---
Assignee: ccm-bugs-list
QA Contact: Jon Orris
URL:
Whiteboard:
Depends On:
Blocks: 106481
TreeView+ depends on / blocked
 
Reported: 2004-01-08 10:37 UTC by Daniel Berrangé
Modified: 2007-04-18 17:01 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-01-26 22:29:06 UTC
Embargoed:


Attachments (Terms of Use)
Fix for MDUtil bug (1020 bytes, patch)
2004-01-08 10:39 UTC, Daniel Berrangé
no flags Details | Diff

Description Daniel Berrangé 2004-01-08 10:37:33 UTC
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 Berrangé 2004-01-08 10:39:21 UTC
Created attachment 96826 [details]
Fix for MDUtil bug

Comment 2 Richard Li 2004-01-08 18:24:01 UTC
thanks; ashah reviewed patch; applied @39208


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