Author: dkulp
Date: Thu Mar 27 13:56:39 2008
New Revision: 641978
URL: http://svn.apache.org/viewvc?rev=641978&view=rev
Log:
[CXF-1492] If there are TypeAdapters, don't walk the type
Modified:
incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
Modified:
incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java?rev=641978&r1=641977&r2=641978&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
(original)
+++
incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
Thu Mar 27 13:56:39 2008
@@ -34,6 +34,7 @@
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.apache.cxf.service.ServiceModelVisitor;
import org.apache.cxf.service.model.MessagePartInfo;
@@ -168,6 +169,9 @@
}
private void walkReferences(Class<?> cls) {
+ if (cls == null) {
+ return;
+ }
if (cls.getName().startsWith("java.")
|| cls.getName().startsWith("javax.")) {
return;
@@ -210,7 +214,7 @@
}
/**
- * Checks is the field is accepted as a JAXB property.
+ * Checks if the field is accepted as a JAXB property.
*/
static boolean isFieldAccepted(Field field, XmlAccessType accessType) {
// We only accept non static fields which are not marked @XmlTransient
@@ -221,7 +225,9 @@
&& !Modifier.isPublic(field.getModifiers())) {
return false;
}
-
+ if (field.getAnnotation(XmlJavaTypeAdapter.class) != null) {
+ return false;
+ }
if (accessType == XmlAccessType.NONE
|| accessType == XmlAccessType.PROPERTY) {
return checkJaxbAnnotation(field.getAnnotations());
@@ -231,7 +237,7 @@
}
/**
- * Checks is the method is accepted as a JAXB property getter.
+ * Checks if the method is accepted as a JAXB property getter.
*/
static boolean isMethodAccepted(Method method, XmlAccessType accessType) {
// We only accept non static property getters which are not marked
@XmlTransient
@@ -250,7 +256,8 @@
boolean isPropGetter = method.getName().startsWith("get") ||
method.getName().startsWith("is");
- if (!isPropGetter) {
+ if (!isPropGetter
+ || method.getAnnotation(XmlJavaTypeAdapter.class) != null) {
return false;
}
int beginIndex = 3;