[ 
https://issues.apache.org/jira/browse/CXF-6840?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Colm O hEigeartaigh closed CXF-6840.
------------------------------------

> xsd:import without schemaLocation does not get resolved in SchemaHandler
> ------------------------------------------------------------------------
>
>                 Key: CXF-6840
>                 URL: https://issues.apache.org/jira/browse/CXF-6840
>             Project: CXF
>          Issue Type: Improvement
>          Components: JAX-RS
>    Affects Versions: 3.1.5
>            Reporter: Vjacheslav Borisov
>            Assignee: Sergey Beryozkin
>            Priority: Trivial
>             Fix For: 3.1.6, 3.0.9, 3.2.0
>
>         Attachments: SchemaHandler.java.diff
>
>
> xsd:import without schemaLocation does not resolve in 
> org.apache.cxf.jaxrs.utils.schemas.SchemaHandler using catalog.xml
> and "public" record (but works in cxf-wadl2java-plugin)
> Example xsd import: 
> <xsd:import namespace="urn:some:namespace"/>
> Example catalog entry:
> <public 
> publicId="urn:some:namespace"uri="classpath:schemas/some/namespace.xsd" />
> This doc says that <public> entry should be enough to resolve xsd:import 
> without schemaLocation:
> https://jaxb.java.net/guide/Fixing_broken_references_in_schema.html
> Found where it takes place in case of cxf-wadl2java-plugin, 
> please see SchemaCompilerImpl.bind(), it passes namespaceURI as publicId 
> parameter, while SchemaHandler passes publicId as publicId, which is null, 
> and resolve does not takes place.
> http://grepcode.com/file/repo1.maven.org/maven2/com.sun.xml.bind/jaxb-xjc/2.2.11/com/sun/tools/xjc/api/impl/s2j/SchemaCompilerImpl.java
>                             // XSOM passes the namespace URI to the publicID 
> parameter.
>                             // we do the same here .
>                             InputSource is = 
> opts.entityResolver.resolveEntity(namespaceURI, systemId);
> So I suppose this minor patch  could fix SchemaHandler:
> replace 
> resolvedLocation = catalogResolver.resolvePublic(publicId, systemId);
> with
> resolvedLocation = 
> catalogResolver.resolvePublic(publicId!=null?publicId:namespaceURI, systemId);
> Also I can submit test project url if needed



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to