[ 
https://issues.apache.org/jira/browse/JDO-517?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12528007
 ] 

Andy Jefferson commented on JDO-517:
------------------------------------

The test "companyAnnotatedAllRelationshipsPCConcrete.conf" for datastore 
identity runs and gives the following error
1) 
test(org.apache.jdo.tck.mapping.CompletenessTest)org.jpox.jdo.exceptions.CommitStateTransitionException:
 A database transaction has been committed, but the following exceptions were 
thrown while transitioning the state of the JDO objects participating in the 
transaction.
    [java]      at 
org.jpox.ObjectManagerImpl.postCommit(ObjectManagerImpl.java:2719)
    [java]      at 
org.jpox.TransactionImpl.internalPostCommit(TransactionImpl.java:356)
    [java]      at org.jpox.TransactionImpl.commit(TransactionImpl.java:210)
    [java]      at org.jpox.jdo.JDOTransaction.commit(JDOTransaction.java:81)
    [java]      at 
org.apache.jdo.tck.mapping.CompletenessTest.localSetUp(CompletenessTest.java:85)
    [java]      at org.apache.jdo.tck.JDO_Test.setUp(JDO_Test.java:240)
    [java]      at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:256)
    [java]      at 
org.apache.jdo.tck.util.BatchTestRunner.doRun(BatchTestRunner.java:108)
    [java]      at 
org.apache.jdo.tck.util.BatchTestRunner.start(BatchTestRunner.java:148)
    [java]      at 
org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunner.java:123)
    [java] NestedThrowablesStackTrace:
    [java] java.lang.IllegalStateException: Id is already set.
    [java]      at 
org.apache.jdo.tck.pc.companyAnnotatedPC.PCDSInsurance.jdoSetinsid(PCDSInsurance.java:98)
    [java]      at 
org.apache.jdo.tck.pc.companyAnnotatedPC.PCDSInsurance.jdoReplaceField(PCDSInsurance.java)
    [java]      at 
org.apache.jdo.tck.pc.companyAnnotatedPC.PCDSMedicalInsurance.jdoReplaceField(PCDSMedicalInsurance.java)
    [java]      at 
org.apache.jdo.tck.pc.companyAnnotatedPC.PCDSInsurance.jdoReplaceFields(PCDSInsurance.java)
    [java]      at 
org.jpox.state.JDOStateManagerImpl.replaceFields(JDOStateManagerImpl.java:2606)
    [java]      at 
org.jpox.state.JDOStateManagerImpl.replaceFields(JDOStateManagerImpl.java:2625)
    [java]      at 
org.jpox.state.JDOStateManagerImpl.clearFieldsByNumbers(JDOStateManagerImpl.java:1051)
    [java]      at 
org.jpox.state.JDOStateManagerImpl.clearNonPrimaryKeyFields(JDOStateManagerImpl.java:1040)
    [java]      at 
org.jpox.state.jdo.PersistentNew.transitionCommit(PersistentNew.java:101)
    [java]      at 
org.jpox.state.JDOStateManagerImpl.postCommit(JDOStateManagerImpl.java:4184)
    [java]      at 
org.jpox.ObjectManagerImpl.postCommit(ObjectManagerImpl.java:2687)
    [java]      at 
org.jpox.TransactionImpl.internalPostCommit(TransactionImpl.java:356)
    [java]      at org.jpox.TransactionImpl.commit(TransactionImpl.java:210)
    [java]      at org.jpox.jdo.JDOTransaction.commit(JDOTransaction.java:81)
    [java]      at 
org.apache.jdo.tck.mapping.CompletenessTest.localSetUp(CompletenessTest.java:85)
    [java]      at org.apache.jdo.tck.JDO_Test.setUp(JDO_Test.java:240)
    [java]      at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:256)
    [java]      at 
org.apache.jdo.tck.util.BatchTestRunner.doRun(BatchTestRunner.java:108)
    [java]      at 
org.apache.jdo.tck.util.BatchTestRunner.start(BatchTestRunner.java:148)
    [java]      at 
org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunner.java:123)

So JPOX is trying to clear all non-PK fields in the post-commit phase, as it 
should.
If I look inside the class PCDSInsurance.java I find
public void setInsid(long id) {
    if (this._insid != 0)
        throw new IllegalStateException("Id is already set.");
    this._insid = id;
}
JPOX has to use this method (via the jdoSetinsid() method) to clear the field 
(since the class was specified to use properties rather than fields), and the 
TCK is preventing it. Suggest that this type of restriction be removed from the 
companyAnnotatedPC classes

> NPE on enhancement of classes with persistent properties
> --------------------------------------------------------
>
>                 Key: JDO-517
>                 URL: https://issues.apache.org/jira/browse/JDO-517
>             Project: JDO
>          Issue Type: Bug
>          Components: tck2
>    Affects Versions: JDO 2 maintenance release 1
>            Reporter: Michelle Caisse
>            Assignee: Michelle Caisse
>
> To reproduce, edit project.propeties, go to the end of the file, and edit out 
> the comment and blank lines so that the classes in the companyAnnotatedPC 
> package are included in the argument list to the enhancer.
> 11:39:16,031 (main) ERROR [JPOX.Enhancer] - An error was encountered reading 
> the specified input files. Please consult the log for details. The following 
> may help : Errors were encountered when loading the specified MetaData files 
> and classes. See the nested exceptions for details
> Errors were encountered when loading the specified MetaData files and 
> classes. See the nested exceptions for details
> org.jpox.exceptions.JPOXUserException: Errors were encountered when loading 
> the specified MetaData files and classes. See the nested exceptions for 
> details
>       at 
> org.jpox.metadata.MetaDataManager.initialise(MetaDataManager.java:299)
>       at 
> org.jpox.enhancer.JPOXEnhancer.getFileMetaDataForInput(JPOXEnhancer.java:724)
>       at org.jpox.enhancer.JPOXEnhancer.main(JPOXEnhancer.java:533)
> Caused by: java.lang.NullPointerException
>       at 
> org.jpox.metadata.annotations.JDOAnnotationReader.processFieldAnnotations(JDOAnnotationReader.java:1594)
>       at 
> org.jpox.metadata.annotations.AbstractAnnotationReader.getMetaDataForClass(AbstractAnnotationReader.java:211)
>       at 
> org.jpox.metadata.annotations.AnnotationManagerImpl.getMetaDataForClass(AnnotationManagerImpl.java:133)
>       at 
> org.jpox.metadata.MetaDataManager.loadAnnotationsForClass(MetaDataManager.java:1729)
>       at 
> org.jpox.metadata.MetaDataManager.initialise(MetaDataManager.java:265)
>       ... 2 more
> Nested Throwables StackTrace:
> java.lang.NullPointerException
>       at 
> org.jpox.metadata.annotations.JDOAnnotationReader.processFieldAnnotations(JDOAnnotationReader.java:1594)
>       at 
> org.jpox.metadata.annotations.AbstractAnnotationReader.getMetaDataForClass(AbstractAnnotationReader.java:211)
>       at 
> org.jpox.metadata.annotations.AnnotationManagerImpl.getMetaDataForClass(AnnotationManagerImpl.java:133)
>       at 
> org.jpox.metadata.MetaDataManager.loadAnnotationsForClass(MetaDataManager.java:1729)
>       at 
> org.jpox.metadata.MetaDataManager.initialise(MetaDataManager.java:265)
>       at 
> org.jpox.enhancer.JPOXEnhancer.getFileMetaDataForInput(JPOXEnhancer.java:724)
>       at org.jpox.enhancer.JPOXEnhancer.main(JPOXEnhancer.java:533)
> java.lang.NullPointerException
>       at 
> org.jpox.metadata.annotations.JDOAnnotationReader.processFieldAnnotations(JDOAnnotationReader.java:1594)
>       at 
> org.jpox.metadata.annotations.AbstractAnnotationReader.getMetaDataForClass(AbstractAnnotationReader.java:211)
>       at 
> org.jpox.metadata.annotations.AnnotationManagerImpl.getMetaDataForClass(AnnotationManagerImpl.java:133)
>       at 
> org.jpox.metadata.MetaDataManager.loadAnnotationsForClass(MetaDataManager.java:1729)
>       at 
> org.jpox.metadata.MetaDataManager.initialise(MetaDataManager.java:265)
>       at 
> org.jpox.enhancer.JPOXEnhancer.getFileMetaDataForInput(JPOXEnhancer.java:724)
>       at org.jpox.enhancer.JPOXEnhancer.main(JPOXEnhancer.java:533)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to