You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by GitBox <gi...@apache.org> on 2022/03/04 09:09:23 UTC

[GitHub] [cxf] rmartinc commented on a change in pull request #904: [CXF-8655] Incorrect XSD resolution when the file name is the same in different folders

rmartinc commented on a change in pull request #904:
URL: https://github.com/apache/cxf/pull/904#discussion_r819389730



##########
File path: rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java
##########
@@ -566,9 +566,6 @@ private void processSchemaReference(SchemaReference schemaReference,
                         
                         doneSchemas.put(decodedStart, schemaReference);
                         doneSchemas.put(schemaReference.getReferencedSchema().getDocumentBaseURI(), schemaReference);
-                        if (!doneSchemas.containsKey(decodedOrigLocation)) {

Review comment:
       OK @reta, no problem, we can wait a bit more for @dkulp.
   
   I understand your idea, but it would not be in the second if, the change would go in the first one, something like this:
   
   ```diff
   --- a/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java
   +++ b/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java
   @@ -552,7 +552,9 @@ public class WSDLGetUtils {
                                    start), e);
                }
    
   -            if (!doneSchemas.containsKey(decodedStart)) {
   +            final SchemaReference doneSchema = doneSchemas.get(decodedStart);
   +            if (doneSchema == null || !doneSchema.getSchemaLocationURI().equals(
   +                    schemaReference.getSchemaLocationURI())) {
                    String resolvedSchemaLocation = resolveWithCatalogs(catalogs, start, base);
                    if (resolvedSchemaLocation == null) {
                        resolvedSchemaLocation =
   ```
   Note that the problem is that the incorrect schema is added first, so we cannot do anything at that point. The idea is adding the second one if not exists or if it is different in URI (it's another schema).
   
   I have tested that solution and it works good for my case. No issues detected in the TS either.
   
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org