You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Rebecca Searls (JIRA)" <ji...@apache.org> on 2015/06/20 17:53:00 UTC

[jira] [Commented] (CXF-6469) schemaLocation in xsd import is not rewritten correctly in Java 8

    [ https://issues.apache.org/jira/browse/CXF-6469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14594656#comment-14594656 ] 

Rebecca Searls commented on CXF-6469:
-------------------------------------


The fundamental cause of the difference between running the app with JDK 1.7 and 1.8
is the order of entries returned from HashMap and apache CXF's unintended assumption
about that order.

Method WSDLGetUtils.updateSchemaImports performs a depth-first processing of schema
imports (i.e. schemaLocation=) in referenced WSDL and XSD files.  The relative path
to each schemaLocation is re-calculated relative to the root WSDL in method
WSDLGetUtils.findSchemaLocation (line 459 in WSDLGetUtils.updateSchemaImports).  A
reference to the re-calculated schemaLocation path and its corresponding DOM
element is save in a Map for reference by future passes and document display.

When using JDK 1.7 the order of root WSDLs processed is  
    -0 imported/OSSJ-OrderManagement-v1-0.wsdl
    -1./SmpOrderManagementBase-v1-0.wsdl
    -2 imported/bw-2.wsdl

All schemaLocation paths found in the OSSJ-OrderManagement-v1-0 tree are compared
to, vfs:/content/SmpOrderMgrWebServices.war/WEB-INF/wsdl/imported   {/OSSJ-OrderManagement-v1-0.wsdl}
In this file all of the schemaLocation declarations are of the form "./<some>.xsd".
This results in reference Map (variable doneSchemas) entries of
      OSSJ-Common-CBEBi-v1-5.xsd
      OSSJ-Common-CBEDatatypes-v1-5.xsd
      OSSJ-Common-CBECore-v1-5.xsd
      OSSJ-Common-CBELocation-v1-5.xsd
      OSSJ-Common-CBEService-v1-5.xsd
      OSSJ-Common-CBEParty-v1-5.xsd
      OSSJ-Common-v1-5.xsd
      OSSJ-Common-CBEProductOffering-v1-5.xsd
      OSSJ-Common-CBEResource-v1-5.xsd

The schemaLocation declarations in SmpOrderManagementBase-v1-0.xsd are of the form "imported/<some>.xsd".
The processing of SmpOrderManagementBase-v1-0.wsdl yields entries
    imported/OSSJ-Common-v1-5.xsd
    imported/OSSJ-Common-CBEBi-v1-5.xsd
    imported/OSSJ-Common-CBECore-v1-5.xsd
    imported/OSSJ-OrderManagement-v1-0.xsd
which are added to the Map.  
 
When using JDK 1.8 the order of root WSDLs processed is
    -0./SmpOrderManagementBase-v1-0.wsdl
    -1 imported/OSSJ-OrderManagement-v1-0.wsdl
    -2 imported/bw-2.wsdl

All schemaLocation paths found in the SmpOrderManagementBase-v1-0 tree are compared
to, vfs:/content/SmpOrderMgrWebServices.war/WEB-INF/wsdl/  {SmpOrderManagementBase-v1-0.wsdl}
The schemaLocation declarations in SmpOrderManagementBase-v1-0.xsd are registered in Map as
    imported/OSSJ-Common-v1-5.xsd
    imported/OSSJ-Common-CBEBi-v1-5.xsd
    :
In addition all schemaLocation declarations in OSSJ-OrderManagement-v1-0.xsd are re-calculated to also
be "imported/<filename>.xsd" because of the path's relationship to vfs:/content/SmpOrderMgrWebServices.war/WEB-INF/wsdl/.

This results in reference Map entries of
    SmpSubscriberEntity-v1-5.xsd
    imported/OSSJ-Common-CBEService-v1-5.xsd
    imported/OSSJ-Common-CBEResource-v1-5.xsd
    imported/OSSJ-Common-CBEProduct-v1-5.xsd
    imported/OSSJ-Common-CBEDatatypes-v1-5.xsd
    imported/OSSJ-Common-CBEParty-v1-5.xsd
    imported/OSSJ-Common-v1-5.xsd
    imported/OSSJ-Common-CBEProductOffering-v1-5.xsd
    imported/OSSJ-OrderManagement-v1-0.xsd
    SmpCommon-v1-5.xsd
    imported/OSSJ-Common-CBELocation-v1-5.xsd
    imported/OSSJ-Common-CBEBi-v1-5.xsd
    SmpOrderManagement-v1-0.xsd
    imported/OSSJ-Common-CBECore-v1-5.xsd

Map, doneSchema, is use to lookup the the fragment of the URI to use when displaying
the XSD.  This is done in method WSDLGetUtils.mapUri.


This path re-calculation with a different ref root path explains why Jan saw a different Map size
when the app was run with JDK 1.7 and JDK 1.8.  It also explains why the displayed xsd has differences
in its schemaLocation re-calculation.



> schemaLocation in xsd import is not rewritten correctly in Java 8
> -----------------------------------------------------------------
>
>                 Key: CXF-6469
>                 URL: https://issues.apache.org/jira/browse/CXF-6469
>             Project: CXF
>          Issue Type: Bug
>            Reporter: Rebecca Searls
>         Attachments: SmpOrderMgrWebServices.war
>
>
> This issue exists for the current and all previous cxf versions that will be run with Java 8.
> Java 7 and Java 8 yield different rewritten schemaLocations for an app that processes multiple
> wsdls.
> Using Java 7, their XSD schemaLocations are correctly expanded like this:
> <import namespace="http://ossj.org/xml/Common/v1-5" schemaLocation="http://localhost:8080/SmpOrderMgrWebServices/JVTOrderManagementSessionSOAP12?xsd=OSSJ-Common-v1-5.xsd"/>
> <import namespace="http://ossj.org/xml/Common-CBEBi/v1-5" schemaLocation="http://localhost:8080/SmpOrderMgrWebServices/JVTOrderManagementSessionSOAP12?xsd=OSSJ-Common-CBEBi-v1-5.xsd"/>
> <import namespace="http://ossj.org/xml/Common-CBECore/v1-5" schemaLocation="http://localhost:8080/SmpOrderMgrWebServices/JVTOrderManagementSessionSOAP12?xsd=OSSJ-Common-CBECore-v1-5.xsd"/>
> <import namespace="http://ossj.org/xml/Common-CBEResource/v1-5" schemaLocation="http://localhost:8080/SmpOrderMgrWebServices/JVTOrderManagementSessionSOAP12?xsd=OSSJ-Common-CBEResource-v1-5.xsd"/>
> <import namespace="http://ossj.org/xml/Common-CBEDatatypes/v1-5" schemaLocation="http://localhost:8080/SmpOrderMgrWebServices/JVTOrderManagementSessionSOAP12?xsd=OSSJ-Common-CBEDatatypes-v1-5.xsd"/>
> <import namespace="http://ossj.org/xml/Common-CBEProduct/v1-5" schemaLocation="http://localhost:8080/SmpOrderMgrWebServices/JVTOrderManagementSessionSOAP12?xsd=OSSJ-Common-CBEProduct-v1-5.xsd"/>
> <import namespace="http://ossj.org/xml/Common-CBEProductOffering/v1-5" schemaLocation="http://localhost:8080/SmpOrderMgrWebServices/JVTOrderManagementSessionSOAP12?xsd=OSSJ-Common-CBEProductOffering-v1-5.xsd"/>
> <import namespace="http://ossj.org/xml/Common-CBEService/v1-5" schemaLocation="http://localhost:8080/SmpOrderMgrWebServices/JVTOrderManagementSessionSOAP12?xsd=OSSJ-Common-CBEService-v1-5.xsd"/>
> <import namespace="http://ossj.org/xml/Common-CBEParty/v1-5" schemaLocation="http://localhost:8080/SmpOrderMgrWebServices/JVTOrderManagementSessionSOAP12?xsd=OSSJ-Common-CBEParty-v1-5.xsd"/>
> But on Java 8, only the first schemaLocation is expanded, the others are not:
> <import namespace="http://ossj.org/xml/Common/v1-5" schemaLocation="http://localhost:8080/SmpOrderMgrWebServices/JVTOrderManagementSessionSOAP12?xsd=OSSJ-Common-v1-5.xsd"/>
> <import namespace="http://ossj.org/xml/Common-CBEBi/v1-5" schemaLocation="./OSSJ-Common-CBEBi-v1-5.xsd"/>
> <import namespace="http://ossj.org/xml/Common-CBECore/v1-5" schemaLocation="./OSSJ-Common-CBECore-v1-5.xsd"/>
> <import namespace="http://ossj.org/xml/Common-CBEResource/v1-5" schemaLocation="./OSSJ-Common-CBEResource-v1-5.xsd"/>
> <import namespace="http://ossj.org/xml/Common-CBEDatatypes/v1-5" schemaLocation="./OSSJ-Common-CBEDatatypes-v1-5.xsd"/>
> <import namespace="http://ossj.org/xml/Common-CBEProduct/v1-5" schemaLocation="./OSSJ-Common-CBEProduct-v1-5.xsd"/>
> <import namespace="http://ossj.org/xml/Common-CBEProductOffering/v1-5" schemaLocation="./OSSJ-Common-CBEProductOffering-v1-5.xsd"/>
> <import namespace="http://ossj.org/xml/Common-CBEService/v1-5" schemaLocation="./OSSJ-Common-CBEService-v1-5.xsd"/>
> <import namespace="http://ossj.org/xml/Common-CBEParty/v1-5" schemaLocation="./OSSJ-Common-CBEParty-v1-5.xsd"/>
> To reproduce the issue, all you need to do is deploy the attached war file (SmpOrderMgrWebServices.war) and point your browser to:
> http://localhost:8080/SmpOrderMgrWebServices/JVTOrderManagementSessionSOAP12?xsd=OSSJ-OrderManagement-v1-0.xsd



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