cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [1/3] cxf git commit: CXF-6234 - Ensure imported schema locations are resolved correctly Fix checkstyle errors This closes #51
Date Mon, 09 Feb 2015 16:26:20 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 745608908 -> f71738d89


CXF-6234 - Ensure imported schema locations are resolved correctly
Fix checkstyle errors
This closes #51


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/2fdf389b
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/2fdf389b
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/2fdf389b

Branch: refs/heads/master
Commit: 2fdf389be5cf4d92dc4ec7e696d83ea48994a6a4
Parents: 7456089
Author: Mustafa Musaji <mmusaji@redhat.com>
Authored: Mon Feb 2 10:28:32 2015 +0000
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Mon Feb 9 10:54:24 2015 -0500

----------------------------------------------------------------------
 .../org/apache/cxf/frontend/WSDLGetUtils.java   | 47 ++++++++++++++++----
 1 file changed, 39 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/2fdf389b/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java
----------------------------------------------------------------------
diff --git 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
index 07d96e4..c0b545f 100644
--- 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
@@ -392,7 +392,7 @@ public class WSDLGetUtils {
                 : CastUtils.cast(types.getExtensibilityElements(), ExtensibilityElement.class))
{
                 if (el instanceof Schema) {
                     Schema see = (Schema)el;
-                    updateSchemaImports(bus, see, see.getDocumentBaseURI(), doneSchemas,
base);
+                    updateSchemaImports(bus, see, see.getDocumentBaseURI(), doneSchemas,
base, null);
                 }
             }
         }
@@ -449,7 +449,8 @@ public class WSDLGetUtils {
                                        Schema schema,
                                        String docBase,
                                        Map<String, SchemaReference> doneSchemas,
-                                       String base) {
+                                       String base,
+                                       String parent) {
         OASISCatalogManager catalogs = OASISCatalogManager.getCatalogManager(bus);
         Collection<List<?>>  imports = CastUtils.cast((Collection<?>)schema.getImports().values());
         for (List<?> lst : imports) {
@@ -481,14 +482,29 @@ public class WSDLGetUtils {
                                 new URL(start);
                             } catch (MalformedURLException e) {
                                 if (doneSchemas.put(decodedStart, imp) == null) {
-                                    updateSchemaImports(bus, imp.getReferencedSchema(), docBase,
doneSchemas, base);
+                                    try {
+                                        //CHECKSTYLE:OFF:NestedIfDepth
+                                        if (!(new URI(decodedStart).isAbsolute()) &&
parent != null) {
+                                            resolvedSchemaLocation = new URI(parent).resolve(decodedStart).toString();
+                                            decodedStart = URLDecoder.decode(resolvedSchemaLocation,
"utf-8");
+                                            doneSchemas.put(resolvedSchemaLocation, imp);
+                                        }
+                                        //CHECKSTYLE:ON:NestedIfDepth 
+                                    } catch (URISyntaxException ex) {
+                                        // ignore
+                                    } catch (UnsupportedEncodingException ex) {
+                                        // ignore
+                                    }
+                                    updateSchemaImports(bus, imp.getReferencedSchema(), docBase,
+                                                        doneSchemas, base, decodedStart);
                                 }
                             }
                         } else {
                             if (doneSchemas.put(decodedStart, imp) == null) {
                                 doneSchemas.put(resolvedSchemaLocation, imp);
                                 doneSchemas.put(imp.getSchemaLocationURI(), imp);
-                                updateSchemaImports(bus, imp.getReferencedSchema(), docBase,
doneSchemas, base);
+                                updateSchemaImports(bus, imp.getReferencedSchema(), docBase,
+                                                    doneSchemas, base, decodedStart);
                             }
                         }
                     }
@@ -521,7 +537,8 @@ public class WSDLGetUtils {
                             new URL(start);
                         } catch (MalformedURLException e) {
                             if (doneSchemas.put(decodedStart, included) == null) {
-                                updateSchemaImports(bus, included.getReferencedSchema(),
docBase, doneSchemas, base);
+                                updateSchemaImports(bus, included.getReferencedSchema(),

+                                                    docBase, doneSchemas, base, decodedStart);
                             }
                         }
                     }
@@ -529,7 +546,7 @@ public class WSDLGetUtils {
                     || !doneSchemas.containsKey(resolvedSchemaLocation)) {
                     doneSchemas.put(decodedStart, included);
                     doneSchemas.put(resolvedSchemaLocation, included);
-                    updateSchemaImports(bus, included.getReferencedSchema(), docBase, doneSchemas,
base);
+                    updateSchemaImports(bus, included.getReferencedSchema(), docBase, doneSchemas,
base, decodedStart);
                 }
             }
         }
@@ -558,7 +575,21 @@ public class WSDLGetUtils {
                             new URL(start);
                         } catch (MalformedURLException e) {
                             if (doneSchemas.put(decodedStart, included) == null) {
-                                updateSchemaImports(bus, included.getReferencedSchema(),
docBase, doneSchemas, base);
+                                try {
+                                    //CHECKSTYLE:OFF:NestedIfDepth
+                                    if (!(new URI(decodedStart).isAbsolute()) &&
parent != null) {
+                                        resolvedSchemaLocation = new URI(parent).resolve(decodedStart).toString();
+                                        decodedStart = URLDecoder.decode(resolvedSchemaLocation,
"utf-8");
+                                        doneSchemas.put(resolvedSchemaLocation, included);
+                                    }
+                                    //CHECKSTYLE:ON:NestedIfDepth
+                                } catch (URISyntaxException ex) {
+                                    // ignore
+                                } catch (UnsupportedEncodingException ex) {
+                                    // ignore
+                                }
+                                updateSchemaImports(bus, included.getReferencedSchema(),
+                                                    docBase, doneSchemas, base, decodedStart);
                             }
                         }
                     }
@@ -566,7 +597,7 @@ public class WSDLGetUtils {
                     || !doneSchemas.containsKey(resolvedSchemaLocation)) {
                     doneSchemas.put(decodedStart, included);
                     doneSchemas.put(resolvedSchemaLocation, included);
-                    updateSchemaImports(bus, included.getReferencedSchema(), docBase, doneSchemas,
base);
+                    updateSchemaImports(bus, included.getReferencedSchema(), docBase, doneSchemas,
base, decodedStart);
                 }
             }
         }


Mime
View raw message