Author: dkulp
Date: Tue Jun 2 02:46:03 2009
New Revision: 780911
URL: http://svn.apache.org/viewvc?rev=780911&view=rev
Log:
Fix problems with the ASM optimized wrapper helpers with newer versions
of HotSpot. Fix issue of not finding certain element names with
xjc:simple.
Modified:
cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/WrapperHelperCompiler.java
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java
Modified:
cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java?rev=780911&r1=780910&r2=780911&view=diff
==============================================================================
---
cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
(original)
+++
cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
Tue Jun 2 02:46:03 2009
@@ -816,6 +816,15 @@
}
}
}
+ if (getMethod == null && elField != null) {
+ getAccessor = JAXBUtils.nameToIdentifier(elField.getName(),
JAXBUtils.IdentifierType.GETTER);
+ setAccessor = JAXBUtils.nameToIdentifier(elField.getName(),
JAXBUtils.IdentifierType.SETTER);
+ try {
+ getMethod = valueClass.getMethod(getAccessor,
AbstractWrapperHelper.NO_CLASSES);
+ } catch (NoSuchMethodException ex) {
+ //ignore for now
+ }
+ }
String setAccessor2 = setAccessor;
if ("return".equals(partName)) {
//some versions of jaxb map "return" to "set_return" instead
of "setReturn"
@@ -911,7 +920,6 @@
jaxbMethods,
fields, objectFactory);
} catch (ClassNotFoundException e) {
// ASM not found, just use reflection based stuff
- e.printStackTrace();
}
return null;
}
Modified:
cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/WrapperHelperCompiler.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/WrapperHelperCompiler.java?rev=780911&r1=780910&r2=780911&view=diff
==============================================================================
---
cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/WrapperHelperCompiler.java
(original)
+++
cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/WrapperHelperCompiler.java
Tue Jun 2 02:46:03 2009
@@ -72,10 +72,11 @@
jaxbMethods,
fields,
objectFactory).compile();
+
} catch (Throwable t) {
// Some error - probably a bad version of ASM or similar
- return null;
}
+ return null;
}
@@ -115,14 +116,14 @@
Opcodes.ACC_PUBLIC | Opcodes.ACC_SUPER,
newClassName,
null,
- periodToSlashes(WrapperHelper.class.getName()),
- null);
+ "java/lang/Object",
+ new String[]
{periodToSlashes(WrapperHelper.class.getName())});
addConstructor(newClassName, cw, objectFactory == null ? null :
objectFactory.getClass());
boolean b = addSignature();
if (b) {
- addCreateWrapperObject(newClassName,
- objectFactory == null ? null :
objectFactory.getClass());
+ b = addCreateWrapperObject(newClassName,
+ objectFactory == null ? null :
objectFactory.getClass());
}
if (b) {
b = addGetWrapperParts(newClassName, wrapperType,
@@ -139,6 +140,7 @@
}
} catch (Throwable e) {
// ignore, we'll just fall down to reflection based
+ e.printStackTrace();
}
return null;
}
@@ -165,14 +167,11 @@
MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC,
"getSignature",
"()Ljava/lang/String;", null, null);
mv.visitCode();
+ mv.visitLdcInsn(sig);
Label l0 = new Label();
mv.visitLabel(l0);
mv.visitLineNumber(100, l0);
- mv.visitLdcInsn(sig);
mv.visitInsn(Opcodes.ARETURN);
- Label l1 = new Label();
- mv.visitLabel(l1);
- mv.visitLineNumber(101, l1);
mv.visitMaxs(0, 0);
mv.visitEnd();
return true;
@@ -196,7 +195,7 @@
mv.visitVarInsn(Opcodes.ALOAD, 0);
mv.visitMethodInsn(Opcodes.INVOKESPECIAL,
- periodToSlashes(WrapperHelper.class.getName()),
+ "java/lang/Object",
"<init>",
"()V");
if (objectFactory != null) {
@@ -294,7 +293,6 @@
Label lEnd = new Label();
mv.visitLabel(lEnd);
- mv.visitLineNumber(105, lEnd);
mv.visitLocalVariable("this", "L" + newClassName + ";", null, lBegin,
lEnd, 0);
mv.visitLocalVariable("lst", "Ljava/util/List;",
"Ljava/util/List<*>;", lBegin, lEnd, 1);
mv.visitLocalVariable("ok", "L" +
periodToSlashes(wrapperType.getName()) + ";",
@@ -447,7 +445,6 @@
Label lEnd = new Label();
mv.visitLabel(lEnd);
- mv.visitLineNumber(109, lEnd);
mv.visitLocalVariable("this", "L" + newClassName + ";", null, lBegin,
lEnd, 0);
mv.visitLocalVariable("o", "Ljava/lang/Object;", null, lBegin, lEnd,
1);
mv.visitLocalVariable("ret", "Ljava/util/List;",
"Ljava/util/List<Ljava/lang/Object;>;",
Modified:
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java?rev=780911&r1=780910&r2=780911&view=diff
==============================================================================
---
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
(original)
+++
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
Tue Jun 2 02:46:03 2009
@@ -283,6 +283,8 @@
Set<Foo> fooSet = port.getFooSet();
assertEquals(2, fooSet.size());
+ assertEquals("size: 2", port.doFooList(new ArrayList<Foo>(fooSet)));
+
assertEquals(24, port.echoIntDifferentWrapperName(24));
Modified:
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java?rev=780911&r1=780910&r2=780911&view=diff
==============================================================================
---
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java
(original)
+++
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java
Tue Jun 2 02:46:03 2009
@@ -18,6 +18,7 @@
*/
package org.apache.cxf.systest.jaxws;
+import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.Vector;
@@ -29,6 +30,10 @@
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
import javax.xml.ws.Holder;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;
@@ -136,5 +141,20 @@
}
Set<Foo> getFooSet();
+
+ @RequestWrapper(className =
"org.apache.cxf.systest.jaxws.DocLitWrappedCodeFirstService$DoFooListRequest")
+ @WebMethod(operationName = "doFooList")
+ String doFooList(@WebParam(name = "dbRef") List<Foo> fooList);
+
+
+ @XmlAccessorType(XmlAccessType.FIELD)
+ @XmlType(name = "doFooList", propOrder = { "dbReves" })
+ public static class DoFooListRequest {
+ @XmlElement(name = "dbRef", required = true)
+ protected List<Foo> dbReves = new ArrayList<Foo>();
+ public List<Foo> getDbReves() {
+ return dbReves;
+ }
+ }
}
Modified:
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java?rev=780911&r1=780910&r2=780911&view=diff
==============================================================================
---
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java
(original)
+++
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java
Tue Jun 2 02:46:03 2009
@@ -209,5 +209,9 @@
public String echoStringNotReallyAsync(String s) {
return s;
}
+
+ public String doFooList(List<Foo> fooList) {
+ return "size: " + fooList.size();
+ }
}