Issue Details (XML | Word | Printable)

Key: NUCCORE-1014
Type: Improvement Improvement
Status: Open Open
Priority: Trivial Trivial
Assignee: Unassigned
Reporter: Emmanuel Poitier
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
DataNucleus Core

Support 1-N with subclass-table and compound identity, or trap in metadata processing

Created: 13/Mar/13 08:50 AM   Updated: 16/Mar/13 03:25 PM
Component/s: None
Affects Version/s: None
Fix Version/s: None

File Attachments: 1. File datanucleus-samples-jdo-tutorial-inheritance-3.2.tbz2 (4.37 MB)
2. File store.rdbms.trunk.diff (0.8 kB)

Environment: Datanucleus

Severity: Production


 Description  « Hide
All,

I found a small issue with certain metadata files and throwing a java.lang.NullPointerException in org.datanucleus.store.rdbms.table.ClassTable#1046 where the datastoreClass variable may be null, and failing during the test datastoreClass.getIdMapping().

Please find attached to this issue a patch to apply to give the necessary information in the log and not the plain java.lang.NullPointerException.

Best regards,
Emmanuel Poitier

Emmanuel Poitier added a comment - 13/Mar/13 08:51 AM
Patch to apply to avoid the NullPointerException throwing when datastoreClass is null

Emmanuel Poitier made changes - 13/Mar/13 08:51 AM
Field Original Value New Value
Attachment store.rdbms.trunk.diff [ 11921 ]
Andy Jefferson added a comment - 13/Mar/13 08:54 AM
Why is datastoreClass null ? If its null then something has gone wrong earlier, so that is what needs addressing.

Emmanuel Poitier added a comment - 13/Mar/13 09:06 AM
Andy,

this is due to incorrect use of a class used as the key of a persistent class, and without any details about where to start looking at, the user would be quite frustrated where to look at.

This issue I did see is mainly due to the metadata being incorrect.

Best regards,
Emmanuel Poitier

Andy Jefferson added a comment - 13/Mar/13 09:08 AM
So the problem is in metadata specification then (if I understand what you're saying), so a check needs to go into AbstractClassMetaData. Define an example class and its metadata (just the important parts)

Emmanuel Poitier added a comment - 16/Mar/13 02:24 PM - edited
Andy,

Please find the file datanucleus-samples-jdo-tutorial-inheritance-3.2.tbz2 demonstrating the issue following the steps below:

1. cd datanucleus-samples-jdo-tutorial-inheritance-3.2
2. ant
3. ant enhance
4. ant createschema
5. Notice the NullPointerException raised at the same location indicated above

Best regards,
Emmanuel Poitier

Emmanuel Poitier added a comment - 16/Mar/13 02:25 PM
Sample to recreate the issue

Emmanuel Poitier made changes - 16/Mar/13 02:25 PM
Andy Jefferson made changes - 16/Mar/13 03:22 PM
Project DataNucleus Store RDBMS [ 10144 ] DataNucleus Core [ 10143 ]
Key NUCRDBMS-652 NUCCORE-1014
Affects Version/s 3.2.0.m1 [ 11750 ]
Affects Version/s 3.2.0.m2 [ 11788 ]
Affects Version/s 3.2.0.release [ 11789 ]
Affects Version/s 3.2.0.m3 [ 11840 ]
Affects Version/s 3.2.0.m4 [ 11883 ]
Component/s SchemaTool [ 10143 ]
Andy Jefferson added a comment - 16/Mar/13 03:25 PM
Moved to core since such metadata checks should never be in a "store" plugin. RDBMS plugin has very strict limitations on use of subclass-table, and it would never be recommended to try it with compound identity. Low priority so contribute a patch to AbstractClassMetaData to check for it and throw an InvalidMetaDataException if this is a priority to you

Andy Jefferson made changes - 16/Mar/13 03:25 PM
Summary java.lang.NullPointerException thrown in certain circumstances Support 1-N with subclass-table and compound identity, or trap in metadata processing