Issue Details (XML | Word | Printable)

Key: NUCRDBMS-750
Type: Bug Bug
Status: Closed Closed
Resolution: Cannot Reproduce
Priority: Testcase Required Testcase Required
Assignee: Unassigned
Reporter: Chris Colman
Votes: 0
Watchers: 0
Operations

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

NumberFormatException when discriminator not supplied for an intermediate abstract base class where discriminator type is Integer

Created: 14/Jan/14 10:51 PM   Updated: 13/Apr/14 10:45 AM   Resolved: 13/Apr/14 10:44 AM
Component/s: None
Affects Version/s: 3.2.10
Fix Version/s: None

Environment:
Linux Cent OS 5 and Windows XP
Java 7
Tomcat 7

Datastore: MySQL
Severity: Production


 Description  « Hide
We use Integer discriminators (cos why would you have a column value that's a often long, fully qualified classname in *every* object that you persist, ever? - but that's for another discussion ;0 ).

With recent versions of DN giving warnings when a discriminator value is provided for an abstract class we recently removed all discriminator values for abstract classes. We are now experiencing the exception below at frequent intervals.

The class in question is an abstract class but it has superclasses some of which are concrete and some are abstract denoted by (C) or (A) respectively in this ASCII graphics class diagram:

EV (C)
 ^
 |
N (C)
 ^
 |
ND (C)
 ^
 |
PB (A)
 ^
 |
Category (A)
 ^
 |
Concrete subclasses extend Category

When performing a query on this object we get this rather strange exception. It seems as if DiscriminatorMapping.setObject() is assuming the discriminator is an int (which it should) but somehow it has been passed a String discriminator - the fully qualified class name.

Speculation, I know, and test case will be coming as soon as I get a chance, but it appears as though there is an edge case where, in the absence of the integer discriminator for an abstract class the default "fully qualified classname" is being provided and that obviously fails any number parsing method.

I don't understand why any part of the code would still be requiring a discriminator for an abstract class.

java.lang.NumberFormatException: For input string: "com.sas.av.model.pilot.product.Category"
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
        at java.lang.Long.parseLong(Long.java:441)
        at java.lang.Long.valueOf(Long.java:540)
        at org.datanucleus.store.rdbms.mapping.java.DiscriminatorMapping.setObject(DiscriminatorMapping.java:117)
        at org.datanucleus.store.rdbms.scostore.BackingStoreHelper.populateElementDiscriminatorInStatement(BackingStoreHelper.java:252)
        at org.datanucleus.store.rdbms.scostore.ElementContainerStore.getSize(ElementContainerStore.java:626)
        at org.datanucleus.store.rdbms.scostore.ElementContainerStore.size(ElementContainerStore.java:429)
        at org.datanucleus.store.types.backed.List.size(List.java:581)
        at org.datanucleus.store.types.backed.List.isEmpty(List.java:500)
        at org.datanucleus.store.rdbms.query.JDOQLQuery.performExecute(JDOQLQuery.java:590)
        at org.datanucleus.store.query.Query.executeQuery(Query.java:1786)
        at org.datanucleus.store.query.Query.executeWithArray(Query.java:1672)
        at org.datanucleus.api.jdo.JDOQuery.execute(JDOQuery.java:243)
        at com.sas.av.model.exposer.AvRepositoryJdoImpl.findCategoriesInCategory(AvRepositoryJdoImpl.java:764)
        at com.sas.av.ui.wicket.templates.original.CategoryContainerMenuPanel.onInitialize(CategoryContainerMenuPanel.java:138)
        at org.apache.wicket.Component.fireInitialize(Component.java:864)

This is happening on the 3.3.6 release of 1/1/2014 as well as December snapshots

Andy Jefferson made changes - 15/Jan/14 06:13 AM
Field Original Value New Value
Priority Major [ 3 ] No Testcase [ 6 ]
Andy Jefferson added a comment - 13/Apr/14 10:44 AM
No testcase provided. No way of seeing anything

Andy Jefferson made changes - 13/Apr/14 10:44 AM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Cannot Reproduce [ 5 ]
Andy Jefferson made changes - 13/Apr/14 10:45 AM
Status Resolved [ 5 ] Closed [ 6 ]