DataNucleus JIRA is now in read-only mode. Raise any new issues in GitHub against the plugin that it applies to. DataNucleus JIRA will remain for the foreseeable future but will eventually be discontinued
Issue Details (XML | Word | Printable)

Key: NUCAPIJDO-40
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
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 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));
                }

Sort Order: Ascending order - Click to sort in descending order
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 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