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 2009/08/13 20:33:26 UTC
svn commit: r803981 - in /cxf/branches/2.1.x-fixes: ./
common/common/src/main/java/org/apache/cxf/jaxb/
rt/core/src/main/java/org/apache/cxf/interceptor/
rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/
rt/databinding/jaxb/src/main/java/org/apach...
Author: dkulp
Date: Thu Aug 13 18:33:25 2009
New Revision: 803981
URL: http://svn.apache.org/viewvc?rev=803981&view=rev
Log:
Merged revisions 803960 via svnmerge from
https://svn.apache.org/repos/asf/cxf/branches/2.2.x-fixes
................
r803960 | dkulp | 2009-08-13 13:51:31 -0400 (Thu, 13 Aug 2009) | 9 lines
Merged revisions 802892 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r802892 | dkulp | 2009-08-10 14:45:42 -0400 (Mon, 10 Aug 2009) | 1 line
Make more stuff work if asm isn't available.
........
................
Modified:
cxf/branches/2.1.x-fixes/ (props changed)
cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/jaxb/JAXBUtils.java
cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java
cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedOutInterceptor.java
cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java
Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Aug 13 18:33:25 2009
@@ -1,2 +1,2 @@
-/cxf/branches/2.2.x-fixes:743446,753380,753397,753421,754585,755365,757499,757859,757899,757935,757951,758195,758303,758308,758378,758690,758910,759890,759961,759963-759964,759966,760029,760073,760150,760171,760178,760198,760212,760456,760468,760582,760938,761094,761113,761120,761317,761759,761789,762393,762518,762567,763200,763272,763495,763854,763931,763942,763953,764033-764034,764581,764599-764606,764887,765357,766013,766058,766100-766101,766763,766770,766860,766962-766963,767159,767191,767927,771416,772143,772402,772658,772714,773009-773010,773027,773049,773146,773581,773691,773693,774446-774496,774558,774760,774851,774979,775423,776024-776025,776218,776429,776459,777189,777224,777243,777481,777505,777572,777580,780033,780184,780213,780421,780664,780800,780902,780911,781497,781841,782733,782735-782736,783099,783407,784064,784197,785293,785296,785298-785299,785301,785656,786158,786587,786589,786591-786592,786640,787272,787276,787282-787283,787285,787295,787307,787324,7873
67,788824-788825,788827-788828,788830,789423,789429,789707,789709-789710,789712,789721,789905,789908,789910,789912,790295,790646-790647,790651,790654-790655,790659,791948,791950,791952,791955,792276,792288,792291,792992,792995,792998,794402,794404,794735,794797,794799,794803,795161-795162,796300-796301,796598,797449,797452-797453,797460,797463-797464,797521-797522,797584-797585,797645,797652,797701,797884,797886,798348-798350,798568,798574-798575,798577-798578,798586,798608,798655,798752,798942,799444,799449,799738,799740,800514-800516,801382-801384
-/cxf/trunk:782181,782728-782730,783097,783396,784059,784181,784895,785279-785282,785468,786142,786271,786395,786582-786583,786638,786647,787269,787277-787279,787290,787305,787323,787366,788060,788187,788703,788774,788820,789371,789420,789527-789529,789704-789705,789896,789898-789900,790294,790637-790644,791354,791538,791753,791947,792261-792263,792684,792975,792985,794297,794396,794728,794778-794780,794892,795160,796022-796023,796593,796780,797194,797231-797233,797442,797505,797517,797581-797582,797640,797651,797699,797882-797883,798344-798346,798479,798533,798551,798557,798561-798562,798570,798573,798584,798654,798749,798929,799439,799448,799637,799724,799792,800453,800497,801380-801381
+/cxf/branches/2.2.x-fixes:743446,753380,753397,753421,754585,755365,757499,757859,757899,757935,757951,758195,758303,758308,758378,758690,758910,759890,759961,759963-759964,759966,760029,760073,760150,760171,760178,760198,760212,760456,760468,760582,760938,761094,761113,761120,761317,761759,761789,762393,762518,762567,763200,763272,763495,763854,763931,763942,763953,764033-764034,764581,764599-764606,764887,765357,766013,766058,766100-766101,766763,766770,766860,766962-766963,767159,767191,767927,771416,772143,772402,772658,772714,773009-773010,773027,773049,773146,773581,773691,773693,774446-774496,774558,774760,774851,774979,775423,776024-776025,776218,776429,776459,777189,777224,777243,777481,777505,777572,777580,780033,780184,780213,780421,780664,780800,780902,780911,781497,781841,782733,782735-782736,783099,783407,784064,784197,785293,785296,785298-785299,785301,785656,786158,786587,786589,786591-786592,786640,787272,787276,787282-787283,787285,787295,787307,787324,7873
67,788824-788825,788827-788828,788830,789423,789429,789707,789709-789710,789712,789721,789905,789908,789910,789912,790295,790646-790647,790651,790654-790655,790659,791948,791950,791952,791955,792276,792288,792291,792992,792995,792998,794402,794404,794735,794797,794799,794803,795161-795162,796300-796301,796598,797449,797452-797453,797460,797463-797464,797521-797522,797584-797585,797645,797652,797701,797884,797886,798348-798350,798568,798574-798575,798577-798578,798586,798608,798655,798752,798942,799444,799449,799738,799740,800514-800516,801382-801384,803960
+/cxf/trunk:782181,782728-782730,783097,783396,784059,784181,784895,785279-785282,785468,786142,786271,786395,786582-786583,786638,786647,787269,787277-787279,787290,787305,787323,787366,788060,788187,788703,788774,788820,789371,789420,789527-789529,789704-789705,789896,789898-789900,790294,790637-790644,791354,791538,791753,791947,792261-792263,792684,792975,792985,794297,794396,794728,794778-794780,794892,795160,796022-796023,796593,796780,797194,797231-797233,797442,797505,797517,797581-797582,797640,797651,797699,797882-797883,798344-798346,798479,798533,798551,798557,798561-798562,798570,798573,798584,798654,798749,798929,799439,799448,799637,799724,799792,800453,800497,801380-801381,802892
Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/jaxb/JAXBUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/jaxb/JAXBUtils.java?rev=803981&r1=803980&r2=803981&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/jaxb/JAXBUtils.java (original)
+++ cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/jaxb/JAXBUtils.java Thu Aug 13 18:33:25 2009
@@ -561,7 +561,9 @@
typeRefs.add(ref);
List<Class<?>> clses = new ArrayList<Class<?>>(ctxClasses);
clses.add(refClass.getField("type").get(ref).getClass());
- clses.add(refcls);
+ if (!refcls.isInterface()) {
+ clses.add(refcls);
+ }
Object ctx = null;
for (Method m : cls.getDeclaredMethods()) {
Modified: cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java?rev=803981&r1=803980&r2=803981&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java (original)
+++ cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java Thu Aug 13 18:33:25 2009
@@ -192,9 +192,7 @@
}
- if (parameters.size() > 0) {
- message.setContent(List.class, parameters);
- }
+ message.setContent(List.class, parameters);
} catch (Fault f) {
if (!isRequestor(message)) {
f.setFaultCode(Fault.FAULT_CODE_CLIENT);
Modified: cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedOutInterceptor.java?rev=803981&r1=803980&r2=803981&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedOutInterceptor.java (original)
+++ cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedOutInterceptor.java Thu Aug 13 18:33:25 2009
@@ -71,7 +71,8 @@
}
if (pfx == null) {
int x = 1;
- while (xmlWriter.getNamespaceContext().getNamespaceURI("ns" + x) != null) {
+ while (!StringUtils.isEmpty(xmlWriter.getNamespaceContext()
+ .getNamespaceURI("ns" + x))) {
x++;
}
pfx = "ns" + x;
Modified: cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java?rev=803981&r1=803980&r2=803981&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java (original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java Thu Aug 13 18:33:25 2009
@@ -34,6 +34,7 @@
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collection;
+import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.logging.Logger;
@@ -509,7 +510,9 @@
createList(part));
Object o = ret;
if (!isList(part)) {
- if (clazz.getComponentType().isPrimitive()) {
+ if (isSet(part)) {
+ o = createSet(part, ret);
+ } else if (clazz.getComponentType().isPrimitive()) {
o = java.lang.reflect.Array.newInstance(clazz.getComponentType(), ret.size());
for (int x = 0; x < ret.size(); x++) {
Array.set(o, x, ret.get(x));
@@ -536,6 +539,39 @@
return o;
}
+ private static Object createSet(MessagePartInfo part, List<Object> ret) {
+ Type genericType = (Type)part.getProperty("generic.type");
+ Class tp2 = (Class)((ParameterizedType)genericType).getRawType();
+ if (tp2.isInterface()) {
+ return new HashSet<Object>(ret);
+ }
+ Collection<Object> c;
+ try {
+ c = CastUtils.cast((Collection<?>)tp2.newInstance());
+ } catch (Exception e) {
+ c = new HashSet<Object>();
+ }
+ c.addAll(ret);
+ return c;
+ }
+
+ private static boolean isSet(MessagePartInfo part) {
+ if (part.getTypeClass().isArray() && !part.getTypeClass().getComponentType().isPrimitive()) {
+ // && Collection.class.isAssignableFrom(part.getTypeClass())) {
+ // it's List Para
+ //
+ Type genericType = (Type)part.getProperty("generic.type");
+
+ if (genericType instanceof ParameterizedType) {
+ Type tp2 = ((ParameterizedType)genericType).getRawType();
+ if (tp2 instanceof Class) {
+ return Set.class.isAssignableFrom((Class<?>)tp2);
+ }
+ }
+ }
+ return false;
+ }
+
private static List<Object> createList(MessagePartInfo part) {
Type genericType = (Type)part.getProperty("generic.type");
return createList(genericType);
@@ -573,7 +609,7 @@
if (genericType instanceof ParameterizedType) {
Type tp2 = ((ParameterizedType)genericType).getRawType();
if (tp2 instanceof Class) {
- return Collection.class.isAssignableFrom((Class<?>)tp2);
+ return List.class.isAssignableFrom((Class<?>)tp2);
}
}
}
Modified: cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java?rev=803981&r1=803980&r2=803981&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java (original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java Thu Aug 13 18:33:25 2009
@@ -90,19 +90,22 @@
if (part != null && part.getProperty("honor.jaxb.annotations") != null) {
honorJaxbAnnotation = (Boolean)part.getProperty("honor.jaxb.annotations");
}
- Annotation[] anns = getJAXBAnnotation(part);
- if (honorJaxbAnnotation && anns.length > 0) {
- //RpcLit will use the JAXB Bridge to unmarshall part message when it is
- //annotated with @XmlList,@XmlAttachmentRef,@XmlJavaTypeAdapter
- //TODO:Cache the JAXBRIContext
- QName qname = new QName(null, part.getConcreteName().getLocalPart());
-
- return JAXBEncoderDecoder.unmarshalWithBridge(qname,
- part.getTypeClass(),
- anns,
- databinding.getContextClasses(),
- reader,
- getAttachmentUnmarshaller());
+ Annotation[] anns = null;
+ if (honorJaxbAnnotation) {
+ anns = getJAXBAnnotation(part);
+ if (anns.length > 0) {
+ //RpcLit will use the JAXB Bridge to unmarshall part message when it is
+ //annotated with @XmlList,@XmlAttachmentRef,@XmlJavaTypeAdapter
+ //TODO:Cache the JAXBRIContext
+ QName qname = new QName(null, part.getConcreteName().getLocalPart());
+
+ return JAXBEncoderDecoder.unmarshalWithBridge(qname,
+ part.getTypeClass(),
+ anns,
+ databinding.getContextClasses(),
+ reader,
+ getAttachmentUnmarshaller());
+ }
}
return JAXBEncoderDecoder.unmarshall(createUnmarshaller(), reader, part,
Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java?rev=803981&r1=803980&r2=803981&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java Thu Aug 13 18:33:25 2009
@@ -20,6 +20,7 @@
package org.apache.cxf.systest.jaxws;
import java.io.InputStream;
+import java.lang.reflect.Field;
import java.lang.reflect.UndeclaredThrowableException;
import java.net.HttpURLConnection;
import java.net.URL;
@@ -48,6 +49,7 @@
import org.apache.cxf.anonymous_complex_type.SplitName;
import org.apache.cxf.anonymous_complex_type.SplitNameResponse.Names;
import org.apache.cxf.binding.soap.Soap11;
+import org.apache.cxf.common.util.ASMHelper;
import org.apache.cxf.frontend.ClientProxyFactoryBean;
import org.apache.cxf.helpers.XMLUtils;
import org.apache.cxf.helpers.XPathUtils;
@@ -228,7 +230,7 @@
}
@Test
- public void testStringListOutDocLitNoWsdl() throws Exception {
+ public void testDocLitWrappedCodeFirstServiceNoWsdl() throws Exception {
QName portName = new QName("http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstService",
"DocLitWrappedCodeFirstServicePort");
QName servName = new QName("http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstService",
@@ -242,7 +244,7 @@
}
@Test
- public void testStringListOutDocLitWsdl() throws Exception {
+ public void testDocLitWrappedCodeFirstServiceWsdl() throws Exception {
QName portName = new QName("http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstService",
"DocLitWrappedCodeFirstServicePort");
QName servName = new QName("http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstService",
@@ -254,6 +256,52 @@
DocLitWrappedCodeFirstService.class);
runDocLitTest(port);
}
+
+ private void setASM(boolean b) throws Exception {
+ Field f = ASMHelper.class.getDeclaredField("oldASM");
+ f.setAccessible(true);
+ f.set(null, b);
+ }
+
+ @Test
+ public void testDocLitWrappedCodeFirstServiceNoWsdlNoASM() throws Exception {
+ try {
+ setASM(false);
+ QName portName = new QName("http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstService",
+ "DocLitWrappedCodeFirstServicePort");
+ QName servName = new QName("http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstService",
+ "DocLitWrappedCodeFirstService");
+
+ Service service = Service.create(servName);
+ service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, ServerMisc.DOCLIT_CODEFIRST_URL);
+ DocLitWrappedCodeFirstService port = service.getPort(portName,
+ DocLitWrappedCodeFirstService.class);
+ runDocLitTest(port);
+ } finally {
+ setASM(true);
+ }
+ }
+
+ @Test
+ public void testDocLitWrappedCodeFirstServiceWsdlNoASM() throws Exception {
+ try {
+ setASM(false);
+ QName portName = new QName("http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstService",
+ "DocLitWrappedCodeFirstServicePort");
+ QName servName = new QName("http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstService",
+ "DocLitWrappedCodeFirstService");
+
+ Service service = Service.create(new URL(ServerMisc.DOCLIT_CODEFIRST_URL + "?wsdl"),
+ servName);
+ DocLitWrappedCodeFirstService port = service.getPort(portName,
+ DocLitWrappedCodeFirstService.class);
+ runDocLitTest(port);
+ } finally {
+ setASM(true);
+ }
+ }
+
+
@Test
public void testSimpleClientWithWsdl() throws Exception {
@@ -275,17 +323,19 @@
assertEquals("Hello", echoMsg);
}
private void runDocLitTest(DocLitWrappedCodeFirstService port) throws Exception {
+
+ assertEquals("hello", port.outOnly(new Holder<String>(), new Holder<String>()));
+
long start = System.currentTimeMillis();
port.doOneWay();
assertTrue((System.currentTimeMillis() - start) < 500);
assertEquals("Hello", port.echoStringNotReallyAsync("Hello"));
-
+
Set<Foo> fooSet = port.getFooSet();
assertEquals(2, fooSet.size());
assertEquals("size: 2", port.doFooList(new ArrayList<Foo>(fooSet)));
-
assertEquals(24, port.echoIntDifferentWrapperName(24));
String echoMsg = port.echo("Hello");
@@ -363,8 +413,12 @@
int ints[] = port.echoIntArray(new int[] {1, 2 , 3}, null);
assertEquals(3, ints.length);
assertEquals(1, ints[0]);
-
- assertEquals("Val", port.createBar("Val").getName());
+
+ if (new ASMHelper().createClassWriter() != null) {
+ //doing the type adapter things and such really
+ //requires the ASM generated helper classes
+ assertEquals("Val", port.createBar("Val").getName());
+ }
testExceptionCases(port);
}
Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java?rev=803981&r1=803980&r2=803981&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java Thu Aug 13 18:33:25 2009
@@ -106,6 +106,9 @@
@WebMethod
List<Foo[]> listObjectArrayOutput();
+ String outOnly(@WebParam(mode = WebParam.Mode.OUT) Holder<String> out1,
+ @WebParam(mode = WebParam.Mode.OUT) Holder<String> out2);
+
@WebMethod
int throwException(int i)
throws ServiceTestFault, CustomException, ComplexException;
Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java?rev=803981&r1=803980&r2=803981&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java Thu Aug 13 18:33:25 2009
@@ -213,5 +213,11 @@
public String doFooList(List<Foo> fooList) {
return "size: " + fooList.size();
}
+
+ public String outOnly(Holder<String> out1, Holder<String> out2) {
+ out1.value = "out1";
+ out2.value = "out2";
+ return "hello";
+ }
}