Issue Details (XML | Word | Printable)

Key: NUCAPIJDO-40
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: No Testcase No Testcase
Assignee: Unassigned
Reporter: Chris Colman
Votes: 0
Watchers: 0
Operations

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

When using a persistence.xml file with JDO an error in the file is not reported as such

Created: 29/Aug/12 07:24 AM   Updated: 14/Jan/13 11:31 AM   Resolved: 09/Jan/13 02:53 PM
Component/s: None
Affects Version/s: 3.1.1
Fix Version/s: 3.2.0.m3

Severity: Production


 Description  « Hide
When an XML syntax error is present in the persistence.xml file a parser exception is thrown that explains the error but as you can see in the source of JDOPersistenceManagerFactory.java below, that useful information in the exception is ignored and a new exception is thrown saying that the persistence unit could not be found - which is true but not as useful as conveying the reason why it could not be found:

                try
                {
                    // Obtain any props defined for the persistence-unit
                    pumd = nucleusContext.getMetaDataManager().getMetaDataForPersistenceUnit(persistenceUnitName);
                    if (pumd != null)
                    {
                        // Add the properties for the unit
                        if (pumd.getProperties() != null)
                        {
                            pmfProps.putAll(pumd.getProperties());
                        }
                    }
                    else
                    {
                        throw new JDOUserException(LOCALISER.msg("012004", persistenceUnitName));
                    }
                }
                catch (NucleusException jpe)
                {
                    throw new JDOUserException(LOCALISER.msg("012005", persistenceUnitName));
                }

Andy Jefferson added a comment - 31/Aug/12 09:06 AM
Anyone is capable of contributing patches where they things can be improved, and given that there is no testcase, that is the only way here.

Andy Jefferson made changes - 06/Sep/12 11:32 AM
Field Original Value New Value
Issue Type Bug [ 1 ] Improvement [ 4 ]
Priority Major [ 3 ] Incomplete [ 6 ]
Andy Jefferson added a comment - 09/Jan/13 02:53 PM
SVN trunk provides any cause exception with the thrown exception. Absence of a testcase means its not a problem

Andy Jefferson made changes - 09/Jan/13 02:53 PM
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 3.2.0.m3 [ 11850 ]
Resolution Fixed [ 1 ]
Andy Jefferson made changes - 14/Jan/13 11:31 AM
Status Resolved [ 5 ] Closed [ 6 ]