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

Bug 354618

Summary: Schema Gen: Change suggested file name to start with 1 rather than 0
Product: z_Archived Reporter: Blaise Doughan <blaise.doughan>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: eclipselink.oxm-inbox
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
MOXy - Fix
none
MOXy - Test Cases none

Description Blaise Doughan CLA 2011-08-12 09:20:08 EDT
To be consistent with the JAXB referenced implementation we should change the numeric suffix on the suggested file name to start with 1 rather than 0.

Example:

import java.io.IOException;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.SchemaOutputResolver;
import javax.xml.transform.Result;
import javax.xml.transform.stream.StreamResult;

public class Demo {

    public static void main(String[] args) throws Exception {
        final SchemaOutputResolver sor = new SchemaOutputResolver() {
            @Override
            public Result createOutput(String namespaceUri,
                    String suggestedFileName) throws IOException {
                System.out.println(suggestedFileName);
                Result r = new StreamResult(System.out);
                r.setSystemId(suggestedFileName);
                return r;
            }
        };

        JAXBContext jc = JAXBContext.newInstance(FooBar.class, A.class);
        System.out.println(jc.getClass());
        jc.generateSchema(sor);
    }

}


MOXy's suggested file name:  schema0.xsd
RI's suggested file name:  schema1.xsd
Comment 1 Blaise Doughan CLA 2011-08-15 15:24:43 EDT
Created attachment 201516 [details]
MOXy - Fix
Comment 2 Blaise Doughan CLA 2011-08-15 15:25:05 EDT
Created attachment 201517 [details]
MOXy - Test Cases
Comment 3 Blaise Doughan CLA 2011-08-15 15:49:03 EDT
Fix checked into 2.3.1 at rev:  9893
Fix checked into trunk at rev:  9894

Code reviewed by: Matt MacIvor

Fix Description:
Started the schema counter at 1 instead of 0.
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:34:19 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink