Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 338446

Summary: Generated Schema has incorrect type for referenced element
Product: z_Archived Reporter: Matt MacIvor <matt.macivor>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Propsed Fix none

Description Matt MacIvor CLA 2011-02-28 13:37:01 EST
When generating a schema from the following class:
@XmlRootElement(name = "echoBarAndBarResponse", namespace = "http://echo.org/")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "echoBarAndBarResponse", namespace = "http://echo.org/")
public class EchoTwoBarResponse {

    @XmlElement(name = "return", namespace = "urn:barresultns", nillable = true)
    private Bar[] _return;

    public Bar[] getReturn() {
       return this._return;
    }

    public void setReturn(Bar[] _return) {
      this._return = _return;
    }
}

public class Bar {
    private int age;

    public Bar() {
    }

    public Bar(int age) {
       this.age = age;
    }

    public int getAge() {
      return age;
    }

    public void setAge(int age) {
       this.age = age;
    }
} 

The type for the schema element "return" incorrectly references the schema type for Bar in the "urn:barresultns". In this case the schema type for Bar is in the "http://echo.org/" namespace, since "http://echo.org/" was specified as the defaultTargetNamespace and no @XmlType or @XmlSchema annotation has specified anything different.
Comment 1 Matt MacIvor CLA 2011-02-28 15:22:01 EST
Created attachment 189989 [details]
Propsed Fix
Comment 2 Matt MacIvor CLA 2011-03-01 09:59:13 EST
Attached patch checked in to SVN
Reviewed by Blaise Doughan
Comment 3 Eclipse Webmaster CLA 2022-06-09 10:30:19 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink