You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Simon Nash (JIRA)" <de...@tuscany.apache.org> on 2011/08/21 12:57:27 UTC

[jira] [Updated] (TUSCANY-1362) Incorrect operation of code that checks whether schema is loaded before going out on the net to retrieve it.

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

Simon Nash updated TUSCANY-1362:
--------------------------------

    Affects Version/s:     (was: Java-SDO-M2)
                       C++-SDO-Next
        Fix Version/s: C++-SDO-Next

Changed affected version from Java to C++

> Incorrect operation of code that checks whether schema is loaded before going out on the net to retrieve it. 
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1362
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1362
>             Project: Tuscany
>          Issue Type: Bug
>          Components: C++ SDO
>    Affects Versions: C++-SDO-Next
>         Environment: All
>            Reporter: Simon Laws
>            Priority: Minor
>             Fix For: C++-SDO-Next
>
>
> There is code in SDOSchemeSAX2Parse.cpp that decideds whether to go ahead and parse the referenced file
>         SDOSchemaSAX2Parser* ParserErrorSetter::parseIfNot(const void* location, bool loadImportNamespace, const void* base)
>         {
>             xmlChar*const absoluteUri = xmlBuildURI((xmlChar*)location, (xmlChar*)base);
>             if (! absoluteUri)
>                 SDO_THROW_EXCEPTION("parseIfNot", SDOFileNotFoundException, (char*)location);
>             LocationParserMap::iterator iter = parsedLocations.find(absoluteUri);
>             if (parsedLocations.end() == iter)
>             {
>                 SDOSchemaSAX2Parser*const schemaParser = new SDOSchemaSAX2Parser(*new SchemaInfo(), this, loadImportNamespace);
> 			    try {
> 				    if (0 == schemaParser->parse((char*)absoluteUri))
>  ***                       return parsedLocations[ absoluteUri ] = schemaParser;
>                 }
> 			    catch (SDORuntimeException e)
> 			    {}
>                 schemaParser->free(absoluteUri);
>                 return 0;
>             }
>             xmlFree(absoluteUri);
>             return iter->second;
>         }
> Note the line marked ***. This adds the current URL being parse to the parsedLocations list for future reference. The issue is that, in the case where no schemaLocation is provided and loadImportNamespace is true, this will not work if the schema was orginally loaded from the file system, for example
> /mydir/schema1.xsd  - parsedLocation = "file:///mydir/schema1.xsd
>     targetNamespace="http://schemas.xmlsoap.org/wsdl/"
> /mydir/schema2.xsd 
>   <xs:import namespace = "http://schemas.xmlsoap.org/wsdl/" /> - doesn't hit parsedLocation as it not the same URL as was originally used to load schema1
> A solution is to store both the provided location and the target namsepace in parsedLocation

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira