Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 336192

Summary: Fetching row with field char(1) and value as space throws NullPointerException with weaving enabled
Product: z_Archived Reporter: Vikram Bhatia <vikram.jeet.bhatia>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: david.minsky
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Testcase
david.minsky: iplog+
Patch with testcase included.
none
Patch with minor changes including testcase david.minsky: iplog+

Description Vikram Bhatia CLA 2011-02-03 01:39:42 EST
Build Identifier: 2.0.2

Entity A having one of the field as char(1). Set eclipselink.weaving property to true in persistence.xml.

Fetch a row from database using em.find(TestEntity.class, 1L) with char value in database as ' ' (space). It will throw NullPointerException in _persistence_set() method.

 java.lang.NullPointerException
                 at test.TestEntity._persistence_set(Unknown Source)
                 at
  org.eclipse.persistence.internal.descriptors.PersistenceObjectAttributeAccess
  or.setAttributeValueInObject(PersistenceObjectAttributeAccessor.java:46)
                 at
  org.eclipse.persistence.mappings.DatabaseMapping.setAttributeValueInObject(Da
  tabaseMapping.java:1368)
                 at
  org.eclipse.persistence.mappings.DatabaseMapping.readFromRowIntoObject(Databa
  seMapping.java:1259)

Reproducible: Always

Steps to Reproduce:
1. Unzip enclosed testcase.zip
2. Load JPA project in eclipse.
3. Change persistence.xml to change database details.
4. Change variables in project classpath.e.g., eclipselink.jar location, javax.persistence jar location, junit jar and driver jar.
5. Run CreateTestData class to create the table and insert data.
6. Run TestCase junit test with weaving enabled by adding following in VM arguments to notice NPE.
-javaagent:D:/EclipseLink/main/trunk/eclipselink.jar -Declipselink.weaving.output.path=D:\tmp-weaving -Declipselink.weaving.overwrite.existing=true
Comment 1 Vikram Bhatia CLA 2011-02-03 01:44:15 EST
Created attachment 188211 [details]
Testcase
Comment 2 Vikram Bhatia CLA 2011-02-04 01:35:20 EST
Created attachment 188291 [details]
Patch with testcase included.
Comment 3 Vikram Bhatia CLA 2011-02-07 23:56:11 EST
Created attachment 188494 [details]
Patch with minor changes including testcase
Comment 4 David Minsky CLA 2011-02-09 15:48:42 EST
Checked into trunk (2.3) at revision: 8951
Comment 5 Eclipse Webmaster CLA 2022-06-09 10:19:52 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink