Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 354618 - Schema Gen: Change suggested file name to start with 1 rather than 0
Summary: Schema Gen: Change suggested file name to start with 1 rather than 0
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-12 09:20 EDT by Blaise Doughan CLA
Modified: 2022-06-09 10:34 EDT (History)
1 user (show)

See Also:


Attachments
MOXy - Fix (737 bytes, patch)
2011-08-15 15:24 EDT, Blaise Doughan CLA
no flags Details | Diff
MOXy - Test Cases (43.40 KB, patch)
2011-08-15 15:25 EDT, Blaise Doughan CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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