From jdo-dev-return-1870-apmail-db-jdo-dev-archive=www.apache.org@db.apache.org Sat Oct 22 10:01:43 2005 Return-Path: Delivered-To: apmail-db-jdo-dev-archive@www.apache.org Received: (qmail 18546 invoked from network); 22 Oct 2005 10:01:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 22 Oct 2005 10:01:43 -0000 Received: (qmail 96861 invoked by uid 500); 22 Oct 2005 10:01:41 -0000 Mailing-List: contact jdo-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jdo-dev@db.apache.org Delivered-To: mailing list jdo-dev@db.apache.org Received: (qmail 96848 invoked by uid 99); 22 Oct 2005 10:01:41 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [192.87.106.226] (HELO ajax.apache.org) (192.87.106.226) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 22 Oct 2005 03:01:41 -0700 Received: from ajax.apache.org (ajax.apache.org [127.0.0.1]) by ajax.apache.org (Postfix) with ESMTP id 1970FE0 for ; Sat, 22 Oct 2005 12:01:20 +0200 (CEST) Message-ID: <935623043.1129975280102.JavaMail.jira@ajax.apache.org> Date: Sat, 22 Oct 2005 12:01:20 +0200 (CEST) From: "Andy Jefferson (JIRA)" To: jdo-dev@db.apache.org Subject: [jira] Assigned: (JDO-144) Incorrect value for public Collection CollectionOfDate12 In-Reply-To: <891614647.1127342068721.JavaMail.jira@ajax.apache.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/JDO-144?page=all ] Andy Jefferson reassigned JDO-144: ---------------------------------- Assign To: Michelle Caisse (was: Andy Jefferson) Thanks Michelle. Well I'll explain what the problem is, and some options. The test creates an object with many collections and instantiates them as Vectors (as you know). It tries to persist it, and JPOX converts all Collection fields to the equivalent wrapper type for the _instantiated_ type of the field. This is fine. The test then goes back to the datastore and retrieves the persisted object. JPOX has to look at what is in the datastore for each Collection field and create a suitable Collection. At this point it has no idea that the user wants a Vector creating since the instantiated type is not stored in the datastore anywhere. Consequently it knows it has to create a Collection type, and that the user has provided an , so it create an ArrayList (since that is the JPOX-defined default for Lists). How is JPOX to know that it should instantiate the fields as Vector when it is simply retrieving an object from the datastore and the declared type of the field is Collection ? JPOX calls the default constructor of CollectionCollections and then has to instantiate each field somehow. So it takes a guess. If anyone thinks it should do better, then please please define how. What I would do to the test is change your "Vector.elementAt(i)" calls to be "List.get(i)" (since List.get(i) is more generic and does the same thing as Vector.elementAt(i)), and cast the Collection field to a List instead of a Vector. This will work because JPOX (CVS) has given it a List wrapper. Hope that makes sense. > Incorrect value for public Collection CollectionOfDate12 > -------------------------------------------------------- > > Key: JDO-144 > URL: http://issues.apache.org/jira/browse/JDO-144 > Project: JDO > Type: Bug > Components: tck20 > Reporter: Michelle Caisse > Assignee: Michelle Caisse > > [java] 1) test(org.apache.jdo.tck.models.fieldtypes.TestCollectionCollections)junit.framework.AssertionFailedError: Assertion A6.4.3-33 (TestCollectionCollections) failed: > [java] Incorrect value for public Collection CollectionOfDate12 > [java] at org.apache.jdo.tck.JDO_Test.fail(JDO_Test.java:546) > [java] at org.apache.jdo.tck.models.fieldtypes.TestCollectionCollections.checkValues(TestCollectionCollections.java:146) > [java] at org.apache.jdo.tck.models.fieldtypes.TestCollectionCollections.runTest(TestCollectionCollections.java:104) > [java] at org.apache.jdo.tck.models.fieldtypes.TestCollectionCollections.test(TestCollectionCollections.java:69) > [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > [java] at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:204) > [java] at org.apache.jdo.tck.util.BatchTestRunner.start(BatchTestRunner.java:115) > [java] at org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunner.java:93) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira