Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 330968 - [OXM] No error message for missing package-name element
Summary: [OXM] No error message for missing package-name element
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: David McCann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-23 15:35 EST by Rick Barkhouse CLA
Modified: 2022-06-09 10:09 EDT (History)
0 users

See Also:


Attachments
Contains proposed fix (1.84 KB, patch)
2010-11-24 10:30 EST, David McCann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rick Barkhouse CLA 2010-11-23 15:35:25 EST
When bootstrapping with, say:

properties.put(JAXBContextFactory.ECLIPSELINK_OXM_XML_KEY, inputStream);

there is no proper error message given if the 'package-name' element is missing from the OXM file.  Instead you will see:


Local Exception Stack: 
Exception [EclipseLink-50069] (Eclipse Persistence Services - 2.2.0.qualifier): org.eclipse.persistence.exceptions.JAXBException
Exception Description: (There is no English translation for this exception.) 

	at org.eclipse.persistence.exceptions.JAXBException.packageNotSetForBindingException(JAXBException.java:326)
	at org.eclipse.persistence.jaxb.JAXBContextFactory.processBindingFile(JAXBContextFactory.java:482)
	at org.eclipse.persistence.jaxb.JAXBContextFactory.getXmlBindingsFromProperties(JAXBContextFactory.java:461)
	at org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext.initializeFromOXM(DynamicJAXBContext.java:257)
	at org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContextFactory.createContextFromOXM(DynamicJAXBContextFactory.java:323)
	at org.eclipse.persistence.testing.jaxb.dynamic.DynamicJAXBFromOXMTestCases.testXmlClassExtractor(DynamicJAXBFromOXMTestCases.java:1047)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at junit.framework.TestCase.runTest(TestCase.java:168)
	at junit.framework.TestCase.runBare(TestCase.java:134)
	at junit.framework.TestResult$1.protect(TestResult.java:110)
	at junit.framework.TestResult.runProtected(TestResult.java:128)
	at junit.framework.TestResult.run(TestResult.java:113)
	at junit.framework.TestCase.run(TestCase.java:124)
	at junit.framework.TestSuite.runTest(TestSuite.java:232)
	at junit.framework.TestSuite.run(TestSuite.java:227)
	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:79)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Comment 1 David McCann CLA 2010-11-24 10:26:34 EST
The JAXBExceptionResource message for this exception has the wrong key.  It is 50068 but should be 50069.  When running the JUnit tests I now see the following message when the package-name attribute is not specified for a non-Map bindings format:


Exception Description: A package was not specified for the provided XML metadata file.  The package can be specified by passing in Map<String, Object> (where String = package, Object = handle to XML metadata file) or by setting the package-name attribute on the xml-bindings element in the XML metadata file.
Comment 2 David McCann CLA 2010-11-24 10:30:37 EST
Created attachment 183771 [details]
Contains proposed fix
Comment 3 David McCann CLA 2010-11-24 10:52:27 EST
Reviewed by:  rick.barkhouse@oracle.com
Tests: all unit tests pass as expected
Revision: 8554
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:09:36 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink