Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 331906 - [DynamicTypeBuilder] Unnecessary exception thrown when mixing dynamic and static classes
Summary: [DynamicTypeBuilder] Unnecessary exception thrown when mixing dynamic and sta...
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: Mike Norman CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-06 10:00 EST by Rick Barkhouse CLA
Modified: 2022-06-09 10:03 EDT (History)
0 users

See Also:


Attachments
clean up so that exception only apply to dynamic entities without DPM field (5.63 KB, patch)
2010-12-06 10:59 EST, Mike Norman CLA
no flags Details | Diff
clean up so that exception only apply to dynamic entities without DPM field (5.63 KB, patch)
2010-12-06 12:47 EST, Mike Norman 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-12-06 10:00:56 EST
When generating a dynamic project, if I have a mixture of dynamic and static classes (e.g., a dynamic class which uses a static xml java type adapter), the dynamic framework treats the static class as if it was dynamic, looking reflectively for the DPM field.

In DynamicTypeBuilder, we should add a check to only look for the DPM field if the javaClass in question is indeed a dynamic one.
Comment 1 Rick Barkhouse CLA 2010-12-06 10:01:58 EST
The exception:

java.lang.NoSuchFieldException: DPM
	at java.lang.Class.getField(Class.java:1520)
	at org.eclipse.persistence.dynamic.DynamicTypeBuilder.<init>(DynamicTypeBuilder.java:134)
	at org.eclipse.persistence.dynamic.DynamicTypeBuilder.createType(DynamicTypeBuilder.java:657)
	at org.eclipse.persistence.dynamic.DynamicTypeBuilder.loadDynamicProject(DynamicTypeBuilder.java:593)
	at org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext.initializeFromMetadata(DynamicJAXBContext.java:219)
	at org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContextFactory.createContextFromOXM(DynamicJAXBContextFactory.java:553)
	at org.eclipse.persistence.testing.jaxb.dynamic.DynamicJAXBFromOXMTestCases.testXmlAdapter(DynamicJAXBFromOXMTestCases.java:1094)
	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 2 Mike Norman CLA 2010-12-06 10:59:54 EST
Created attachment 184618 [details]
clean up so that exception only apply to dynamic entities without DPM field
Comment 3 Mike Norman CLA 2010-12-06 12:47:56 EST
Created attachment 184641 [details]
clean up so that exception only apply to dynamic entities without DPM field
Comment 4 Mike Norman CLA 2010-12-06 13:25:52 EST
fixed in SVN revision: 8634
(reviewed by Rick Barkhouse)
Comment 5 Eclipse Webmaster CLA 2022-06-09 10:03:53 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink