Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 336192 - Fetching row with field char(1) and value as space throws NullPointerException with weaving enabled
Summary: Fetching row with field char(1) and value as space throws NullPointerExceptio...
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-03 01:39 EST by Vikram Bhatia CLA
Modified: 2022-06-09 10:19 EDT (History)
1 user (show)

See Also:


Attachments
Testcase (7.80 KB, application/x-zip-compressed)
2011-02-03 01:44 EST, Vikram Bhatia CLA
david.minsky: iplog+
Details
Patch with testcase included. (11.33 KB, patch)
2011-02-04 01:35 EST, Vikram Bhatia CLA
no flags Details | Diff
Patch with minor changes including testcase (11.05 KB, patch)
2011-02-07 23:56 EST, Vikram Bhatia CLA
david.minsky: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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