Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 333991 - Schema gen with package that references another uses wrong schema name
Summary: Schema gen with package that references another uses wrong schema name
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-11 10:30 EST by Paul Fullbright CLA
Modified: 2022-06-09 10:27 EDT (History)
4 users (show)

See Also:


Attachments
included source (876 bytes, application/zip)
2011-01-11 10:30 EST, Paul Fullbright CLA
no flags Details
Generated test.org.xsd from MOXy (443 bytes, text/plain)
2011-01-13 16:58 EST, Tran Le CLA
no flags Details
Generated test.org.xsd from Metro implementation (451 bytes, text/plain)
2011-01-13 16:59 EST, Tran Le CLA
no flags Details
Dali createOutput(String, String) method (632 bytes, text/plain)
2011-01-13 17:01 EST, Tran Le CLA
no flags Details
Proposed fix. (2.88 KB, patch)
2011-05-11 11:35 EDT, David McCann CLA
no flags Details | Diff
Supporting test case. (10.15 KB, patch)
2011-05-11 11:35 EDT, David McCann CLA
no flags Details | Diff
Proposed fix v2 (3.11 KB, patch)
2011-05-11 14:56 EDT, David McCann CLA
no flags Details | Diff
Supporting test cases. (10.89 KB, patch)
2011-05-11 14:57 EDT, 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 Paul Fullbright CLA 2011-01-11 10:30:57 EST
Created attachment 186511 [details]
included source

Using the source attached, two schemas are generated (test.org.xsd and test2.org.xsd - this can't be changed in the current mechanism), but the import in the first schema refers to schema0.xsd and not test2.org.xsd.
Comment 1 Tran Le CLA 2011-01-13 16:53:50 EST
Forwarding this bug to the MOXy dev group.

It appears that the MOXy generator is not using the result of the method createOutput(String, String) to create the content of test.org.xsd, but it is using directly the suggested fileName (schema0.xsd).

I have tested these classes with the Metro implementation, and schemaLocation is set properly to test2.org.xsd
Comment 2 Tran Le CLA 2011-01-13 16:58:23 EST
Created attachment 186785 [details]
Generated test.org.xsd from MOXy
Comment 3 Tran Le CLA 2011-01-13 16:59:48 EST
Created attachment 186787 [details]
Generated test.org.xsd from Metro implementation
Comment 4 Tran Le CLA 2011-01-13 17:01:43 EST
Created attachment 186788 [details]
Dali createOutput(String, String) method
Comment 5 David McCann CLA 2011-02-04 14:21:14 EST
This is a bug in our schema generator after all.  After reviewing the API for the output resolver, we should be relativizing the returned system ID and not using it as an absolute path.

"a Result object that encapsulates the actual destination of the schema. If the Result object has a system ID, it must be an absolute system ID. Those system IDs are relativized by the caller and used for <xs:import> statements."

Note - the latest SchemaGenerator code uses the system ID if set, which is better than the behavior described in this bug, but this will need to be relativized to be correct.
Comment 6 David McCann CLA 2011-05-11 11:35:10 EDT
Created attachment 195379 [details]
Proposed fix.
Comment 7 David McCann CLA 2011-05-11 11:35:30 EDT
Created attachment 195380 [details]
Supporting test case.
Comment 8 David McCann CLA 2011-05-11 14:56:44 EDT
Created attachment 195413 [details]
Proposed fix v2
Comment 9 David McCann CLA 2011-05-11 14:57:02 EDT
Created attachment 195414 [details]
Supporting test cases.
Comment 10 David McCann CLA 2011-05-11 15:32:17 EDT
Reviewed by:  blaise.doughan@oracle.com
Tests:  all unit tests pass as expected; SchemaGenImportTestCases
Revision: 9361
Comment 11 Eclipse Webmaster CLA 2022-06-09 10:27:23 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink