You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by mm...@apache.org on 2007/03/29 13:19:18 UTC
svn commit: r523670 - in /incubator/cxf/trunk:
api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/
api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/
tools/common/src/main/java/org/apache/cxf/tools/util/
tools/common/src/test/java/org/apache...
Author: mmao
Date: Thu Mar 29 04:19:16 2007
New Revision: 523670
URL: http://svn.apache.org/viewvc?view=rev&rev=523670
Log:
* Update wsdl2java wsdlLocation annotation, use the relative URL if user input relative url
The service class will also use the relative URL
* Suppress unchecked warnings
Modified:
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertion.java
incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilderTest.java
incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/util/URIParserUtil.java
incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/util/URIParserUtilTest.java
incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/VelocityWriter.java
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm
Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertion.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertion.java?view=diff&rev=523670&r1=523669&r2=523670
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertion.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertion.java Thu Mar 29 04:19:16 2007
@@ -49,6 +49,7 @@
}
@Override
+ @SuppressWarnings("unchecked")
public boolean equal(PolicyComponent policyComponent) {
if (!super.equal(policyComponent)) {
return false;
Modified: incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilderTest.java?view=diff&rev=523670&r1=523669&r2=523670
==============================================================================
--- incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilderTest.java (original)
+++ incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilderTest.java Thu Mar 29 04:19:16 2007
@@ -61,6 +61,7 @@
}
@Test
+ @SuppressWarnings("unchecked")
public void testBuild() throws Exception {
QName qn = new QName("http://cxf.apache.org/test/assertions/foo", "FooType");
JaxbAssertionBuilder<FooType> ab = new JaxbAssertionBuilder<FooType>(FooType.class, qn);
Modified: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/util/URIParserUtil.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/util/URIParserUtil.java?view=diff&rev=523670&r1=523669&r2=523670
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/util/URIParserUtil.java (original)
+++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/util/URIParserUtil.java Thu Mar 29 04:19:16 2007
@@ -21,7 +21,6 @@
import java.io.File;
import java.net.MalformedURLException;
-import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
@@ -216,31 +215,41 @@
return KEYWORDS.contains(token);
}
- public static String normalize(String uri) {
- File file = new File(uri);
- if (file.isAbsolute()) {
- return getAbsoluteURI(uri);
- }
- return uri.replace("\\", "/");
+ public static String normalize(final String uri) {
+ URL url = null;
+ try {
+ url = new URL(uri);
+ return url.toString();
+ } catch (MalformedURLException e1) {
+ try {
+ String f = null;
+ if (uri.indexOf(":") != -1) {
+ f = "file:/" + uri;
+ } else {
+ f = "file:" + uri;
+ }
+
+ url = new URL(f);
+ return url.toString();
+ } catch (MalformedURLException e2) {
+ return uri.replace("\\", "/");
+ }
+ }
}
- public static String getAbsoluteURI(String arg) {
- if (arg.startsWith("jar")) {
- return arg;
- }
-
- File tmpFile = null;
- URI uri = null;
+ public static String getAbsoluteURI(final String arg) {
try {
- uri = new URI(arg);
- if (!uri.isAbsolute()) {
- File tmpfile = new File("");
- uri = tmpfile.toURI().resolve(uri);
- }
- tmpFile = new File(uri);
- } catch (URISyntaxException e) {
- tmpFile = new File(arg);
+ URL url = new URL(normalize(arg));
+ if (url.toURI().isOpaque()
+ && "file".equalsIgnoreCase(url.getProtocol())) {
+ return new File("").toURI().resolve(url.getPath()).toString();
+ } else {
+ return normalize(arg);
+ }
+ } catch (MalformedURLException e1) {
+ return normalize(arg);
+ } catch (URISyntaxException e2) {
+ return getAbsoluteURI(normalize(arg));
}
- return tmpFile.toURI().toString();
}
}
Modified: incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/util/URIParserUtilTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/util/URIParserUtilTest.java?view=diff&rev=523670&r1=523669&r2=523670
==============================================================================
--- incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/util/URIParserUtilTest.java (original)
+++ incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/util/URIParserUtilTest.java Thu Mar 29 04:19:16 2007
@@ -32,13 +32,22 @@
public void testNormalize() throws Exception {
String uri = "wsdl/hello_world.wsdl";
- assertEquals(uri, URIParserUtil.normalize(uri));
+ assertEquals("file:wsdl/hello_world.wsdl", URIParserUtil.normalize(uri));
uri = "\\src\\wsdl/hello_world.wsdl";
- assertEquals("/src/wsdl/hello_world.wsdl", URIParserUtil.normalize(uri));
+ assertEquals("file:/src/wsdl/hello_world.wsdl", URIParserUtil.normalize(uri));
uri = "wsdl\\hello_world.wsdl";
- assertEquals("wsdl/hello_world.wsdl", URIParserUtil.normalize(uri));
+ assertEquals("file:wsdl/hello_world.wsdl", URIParserUtil.normalize(uri));
+
+ uri = "http://hello.com";
+ assertEquals("http://hello.com", URIParserUtil.normalize(uri));
+
+ uri = "file:///c:\\hello.wsdl";
+ assertEquals("file:/c:/hello.wsdl", URIParserUtil.normalize(uri));
+
+ uri = "c:\\hello.wsdl";
+ assertEquals("file:/c:/hello.wsdl", URIParserUtil.normalize(uri));
}
public void testGetAbsoluteURI() throws Exception {
@@ -47,11 +56,21 @@
assertNotNull(uri2);
assertTrue(uri2.startsWith("file"));
assertTrue(uri2.contains(uri));
+ assertTrue(uri2.contains(new java.io.File("").toString()));
uri = getClass().getResource("/schemas/wsdl/xml-binding.xsd").toString();
- System.err.println(uri);
uri2 = URIParserUtil.getAbsoluteURI(uri);
assertNotNull(uri2);
+ assertTrue(uri2.startsWith("file"));
assertTrue(uri2.contains(uri));
+ assertTrue(uri2.contains(new java.io.File("").toString()));
+
+ uri = "c:\\wsdl\\hello_world.wsdl";
+ uri2 = URIParserUtil.getAbsoluteURI(uri);
+ assertNotNull(uri2);
+ assertEquals("file:/c:/wsdl/hello_world.wsdl", uri2);
+
+ uri = "http://hello/world.wsdl";
+ assertEquals(uri, URIParserUtil.getAbsoluteURI(uri));
}
}
Modified: incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/VelocityWriter.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/VelocityWriter.java?view=diff&rev=523670&r1=523669&r2=523670
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/VelocityWriter.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/VelocityWriter.java Thu Mar 29 04:19:16 2007
@@ -57,7 +57,7 @@
super.write(str.replaceAll("\r\n", newLine));
return;
} else if (str.indexOf("\n") >= 0 && newLine != null) {
- super.write(str.replaceAll("\r\n", newLine));
+ super.write(str.replaceAll("\n", newLine));
return;
} else {
super.write(str);
Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm?view=diff&rev=523670&r1=523669&r2=523670
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm (original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm Thu Mar 29 04:19:16 2007
@@ -48,7 +48,8 @@
try {
url = new URL("$wsdlLocation");
} catch (MalformedURLException e) {
- e.printStackTrace();
+ System.err.println("Can not initialize the default wsdl from $wsdlLocation");
+ // e.printStackTrace();
}
WSDL_LOCATION = url;
}