[ 
https://issues.apache.org/jira/browse/ISIS-265?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Minto van der Sluis updated ISIS-265:
-------------------------------------

    Attachment: 0004-Allow-new-objects-to-be-properly-stored.patch

Debugging revealed the PojoAdapter.checkLock() was called with otherVersion = 
null. This resulted in checkLoch() throwing a ConcurrencyException. 

Adding a check on the value of otherVersion solved my problem. 

Actually instead of the changed if statement I preferred the following: 


        if (otherVersion != null && otherVersion.different(version)) { 
        .... 

This however resulted in failing unit test. In my opinion a sign that the unit 
tests are coupled too tightly to the implementation of the method. 
                
> NullPointerException when storing new objects
> ---------------------------------------------
>
>                 Key: ISIS-265
>                 URL: https://issues.apache.org/jira/browse/ISIS-265
>             Project: Isis
>          Issue Type: Bug
>          Components: Runtimes: Dflt
>    Affects Versions: 0.3.1-incubating
>            Reporter: Minto van der Sluis
>              Labels: patch
>             Fix For: 0.3.1-incubating
>
>         Attachments: 0004-Allow-new-objects-to-be-properly-stored.patch
>
>
> After switching from 0.2.0 to trunk creating new objects resulted into a NPE 
> with the following output to the screen:
> java.lang.NullPointerException
>       at  
> org.apache.isis.core.metamodel.adapter.version.ConcurrencyException.buildMessage(ConcurrencyException.java:36)
>       at  
> org.apache.isis.core.metamodel.adapter.version.ConcurrencyException.(ConcurrencyException.java:50)
>       at  
> org.apache.isis.runtimes.dflt.runtime.persistence.adapter.PojoAdapter.checkLock(PojoAdapter.java:337)
>       at  
> org.apache.isis.viewer.html.context.PersistentRootAdapterMapping.checkVersion(PersistentRootAdapterMapping.java:56)
>       at  
> org.apache.isis.viewer.html.context.Context.getMappedObject(Context.java:284)
> ....
> See also mailing list messages:
> 1) 
> http://mail-archives.apache.org/mod_mbox/incubator-isis-dev/201209.mbox/%3C20120904162634.498360cc2mehz2ca%40webmail.xup.nl%3E
> 2) 
> http://mail-archives.apache.org/mod_mbox/incubator-isis-dev/201209.mbox/%3C20120905105456.3062774yn2htlylc%40webmail.xup.nl%3E

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to