openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dain Sundstrom (JIRA)" <>
Subject [jira] Resolved: (OPENJPA-315) Unenhanced generated id field of a primitive wrapper type causes NPE
Date Wed, 29 Aug 2007 01:27:30 GMT


Dain Sundstrom resolved OPENJPA-315.

    Resolution: Fixed

Issue has been resolved and a test has been added

> Unenhanced generated id field of a primitive wrapper type causes NPE
> --------------------------------------------------------------------
>                 Key: OPENJPA-315
>                 URL:
>             Project: OpenJPA
>          Issue Type: Bug
>            Reporter: Dain Sundstrom
>            Priority: Critical
>             Fix For: 1.0.0
>         Attachments: OPENJPA-315.patch
> Unenhanced generated id field of a primitive wrapper type causes NPE because the field
value is null.  This bug only occurs when the id field is an object type as primitive fields
are automatically initialized to 0.  I believe this is a critical bug because when using a
primitive field the system appears to work but the id field is always 0 which could cause
data corruption.  The following stack trace shows the bug:
> <openjpa-0.0.0-r420667:564688M nonfatal general error> org.apache.openjpa.persistence.PersistenceException:
> 	at org.apache.openjpa.kernel.BrokerImpl.persist(
> 	at org.apache.openjpa.kernel.BrokerImpl.persist(
> 	at org.apache.openjpa.kernel.DelegatingBroker.persist(
> 	at org.apache.openjpa.persistence.EntityManagerImpl.persist(
> 	at org.apache.openjpa.enhance.AbstractUnenhancedClassTest.getObjectIdHelper(
> 	at org.apache.openjpa.enhance.AbstractUnenhancedClassTest.testGetObjectIdOnOpenJPAType(
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> 	at com.intellij.rt.execution.junit.JUnitStarter.main(
> Caused by: java.lang.NullPointerException
> 	at org.apache.openjpa.util.ApplicationIds.fromPKValues(
> 	at org.apache.openjpa.enhance.ReflectingPersistenceCapable.pcNewObjectIdInstance(
> 	at org.apache.openjpa.util.ApplicationIds.create(
> 	at org.apache.openjpa.kernel.BrokerImpl.persist(
> 	... 23 more
> The attached patch reproduces this bug.  The patch is a clone of TestUnenhancedFieldAccess
that simply changes the id field to type Integer. 

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

View raw message