You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2015/02/09 17:26:20 UTC
[1/3] cxf git commit: CXF-6234 - Ensure imported schema locations are
resolved correctly Fix checkstyle errors This closes #51
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 <mm...@redhat.com>
Authored: Mon Feb 2 10:28:32 2015 +0000
Committer: Daniel Kulp <dk...@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);
}
}
}
[3/3] cxf git commit: Fix failures now that we're back to Jetty9
Posted by dk...@apache.org.
Fix failures now that we're back to Jetty9
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/f71738d8
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/f71738d8
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/f71738d8
Branch: refs/heads/master
Commit: f71738d894d4143ed57b956ef1dd68aec5b1b41d
Parents: db92bc6
Author: Daniel Kulp <dk...@apache.org>
Authored: Mon Feb 9 11:12:13 2015 -0500
Committer: Daniel Kulp <dk...@apache.org>
Committed: Mon Feb 9 11:12:13 2015 -0500
----------------------------------------------------------------------
.../apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java | 1 +
.../java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/f71738d8/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
----------------------------------------------------------------------
diff --git a/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java b/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
index 54bc659..ad21c55 100644
--- a/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
+++ b/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
@@ -349,6 +349,7 @@ public class JettyHTTPServerEngine implements ServerEngine {
//need an error handler that won't leak information about the exception
//back to the client.
ErrorHandler eh = new ErrorHandler() {
+ @SuppressWarnings("deprecation")
public void handle(String target, Request baseRequest,
HttpServletRequest request, HttpServletResponse response)
throws IOException {
http://git-wip-us.apache.org/repos/asf/cxf/blob/f71738d8/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
----------------------------------------------------------------------
diff --git a/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java b/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
index c8bdab7..411d1a2 100644
--- a/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
+++ b/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
@@ -45,6 +45,7 @@ import org.apache.cxf.tools.wsdlto.AbstractCodeGenTest;
import org.apache.cxf.tools.wsdlto.WSDLToJava;
import org.apache.cxf.tools.wsdlto.frontend.jaxws.validator.UniqueBodyValidator;
import org.apache.cxf.wsdl11.WSDLRuntimeException;
+import org.eclipse.jetty.server.NetworkConnector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.ResourceHandler;
@@ -493,7 +494,7 @@ public class CodeGenBugTest extends AbstractCodeGenTest {
// 'add' it.
server.setHandler(reshandler);
server.start();
- int port = server.getConnectors()[0].getLocalPort();
+ int port = ((NetworkConnector)server.getConnectors()[0]).getLocalPort();
env.put(ToolConstants.CFG_WSDLURL, "http://localhost:"
+ port + "/hello_world.wsdl");
env.put(ToolConstants.CFG_BINDING, "http://localhost:"
[2/3] cxf git commit: [CXF-6235] wsdl2java behaves differently from
cxf-codegen-plugin This closes #50
Posted by dk...@apache.org.
[CXF-6235] wsdl2java behaves differently from cxf-codegen-plugin
This closes #50
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/db92bc68
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/db92bc68
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/db92bc68
Branch: refs/heads/master
Commit: db92bc6867137132ee742ec79fbd038682b8b540
Parents: 2fdf389
Author: gwuireland <gw...@gmail.com>
Authored: Fri Jan 30 16:49:08 2015 +0000
Committer: Daniel Kulp <dk...@apache.org>
Committed: Mon Feb 9 10:57:04 2015 -0500
----------------------------------------------------------------------
.../apache/cxf/tools/wsdlto/WSDLToJavaContainer.java | 12 ++++++++++++
.../cxf/tools/wsdlto/WSDLToJavaContainerTest.java | 11 +++++++++++
2 files changed, 23 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/db92bc68/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
----------------------------------------------------------------------
diff --git a/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java b/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
index 4f7ed77..3b57251 100644
--- a/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
+++ b/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
@@ -553,11 +553,22 @@ public class WSDLToJavaContainer extends AbstractCXFToolContainer {
if (!env.containsKey(ToolConstants.CFG_WSDLLOCATION)) {
//make sure the "raw" form is used for the wsdlLocation
//instead of the absolute URI that normalize may return
+ boolean assumeFileURI = false;
try {
URI uri = new URI(wsdl);
+
+ String uriScheme = uri.getScheme();
+ if (uriScheme == null) {
+ assumeFileURI = true;
+ }
+
wsdl = uri.toString();
} catch (Exception e) {
//not a URL, assume file
+ assumeFileURI = true;
+ }
+
+ if (assumeFileURI) {
if (wsdl.indexOf(":") != -1 && !wsdl.startsWith("/")) {
wsdl = "file:/" + wsdl;
} else {
@@ -570,6 +581,7 @@ public class WSDLToJavaContainer extends AbstractCXFToolContainer {
//ignore...
}
}
+
wsdl = wsdl.replace("\\", "/");
env.put(ToolConstants.CFG_WSDLLOCATION, wsdl);
http://git-wip-us.apache.org/repos/asf/cxf/blob/db92bc68/tools/wsdlto/core/src/test/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainerTest.java
----------------------------------------------------------------------
diff --git a/tools/wsdlto/core/src/test/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainerTest.java b/tools/wsdlto/core/src/test/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainerTest.java
index f4b7213..97d44f5 100644
--- a/tools/wsdlto/core/src/test/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainerTest.java
+++ b/tools/wsdlto/core/src/test/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainerTest.java
@@ -66,6 +66,17 @@ public class WSDLToJavaContainerTest extends Assert {
assertTrue(context.optionSet(ToolConstants.CFG_SUPPRESS_WARNINGS));
}
+ @Test
+ public void testWsdlLocationDefaultSchemeIsFile() throws Exception {
+ WSDLToJavaContainer container = new WSDLToJavaContainer("dummy", null);
+ ToolContext context = new ToolContext();
+ context.put(ToolConstants.CFG_WSDLURL, getLocation("hello_world.wsdl"));
+ container.setContext(context);
+ container.validate(context);
+ String wsdlLocation = (String)context.get(ToolConstants.CFG_WSDLLOCATION);
+ assertTrue("default scheme for wsdlLocation is file", wsdlLocation.startsWith("file:"));
+ }
+
private String getLocation(String wsdlFile) throws URISyntaxException {
return this.getClass().getResource(wsdlFile).toURI().getPath();
}