You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2017/02/14 09:49:12 UTC
[07/51] [partial] cxf git commit: Remove all trailing whitespaces
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
----------------------------------------------------------------------
diff --git a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
index 6abed2e..c2dde5e 100644
--- a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
+++ b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
@@ -184,8 +184,8 @@ public final class JAXBEncoderDecoder {
private JAXBEncoderDecoder() {
}
- public static void marshall(Marshaller marshaller,
- Object elValue,
+ public static void marshall(Marshaller marshaller,
+ Object elValue,
MessagePartInfo part,
Object source) {
try {
@@ -196,7 +196,7 @@ public final class JAXBEncoderDecoder {
} catch (javax.xml.bind.PropertyException e) {
// intentionally empty.
}
-
+
Class<?> cls = null;
if (part != null) {
cls = part.getTypeClass();
@@ -233,7 +233,7 @@ public final class JAXBEncoderDecoder {
} else if (part.getMessageInfo().getOperation().isUnwrapped()
&& (mObj.getClass().isArray() || mObj instanceof List)
&& el.getMaxOccurs() != 1) {
- writeArrayObject(marshaller,
+ writeArrayObject(marshaller,
source,
elName,
mObj);
@@ -247,8 +247,8 @@ public final class JAXBEncoderDecoder {
} else if (mObj instanceof JAXBElement) {
writeObject(marshaller, source, mObj);
} else if (marshaller.getSchema() != null) {
- //force xsi:type so types can be validated instead of trying to
- //use the RPC/lit element names that aren't in the schema
+ //force xsi:type so types can be validated instead of trying to
+ //use the RPC/lit element names that aren't in the schema
writeObject(marshaller, source, newJAXBElement(elName, Object.class, mObj));
} else {
writeObject(marshaller, source, newJAXBElement(elName, cls, mObj));
@@ -293,8 +293,8 @@ public final class JAXBEncoderDecoder {
if (source instanceof XMLStreamWriter) {
bridge.marshal(elValue, (XMLStreamWriter)source, am);
} else if (source instanceof OutputStream) {
- //the namespace is missing when marshal the xsd:QName type
- //to the OutputStream directly
+ //the namespace is missing when marshal the xsd:QName type
+ //to the OutputStream directly
java.io.StringWriter sw = new java.io.StringWriter();
StreamResult s1 = new StreamResult(sw);
bridge.marshal(elValue, s1);
@@ -316,7 +316,7 @@ public final class JAXBEncoderDecoder {
}
}
-
+
// TODO: cache the JAXBRIContext
public static Object unmarshalWithBridge(QName qname,
Class<?> cls,
@@ -324,13 +324,13 @@ public final class JAXBEncoderDecoder {
Set<Class<?>> ctxClasses,
Object source,
AttachmentUnmarshaller am) {
-
+
try {
JAXBUtils.BridgeWrapper bridge = JAXBUtils.createBridge(ctxClasses, qname, cls, anns);
-
+
if (source instanceof XMLStreamReader) {
//DOMUtils.writeXml(StaxUtils.read((XMLStreamReader)source), System.out);
- return bridge.unmarshal((XMLStreamReader)source, am);
+ return bridge.unmarshal((XMLStreamReader)source, am);
} else if (source instanceof InputStream) {
return bridge.unmarshal((InputStream)source);
} else if (source instanceof Node) {
@@ -349,7 +349,7 @@ public final class JAXBEncoderDecoder {
}
}
- }
+ }
public static void marshallException(Marshaller marshaller, Exception elValue,
MessagePartInfo part, Object source) {
@@ -361,7 +361,7 @@ public final class JAXBEncoderDecoder {
XmlAccessType accessType = Utils.getXmlAccessType(cls);
String namespace = part.getElementQName().getNamespaceURI();
String attNs = namespace;
-
+
SchemaInfo sch = part.getMessageInfo().getOperation().getInterface()
.getService().getSchema(namespace);
if (sch == null) {
@@ -388,7 +388,7 @@ public final class JAXBEncoderDecoder {
Object o = Utils.getFieldValue(f, elValue);
Document doc = DOMUtils.newDocument();
writeObject(marshaller, doc, newJAXBElement(fname, String.class, o));
-
+
if (attNs != null) {
writer.writeAttribute(attNs, fname.getLocalPart(),
DOMUtils.getAllContent(doc.getDocumentElement()));
@@ -407,7 +407,7 @@ public final class JAXBEncoderDecoder {
XmlAttribute at = m.getAnnotation(XmlAttribute.class);
QName mname = new QName(namespace, StringUtils.isEmpty(at.name()) ? name : at.name());
Document doc = DOMUtils.newDocument();
- Object o = Utils.getMethodValue(m, elValue);
+ Object o = Utils.getMethodValue(m, elValue);
writeObject(marshaller, doc, newJAXBElement(mname, String.class, o));
if (attNs != null) {
writer.writeAttribute(attNs, mname.getLocalPart(),
@@ -435,7 +435,7 @@ public final class JAXBEncoderDecoder {
if (JAXBSchemaInitializer.isArray(f.getGenericType())) {
writeArrayObject(marshaller, writer, fname, f.get(elValue));
} else {
- Object o = Utils.getFieldValue(f, elValue);
+ Object o = Utils.getFieldValue(f, elValue);
writeObject(marshaller, writer, newJAXBElement(fname, String.class, o));
}
} else { // it's a Method
@@ -447,7 +447,7 @@ public final class JAXBEncoderDecoder {
if (JAXBSchemaInitializer.isArray(m.getGenericReturnType())) {
writeArrayObject(marshaller, writer, mname, m.invoke(elValue));
} else {
- Object o = Utils.getMethodValue(m, elValue);
+ Object o = Utils.getMethodValue(m, elValue);
writeObject(marshaller, writer, newJAXBElement(mname, String.class, o));
}
}
@@ -461,8 +461,8 @@ public final class JAXBEncoderDecoder {
StaxUtils.close(writer);
}
}
-
- private static void writeArrayObject(Marshaller marshaller,
+
+ private static void writeArrayObject(Marshaller marshaller,
Object source,
QName mname,
Object mObj) throws Fault, JAXBException {
@@ -484,12 +484,12 @@ public final class JAXBEncoderDecoder {
int len = Array.getLength(objArray);
for (int x = 0; x < len; x++) {
Object o = Array.get(objArray, x);
- writeObject(marshaller, source,
+ writeObject(marshaller, source,
newJAXBElement(mname, cls == null ? o.getClass() : cls, o));
- }
+ }
}
- public static Exception unmarshallException(Unmarshaller u,
+ public static Exception unmarshallException(Unmarshaller u,
Object source,
MessagePartInfo part) {
XMLStreamReader reader;
@@ -594,7 +594,7 @@ public final class JAXBEncoderDecoder {
ReflectionUtil.setAccessible(fn);
fn.set(obj, o);
}
- }
+ }
}
if (reader.getEventType() == XMLStreamReader.END_ELEMENT && q.equals(reader.getName())) {
reader.next();
@@ -622,7 +622,7 @@ public final class JAXBEncoderDecoder {
if (source instanceof MarshallerAwareXMLWriter) {
((MarshallerAwareXMLWriter) source).setMarshaller(u);
}
-
+
u.marshal(mObj, (XMLEventWriter)source);
} else {
throw new Fault(new Message("UNKNOWN_SOURCE", LOG, source.getClass().getName()));
@@ -653,8 +653,8 @@ public final class JAXBEncoderDecoder {
}
- public static Object unmarshall(Unmarshaller u,
- Object source,
+ public static Object unmarshall(Unmarshaller u,
+ Object source,
MessagePartInfo part,
boolean unwrap) {
Class<?> clazz = part != null ? (Class<?>)part.getTypeClass() : null;
@@ -669,7 +669,7 @@ public final class JAXBEncoderDecoder {
XmlSchemaElement el = (XmlSchemaElement)part.getXmlSchema();
if (el.getSchemaType() instanceof XmlSchemaSimpleType
- && ((XmlSchemaSimpleType)el.getSchemaType()).getContent()
+ && ((XmlSchemaSimpleType)el.getSchemaType()).getContent()
instanceof XmlSchemaSimpleTypeList) {
Object obj = unmarshall(u, source, elName, null, unwrap);
@@ -719,7 +719,7 @@ public final class JAXBEncoderDecoder {
}
private static Object updateSourceWithXSIType(Object source, final QName typeQName) {
- if (source instanceof XMLStreamReader
+ if (source instanceof XMLStreamReader
&& typeQName != null) {
XMLStreamReader reader = (XMLStreamReader)source;
String type = reader.getAttributeValue(Constants.URI_2001_SCHEMA_XSI, "type");
@@ -742,7 +742,7 @@ public final class JAXBEncoderDecoder {
} catch (Exception e) {
c = new HashSet<>();
}
-
+
c.addAll(ret);
return c;
}
@@ -766,7 +766,7 @@ public final class JAXBEncoderDecoder {
private static List<Object> createList(MessagePartInfo part) {
Type genericType = (Type)part.getProperty("generic.type");
- return createList(genericType);
+ return createList(genericType);
}
private static List<Object> createList(Type genericType) {
if (genericType instanceof ParameterizedType) {
@@ -810,28 +810,28 @@ public final class JAXBEncoderDecoder {
final QName elName,
final Class<?> clazz,
final boolean unwrap) throws Exception {
-
+
Object obj = null;
boolean unmarshalWithClass = true;
if (clazz == null
- || (!clazz.isPrimitive()
- && !clazz.isArray()
- && !clazz.isEnum()
+ || (!clazz.isPrimitive()
+ && !clazz.isArray()
+ && !clazz.isEnum()
&& !clazz.equals(Calendar.class)
- && (Modifier.isAbstract(clazz.getModifiers())
+ && (Modifier.isAbstract(clazz.getModifiers())
|| Modifier.isInterface(clazz.getModifiers())))) {
unmarshalWithClass = false;
}
if (clazz != null
- && (clazz.getName().equals("javax.xml.datatype.XMLGregorianCalendar")
+ && (clazz.getName().equals("javax.xml.datatype.XMLGregorianCalendar")
|| clazz.getName().equals("javax.xml.datatype.Duration"))) {
// special treat two jaxb defined built-in abstract types
unmarshalWithClass = true;
}
if (source instanceof Node) {
- obj = unmarshalWithClass ? u.unmarshal((Node)source, clazz)
+ obj = unmarshalWithClass ? u.unmarshal((Node)source, clazz)
: u.unmarshal((Node)source);
} else if (source instanceof DepthXMLStreamReader) {
// JAXB optimizes a ton of stuff depending on the StreamReader impl. Thus,
@@ -839,15 +839,15 @@ public final class JAXBEncoderDecoder {
// as it doesn't read beyond the end so the DepthXMLStreamReader state
// would be OK when it returns. The main winner is FastInfoset where parsing
// a testcase I have goes from about 300/sec to well over 1000.
-
+
DepthXMLStreamReader dr = (DepthXMLStreamReader)source;
XMLStreamReader reader = dr.getReader();
-
+
// allows the XML Stream Reader to adjust it's behaviour based on the state of the unmarshaller
if (reader instanceof UnmarshallerAwareXMLReader) {
((UnmarshallerAwareXMLReader) reader).setUnmarshaller(u);
}
-
+
if (u.getSchema() != null) {
//validating, but we may need more namespaces
reader = findExtraNamespaces(reader);
@@ -856,12 +856,12 @@ public final class JAXBEncoderDecoder {
.unmarshal(dr.getReader());
} else if (source instanceof XMLStreamReader) {
XMLStreamReader reader = (XMLStreamReader)source;
-
+
// allows the XML Stream Reader to adjust it's behaviour based on the state of the unmarshaller
if (reader instanceof UnmarshallerAwareXMLReader) {
((UnmarshallerAwareXMLReader) reader).setUnmarshaller(u);
}
-
+
if (u.getSchema() != null) {
//validating, but we may need more namespaces
reader = findExtraNamespaces(reader);
@@ -873,7 +873,7 @@ public final class JAXBEncoderDecoder {
if (source instanceof UnmarshallerAwareXMLReader) {
((UnmarshallerAwareXMLReader) source).setUnmarshaller(u);
}
-
+
obj = unmarshalWithClass ? u.unmarshal((XMLEventReader)source, clazz) : u
.unmarshal((XMLEventReader)source);
} else if (source == null) {
@@ -902,34 +902,34 @@ public final class JAXBEncoderDecoder {
if (ex instanceof javax.xml.bind.UnmarshalException) {
javax.xml.bind.UnmarshalException unmarshalEx = (javax.xml.bind.UnmarshalException)ex;
if (unmarshalEx.getLinkedException() != null) {
- throw new Fault(new Message("UNMARSHAL_ERROR", LOG,
+ throw new Fault(new Message("UNMARSHAL_ERROR", LOG,
unmarshalEx.getLinkedException().getMessage()), ex);
} else {
- throw new Fault(new Message("UNMARSHAL_ERROR", LOG,
- unmarshalEx.getMessage()), ex);
+ throw new Fault(new Message("UNMARSHAL_ERROR", LOG,
+ unmarshalEx.getMessage()), ex);
}
}
throw new Fault(new Message("UNMARSHAL_ERROR", LOG, ex.getMessage()), ex);
- }
+ }
}
-
+
private static XMLStreamReader findExtraNamespaces(XMLStreamReader source) {
//due to a deficiency in the Stax API, there isn't a way to get all
//the namespace prefixes that are "valid" at this point. Thus, JAXB
//cannot set all the prefixes into the validator (which also doesn't allow
- //setting a NSContext, just allows declaring of prefixes) so resolving
- //prefixes and such will fail if they were declared on any of the parent
+ //setting a NSContext, just allows declaring of prefixes) so resolving
+ //prefixes and such will fail if they were declared on any of the parent
//elements.
//
//We'll use some reflection to grab the known namespaces from woodstox
//or the xerces parser and fake extra namespace decls on the root elements.
//slight performance penalty, but there already is a penalty if you are validating
//anyway.
-
+
NamespaceContext c = source.getNamespaceContext();
final Map<String, String> nsMap = new TreeMap<String, String>();
try {
- if (c instanceof W3CNamespaceContext) {
+ if (c instanceof W3CNamespaceContext) {
Element element = ((W3CNamespaceContext)c).getElement();
while (element != null) {
NamedNodeMap namedNodeMap = element.getAttributes();
@@ -944,7 +944,7 @@ public final class JAXBEncoderDecoder {
} else {
try {
//Woodstox version
- c = (NamespaceContext)c.getClass().getMethod("createNonTransientNsContext",
+ c = (NamespaceContext)c.getClass().getMethod("createNonTransientNsContext",
Location.class)
.invoke(c, new Object[1]);
} catch (Throwable t) {
@@ -983,7 +983,7 @@ public final class JAXBEncoderDecoder {
if (!nsMap.isEmpty()) {
for (int x = 0; x < source.getNamespaceCount(); x++) {
String pfx = source.getNamespacePrefix(x);
- if (pfx == null) {
+ if (pfx == null) {
nsMap.remove("");
} else {
nsMap.remove(pfx);
@@ -991,14 +991,14 @@ public final class JAXBEncoderDecoder {
}
if (!nsMap.isEmpty()) {
@SuppressWarnings("unchecked")
- final Map.Entry<String, String> namespaces[]
+ final Map.Entry<String, String> namespaces[]
= nsMap.entrySet().toArray(new Map.Entry[nsMap.size()]);
//OK. we have extra namespaces. We'll need to wrapper the reader
//with a new one that will fake extra namespace events
source = new DepthXMLStreamReader(source) {
public int getNamespaceCount() {
if (getDepth() == 0 && isStartElement()) {
- return super.getNamespaceCount() + nsMap.size();
+ return super.getNamespaceCount() + nsMap.size();
}
return super.getNamespaceCount();
}
@@ -1024,11 +1024,11 @@ public final class JAXBEncoderDecoder {
}
return super.getNamespaceURI(arg0);
}
-
+
};
}
}
-
+
return source;
}
@@ -1077,7 +1077,7 @@ public final class JAXBEncoderDecoder {
if (type != null) {
ret.add(type.getValue());
}
- while (reader.getEventType() != XMLStreamConstants.START_ELEMENT
+ while (reader.getEventType() != XMLStreamConstants.START_ELEMENT
&& reader.getEventType() != XMLStreamConstants.END_ELEMENT) {
reader.nextTag();
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
----------------------------------------------------------------------
diff --git a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
index 8268c33..380942e 100644
--- a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
+++ b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
@@ -279,7 +279,7 @@ class JAXBSchemaInitializer extends ServiceModelVisitor {
}
static JAXBBeanInfo findFromTypeAdapter(JAXBContextProxy context,
- @SuppressWarnings("rawtypes")
+ @SuppressWarnings("rawtypes")
Class<? extends XmlAdapter> aclass) {
Class<?> c2 = aclass;
Type sp = c2.getGenericSuperclass();
@@ -469,8 +469,8 @@ class JAXBSchemaInitializer extends ServiceModelVisitor {
}
}
}
-
-
+
+
private void buildExceptionType(MessagePartInfo part, Class<?> cls) {
SchemaInfo schemaInfo = null;
for (SchemaInfo s : serviceInfo.getSchemas()) {
@@ -484,22 +484,22 @@ class JAXBSchemaInitializer extends ServiceModelVisitor {
String[] propertyOrder = null;
boolean respectXmlTypeNS = false;
XmlSchema faultBeanSchema = null;
- if (xmlTypeAnno != null && !StringUtils.isEmpty(xmlTypeAnno.namespace())
+ if (xmlTypeAnno != null && !StringUtils.isEmpty(xmlTypeAnno.namespace())
&& !xmlTypeAnno.namespace().equals(part.getElementQName().getNamespaceURI())) {
respectXmlTypeNS = true;
NamespaceMap nsMap = new NamespaceMap();
nsMap.add(WSDLConstants.CONVENTIONAL_TNS_PREFIX, xmlTypeAnno.namespace());
nsMap.add(WSDLConstants.NP_SCHEMA_XSD, WSDLConstants.NS_SCHEMA_XSD);
-
+
SchemaInfo faultBeanSchemaInfo = createSchemaIfNeeded(xmlTypeAnno.namespace(), nsMap);
- faultBeanSchema = faultBeanSchemaInfo.getSchema();
+ faultBeanSchema = faultBeanSchemaInfo.getSchema();
}
-
+
if (xmlTypeAnno != null && xmlTypeAnno.propOrder().length > 0) {
propertyOrder = xmlTypeAnno.propOrder();
//TODO: handle @XmlAccessOrder
}
-
+
XmlSchema schema = null;
if (schemaInfo == null) {
NamespaceMap nsMap = new NamespaceMap();
@@ -507,14 +507,14 @@ class JAXBSchemaInitializer extends ServiceModelVisitor {
nsMap.add(WSDLConstants.NP_SCHEMA_XSD, WSDLConstants.NS_SCHEMA_XSD);
schemaInfo = createSchemaIfNeeded(part.getElementQName().getNamespaceURI(), nsMap);
- }
+ }
schema = schemaInfo.getSchema();
-
+
// Before updating everything, make sure we haven't added this
// type yet. Multiple methods that throw the same exception
// types will cause duplicates.
- String faultTypeName = xmlTypeAnno != null && !StringUtils.isEmpty(xmlTypeAnno.name())
+ String faultTypeName = xmlTypeAnno != null && !StringUtils.isEmpty(xmlTypeAnno.name())
? xmlTypeAnno.name() : part.getElementQName().getLocalPart();
XmlSchemaType existingType = schema.getTypeByName(faultTypeName);
if (existingType != null) {
@@ -525,11 +525,11 @@ class JAXBSchemaInitializer extends ServiceModelVisitor {
el.setName(part.getElementQName().getLocalPart());
part.setXmlSchema(el);
schemaInfo.setElement(null);
-
+
if (respectXmlTypeNS) {
schema = faultBeanSchema; //create complexType in the new created schema for xmlType
}
-
+
XmlSchemaComplexType ct = new XmlSchemaComplexType(schema, true);
ct.setName(faultTypeName);
@@ -568,7 +568,7 @@ class JAXBSchemaInitializer extends ServiceModelVisitor {
if ((type == null) && (m.getGenericReturnType() instanceof ParameterizedType)) {
type = m.getGenericReturnType();
}
-
+
if (generateGenericType(type)) {
buildGenericElements(schema, seq, m, type);
} else {
@@ -586,22 +586,22 @@ class JAXBSchemaInitializer extends ServiceModelVisitor {
if (Exception.class.isAssignableFrom(cls)) {
addExceptionMessage(cls, schema, seq);
}
-
+
if (propertyOrder != null) {
if (propertyOrder.length == seq.getItems().size()) {
sortItems(seq, propertyOrder);
- } else if (propertyOrder.length > 1
+ } else if (propertyOrder.length > 1
|| (propertyOrder.length == 1 && !propertyOrder[0].isEmpty())) {
- LOG.log(Level.WARNING, "propOrder in @XmlType doesn't define all schema elements :"
+ LOG.log(Level.WARNING, "propOrder in @XmlType doesn't define all schema elements :"
+ Arrays.toString(propertyOrder));
}
}
-
+
if (xmlAccessorOrder != null && xmlAccessorOrder.value().equals(XmlAccessOrder.ALPHABETICAL)
&& propertyOrder == null) {
sort(seq);
}
-
+
schemas.addCrossImports();
part.setProperty(JAXBDataBinding.class.getName() + ".CUSTOM_EXCEPTION", Boolean.TRUE);
}
@@ -622,7 +622,7 @@ class JAXBSchemaInitializer extends ServiceModelVisitor {
//ignore, just won't have the message element
}
}
-
+
private boolean generateGenericType(Type type) {
if (type instanceof ParameterizedType) {
ParameterizedType paramType = (ParameterizedType)type;
@@ -633,7 +633,7 @@ class JAXBSchemaInitializer extends ServiceModelVisitor {
}
return false;
}
-
+
private void buildGenericElements(XmlSchema schema, XmlSchemaSequence seq, Field f) {
XmlSchemaComplexType generics = new XmlSchemaComplexType(schema, true);
Type type = f.getGenericType();
@@ -642,7 +642,7 @@ class JAXBSchemaInitializer extends ServiceModelVisitor {
generics.setName(typeName);
Class<?> genericsClass = f.getType();
- buildGenericSeq(schema, generics, genericsClass);
+ buildGenericSeq(schema, generics, genericsClass);
String name = Character.toLowerCase(f.getName().charAt(0)) + f.getName().substring(1);
XmlSchemaElement newel = new XmlSchemaElement(schema, false);
@@ -653,20 +653,20 @@ class JAXBSchemaInitializer extends ServiceModelVisitor {
seq.getItems().add(newel);
}
}
-
- private void buildGenericElements(XmlSchema schema, XmlSchemaSequence seq, Method m, Type type) {
+
+ private void buildGenericElements(XmlSchema schema, XmlSchemaSequence seq, Method m, Type type) {
String rawType = ((ParameterizedType)type).getRawType().toString();
String typeName = StringUtils.uncapitalize(rawType.substring(rawType.lastIndexOf(".") + 1));
-
- XmlSchemaComplexType generics = (XmlSchemaComplexType)schema.getTypeByName(typeName);
+
+ XmlSchemaComplexType generics = (XmlSchemaComplexType)schema.getTypeByName(typeName);
if (generics == null) {
generics = new XmlSchemaComplexType(schema, true);
generics.setName(typeName);
}
-
+
Class<?> genericsClass = m.getReturnType();
- buildGenericSeq(schema, generics, genericsClass);
-
+ buildGenericSeq(schema, generics, genericsClass);
+
int idx = m.getName().startsWith("get") ? 3 : 2;
String name = m.getName().substring(idx);
name = Character.toLowerCase(name.charAt(0)) + name.substring(1);
@@ -678,19 +678,19 @@ class JAXBSchemaInitializer extends ServiceModelVisitor {
seq.getItems().add(newel);
}
}
-
+
private void buildGenericSeq(XmlSchema schema, XmlSchemaComplexType generics, Class<?> genericsClass) {
XmlSchemaSequence genericsSeq = new XmlSchemaSequence();
generics.setParticle(genericsSeq);
XmlAccessType accessType = Utils.getXmlAccessType(genericsClass);
-
+
for (Field f : Utils.getFields(genericsClass, accessType)) {
- if (f.getGenericType() instanceof TypeVariable) {
+ if (f.getGenericType() instanceof TypeVariable) {
String genericName = Character.toLowerCase(f.getName().charAt(0)) + f.getName().substring(1);
XmlSchemaElement genericEle = new XmlSchemaElement(schema, false);
genericEle.setName(genericName);
genericEle.setMinOccurs(0);
- JAXBBeanInfo anyBean = getBeanInfo(context, f.getType());
+ JAXBBeanInfo anyBean = getBeanInfo(context, f.getType());
Iterator<QName> itr = anyBean.getTypeNames().iterator();
if (!itr.hasNext()) {
return;
@@ -700,7 +700,7 @@ class JAXBSchemaInitializer extends ServiceModelVisitor {
genericsSeq.getItems().add(genericEle);
}
}
-
+
for (Method genericMethod : Utils.getGetters(genericsClass, accessType)) {
if (genericMethod.getGenericReturnType() instanceof TypeVariable) {
int idx = genericMethod.getName().startsWith("get") ? 3 : 2;
@@ -709,7 +709,7 @@ class JAXBSchemaInitializer extends ServiceModelVisitor {
XmlSchemaElement genericEle = new XmlSchemaElement(schema, false);
genericEle.setName(genericName);
genericEle.setMinOccurs(0);
- JAXBBeanInfo anyBean = getBeanInfo(context, genericMethod.getReturnType());
+ JAXBBeanInfo anyBean = getBeanInfo(context, genericMethod.getReturnType());
Iterator<QName> itr = anyBean.getTypeNames().iterator();
if (!itr.hasNext()) {
return;
@@ -718,11 +718,11 @@ class JAXBSchemaInitializer extends ServiceModelVisitor {
genericEle.setSchemaTypeName(typeName);
genericsSeq.getItems().add(genericEle);
}
-
- }
+
+ }
}
-
-
+
+
static boolean isArray(Type cls) {
if (cls instanceof Class) {
return ((Class<?>)cls).isArray();
@@ -777,7 +777,7 @@ class JAXBSchemaInitializer extends ServiceModelVisitor {
seq.getItems().add(el);
}
-
+
private SchemaInfo createSchemaIfNeeded(String namespace, NamespaceMap nsMap) {
SchemaInfo schemaInfo = serviceInfo.getSchema(namespace);
if (schemaInfo == null) {
@@ -799,7 +799,7 @@ class JAXBSchemaInitializer extends ServiceModelVisitor {
private boolean isExistSchemaElement(XmlSchema schema, QName qn) {
return schema.getElementByName(qn) != null;
}
-
+
private void sortItems(final XmlSchemaSequence seq, final String[] propertyOrder) {
final List<String> propList = Arrays.asList(propertyOrder);
Collections.sort(seq.getItems(), new Comparator<XmlSchemaSequenceMember>() {
@@ -810,7 +810,7 @@ class JAXBSchemaInitializer extends ServiceModelVisitor {
int index2 = propList.indexOf(element2.getName());
return index1 - index2;
}
-
+
});
}
//sort to Alphabetical order
@@ -821,8 +821,8 @@ class JAXBSchemaInitializer extends ServiceModelVisitor {
XmlSchemaElement element2 = (XmlSchemaElement)o2;
return element1.getName().compareTo(element2.getName());
}
-
+
});
}
-
+
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBWrapperHelper.java
----------------------------------------------------------------------
diff --git a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBWrapperHelper.java b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBWrapperHelper.java
index 8f252c3..7546355 100644
--- a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBWrapperHelper.java
+++ b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBWrapperHelper.java
@@ -28,40 +28,40 @@ import javax.xml.bind.JAXBElement;
import org.apache.cxf.databinding.AbstractWrapperHelper;
/**
- *
+ *
*/
public class JAXBWrapperHelper extends AbstractWrapperHelper {
- protected final Method jaxbObjectMethods[];
+ protected final Method jaxbObjectMethods[];
protected final Object objectFactory;
protected JAXBWrapperHelper(Class<?> wt, Method[] sets, Method[] gets,
Method jaxbs[], Field[] f, Object of) {
super(wt, sets, gets, f);
jaxbObjectMethods = jaxbs;
- objectFactory = of;
+ objectFactory = of;
}
@Override
- protected Object createWrapperObject(Class<?> typeClass) throws Exception {
+ protected Object createWrapperObject(Class<?> typeClass) throws Exception {
return typeClass.newInstance();
}
-
+
@Override
protected Object getWrapperObject(Object object) {
return object;
}
-
+
@Override
protected Object getValue(Method method, Object in) throws IllegalAccessException,
InvocationTargetException {
if ("javax.xml.bind.JAXBElement".equals(method.getReturnType().getCanonicalName())) {
JAXBElement<?> je = (JAXBElement<?>)method.invoke(in);
return je == null ? je : je.getValue();
- } else {
- return method.invoke(in);
+ } else {
+ return method.invoke(in);
}
}
-
+
@Override
protected Object getPartObject(int index, Object object) throws Exception {
Object result = object;
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Utils.java
----------------------------------------------------------------------
diff --git a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Utils.java b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Utils.java
index 2af2605..b2d24fa 100644
--- a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Utils.java
+++ b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Utils.java
@@ -42,7 +42,7 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters;
final class Utils {
private Utils() {
}
-
+
static XmlAccessType getXmlAccessType(Class<?> cls) {
XmlAccessorType accessorType = cls.getAnnotation(XmlAccessorType.class);
if (accessorType == null && cls.getPackage() != null) {
@@ -75,7 +75,7 @@ final class Utils {
private static Collection<Method> getMethods(Class<?> cls, XmlAccessType accessType, boolean acceptSetters) {
return getMethodsInternal(cls, accessType, acceptSetters);
}
-
+
private static Collection<Method> getMethodsInternal(Class<?> cls, XmlAccessType accessType,
boolean acceptSetters) {
Set<Method> methods = new HashSet<>();
@@ -92,7 +92,7 @@ final class Utils {
}
return methods;
}
-
+
static Method getMethod(Class<?> cls, XmlAccessType accessType, String methodName,
Class<?>... paramTypes) {
for (Method m : getMethods(cls, accessType, true)) {
@@ -102,7 +102,7 @@ final class Utils {
}
return null;
}
-
+
static Field getField(Class<?> cls, XmlAccessType accessType, String fieldName) {
for (final Field f : getFields(cls, accessType)) {
if (f.getName().equals(fieldName)) {
@@ -111,7 +111,7 @@ final class Utils {
}
return null;
}
-
+
static Collection<Method> getGetters(Class<?> cls, XmlAccessType accessType) {
return getMethods(cls, accessType, false);
}
@@ -126,7 +126,7 @@ final class Utils {
return false;
}
// Allow only public methods if PUBLIC_MEMBER access is requested
- if (accessType == XmlAccessType.PUBLIC_MEMBER && !Modifier.isPublic(method.getModifiers())) {
+ if (accessType == XmlAccessType.PUBLIC_MEMBER && !Modifier.isPublic(method.getModifiers())) {
return false;
}
if (isGetter(method)) {
@@ -146,7 +146,7 @@ final class Utils {
// method accepted
return true;
}
-
+
private static boolean isGetter(Method m) {
if (m.getReturnType() != Void.class && m.getReturnType() != Void.TYPE && m.getParameterTypes().length == 0) {
Method setter = getSetter(m);
@@ -169,10 +169,10 @@ final class Utils {
}
return null;
}
-
+
private static boolean isSetter(Method m) {
Class<?> declaringClass = m.getDeclaringClass();
- boolean isVoidReturnType = m.getReturnType() == Void.class || m.getReturnType() == Void.TYPE;
+ boolean isVoidReturnType = m.getReturnType() == Void.class || m.getReturnType() == Void.TYPE;
if (isVoidReturnType && m.getParameterTypes().length == 1 && m.getName().startsWith("set")) {
String getterName = "get" + m.getName().substring(3);
Class<?> setterParamType = m.getParameterTypes()[0];
@@ -218,7 +218,7 @@ final class Utils {
// if there is no adapter, yet we have a collection make sure
// we return the Generic type; if there is an annotation let the
// adapter handle what gets populated
- if (adapter == null && m.getGenericReturnType() instanceof ParameterizedType
+ if (adapter == null && m.getGenericReturnType() instanceof ParameterizedType
&& ((ParameterizedType)m.getGenericReturnType()).getActualTypeArguments().length < 2) {
return null;
}
@@ -230,14 +230,14 @@ final class Utils {
static Object getFieldValue(Field f, Object target) throws Exception {
XmlJavaTypeAdapter adapterAnnotation = getFieldXJTA(f);
XmlAdapter adapter = getXmlAdapter(adapterAnnotation);
- return adapter != null ? adapter.marshal(f.get(target)) : f.get(target);
+ return adapter != null ? adapter.marshal(f.get(target)) : f.get(target);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
static Object getMethodValue(Method m, Object target) throws Exception {
XmlJavaTypeAdapter adapterAnnotation = getMethodXJTA(m);
XmlAdapter adapter = getXmlAdapter(adapterAnnotation);
- return adapter != null ? adapter.marshal(m.invoke(target)) : m.invoke(target);
+ return adapter != null ? adapter.marshal(m.invoke(target)) : m.invoke(target);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@@ -254,7 +254,7 @@ final class Utils {
setter.invoke(target, adapter != null ? adapter.unmarshal(value) : value);
}
- @SuppressWarnings("rawtypes")
+ @SuppressWarnings("rawtypes")
static XmlAdapter getXmlAdapter(XmlJavaTypeAdapter adapterAnnotation)
throws InstantiationException, IllegalAccessException {
return adapterAnnotation != null ? adapterAnnotation.value().newInstance() : null;
@@ -303,7 +303,7 @@ final class Utils {
}
return adapter;
}
-
+
static Type getTypeFromXmlAdapter(XmlJavaTypeAdapter xjta) {
if (xjta != null) {
Class<?> c2 = xjta.value();
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/WrapperHelperCompiler.java
----------------------------------------------------------------------
diff --git a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/WrapperHelperCompiler.java b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/WrapperHelperCompiler.java
index c401ee0..70613a2 100644
--- a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/WrapperHelperCompiler.java
+++ b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/WrapperHelperCompiler.java
@@ -28,8 +28,8 @@ import org.apache.cxf.common.util.ASMHelper;
import org.apache.cxf.databinding.WrapperHelper;
final class WrapperHelperCompiler extends ASMHelper {
-
-
+
+
final Class<?> wrapperType;
final Method setMethods[];
final Method getMethods[];
@@ -66,17 +66,17 @@ final class WrapperHelperCompiler extends ASMHelper {
jaxbMethods,
fields,
objectFactory).compile();
-
+
} catch (Throwable t) {
// Some error - probably a bad version of ASM or similar
}
return null;
}
-
-
-
-
+
+
+
+
public WrapperHelper compile() {
if (cw == null) {
return null;
@@ -103,16 +103,16 @@ final class WrapperHelperCompiler extends ASMHelper {
return null;
}
}
-
-
-
+
+
+
cw.visit(Opcodes.V1_5,
Opcodes.ACC_PUBLIC | Opcodes.ACC_SUPER,
newClassName,
null,
"java/lang/Object",
new String[] {periodToSlashes(WrapperHelper.class.getName())});
-
+
addConstructor(newClassName, objectFactory == null ? null : objectFactory.getClass());
boolean b = addSignature();
if (b) {
@@ -122,11 +122,11 @@ final class WrapperHelperCompiler extends ASMHelper {
if (b) {
b = addGetWrapperParts(newClassName, wrapperType);
}
-
+
try {
if (b) {
cw.visitEnd();
- byte bt[] = cw.toByteArray();
+ byte bt[] = cw.toByteArray();
Class<?> cl = loadClass(newClassName.replace('/', '.'), wrapperType, bt);
Object o = cl.newInstance();
return WrapperHelper.class.cast(o);
@@ -136,7 +136,7 @@ final class WrapperHelperCompiler extends ASMHelper {
}
return null;
}
-
+
private String computeSignature() {
StringBuilder b = new StringBuilder();
b.append(setMethods.length).append(':');
@@ -145,12 +145,12 @@ final class WrapperHelperCompiler extends ASMHelper {
b.append("null,");
} else {
b.append(getMethods[x].getName()).append('/');
- b.append(getMethods[x].getReturnType().getName()).append(',');
+ b.append(getMethods[x].getReturnType().getName()).append(',');
}
}
return b.toString();
}
-
+
private boolean addSignature() {
String sig = computeSignature();
MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC,
@@ -166,9 +166,9 @@ final class WrapperHelperCompiler extends ASMHelper {
return true;
}
- private void addConstructor(String newClassName,
+ private void addConstructor(String newClassName,
Class<?> objectFactoryCls) {
-
+
if (objectFactoryCls != null) {
String ofName = "L" + periodToSlashes(objectFactoryCls.getName()) + ";";
FieldVisitor fv = cw.visitField(0, "factory",
@@ -176,13 +176,13 @@ final class WrapperHelperCompiler extends ASMHelper {
null, null);
fv.visitEnd();
}
-
+
MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "<init>", "()V", null, null);
mv.visitCode();
Label l0 = createLabel();
mv.visitLabel(l0);
mv.visitLineNumber(102, l0);
-
+
mv.visitVarInsn(Opcodes.ALOAD, 0);
mv.visitMethodInsn(Opcodes.INVOKESPECIAL,
"java/lang/Object",
@@ -197,10 +197,10 @@ final class WrapperHelperCompiler extends ASMHelper {
"<init>", "()V", false);
mv.visitFieldInsn(Opcodes.PUTFIELD, periodToSlashes(newClassName),
"factory", "L" + periodToSlashes(objectFactoryCls.getName()) + ";");
- }
-
+ }
+
mv.visitInsn(Opcodes.RETURN);
-
+
Label l1 = createLabel();
mv.visitLabel(l1);
mv.visitLineNumber(103, l0);
@@ -209,10 +209,10 @@ final class WrapperHelperCompiler extends ASMHelper {
mv.visitMaxs(0, 0);
mv.visitEnd();
}
-
+
private boolean addCreateWrapperObject(String newClassName,
Class<?> objectFactoryClass) {
-
+
MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC,
"createWrapperObject",
"(Ljava/util/List;)Ljava/lang/Object;",
@@ -230,9 +230,9 @@ final class WrapperHelperCompiler extends ASMHelper {
mv.visitMethodInsn(Opcodes.INVOKESPECIAL, periodToSlashes(wrapperType.getName()),
"<init>", "()V", false);
mv.visitVarInsn(Opcodes.ASTORE, 2);
-
+
for (int x = 0; x < setMethods.length; x++) {
- if (getMethods[x] == null) {
+ if (getMethods[x] == null) {
if (setMethods[x] == null
&& fields[x] == null) {
// null placeholder
@@ -242,11 +242,11 @@ final class WrapperHelperCompiler extends ASMHelper {
}
}
Class<?> tp = getMethods[x].getReturnType();
- mv.visitVarInsn(Opcodes.ALOAD, 2);
-
+ mv.visitVarInsn(Opcodes.ALOAD, 2);
+
if (List.class.isAssignableFrom(tp)) {
doCollection(mv, x);
- } else {
+ } else {
if (JAXBElement.class.isAssignableFrom(tp)) {
mv.visitVarInsn(Opcodes.ALOAD, 0);
mv.visitFieldInsn(Opcodes.GETFIELD, periodToSlashes(newClassName),
@@ -256,14 +256,14 @@ final class WrapperHelperCompiler extends ASMHelper {
mv.visitVarInsn(Opcodes.ALOAD, 1);
mv.visitIntInsn(Opcodes.SIPUSH, x);
mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, "java/util/List", "get", "(I)Ljava/lang/Object;", true);
-
+
if (tp.isPrimitive()) {
mv.visitTypeInsn(Opcodes.CHECKCAST, NONPRIMITIVE_MAP.get(tp));
Label l45 = createLabel();
Label l46 = createLabel();
mv.visitInsn(Opcodes.DUP);
mv.visitJumpInsn(Opcodes.IFNULL, l45);
- mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, NONPRIMITIVE_MAP.get(tp),
+ mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, NONPRIMITIVE_MAP.get(tp),
tp.getName() + "Value", "()" + PRIMITIVE_MAP.get(tp), false);
mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL,
periodToSlashes(wrapperType.getName()),
@@ -281,7 +281,7 @@ final class WrapperHelperCompiler extends ASMHelper {
mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL,
periodToSlashes(wrapperType.getName()),
setMethods[x].getName(), "(" + getClassCode(tp) + ")V", false);
- } else if (tp.isArray()) {
+ } else if (tp.isArray()) {
mv.visitTypeInsn(Opcodes.CHECKCAST, getClassCode(tp));
mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL,
periodToSlashes(wrapperType.getName()),
@@ -294,10 +294,10 @@ final class WrapperHelperCompiler extends ASMHelper {
}
}
}
-
+
mv.visitVarInsn(Opcodes.ALOAD, 2);
mv.visitInsn(Opcodes.ARETURN);
-
+
Label lEnd = createLabel();
mv.visitLabel(lEnd);
mv.visitLocalVariable("this", "L" + newClassName + ";", null, lBegin, lEnd, 0);
@@ -308,7 +308,7 @@ final class WrapperHelperCompiler extends ASMHelper {
mv.visitEnd();
return true;
}
-
+
private void doCollection(MethodVisitor mv, int x) {
// List aVal = obj.getA();
// List newA = (List)lst.get(99);
@@ -317,7 +317,7 @@ final class WrapperHelperCompiler extends ASMHelper {
// } else if (newA != null) {
// aVal.addAll(newA);
// }
-
+
Label l3 = createLabel();
mv.visitLabel(l3);
mv.visitLineNumber(114, l3);
@@ -370,39 +370,39 @@ final class WrapperHelperCompiler extends ASMHelper {
mv.visitLabel(jumpOverLabel);
mv.visitLineNumber(107, jumpOverLabel);
}
-
+
private boolean addGetWrapperParts(String newClassName,
Class<?> wrapperClass) {
MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC,
"getWrapperParts",
"(Ljava/lang/Object;)Ljava/util/List;",
- "(Ljava/lang/Object;)Ljava/util/List<Ljava/lang/Object;>;",
+ "(Ljava/lang/Object;)Ljava/util/List<Ljava/lang/Object;>;",
new String[] {
- "org/apache/cxf/interceptor/Fault"
+ "org/apache/cxf/interceptor/Fault"
});
mv.visitCode();
Label lBegin = createLabel();
mv.visitLabel(lBegin);
mv.visitLineNumber(108, lBegin);
-
+
// the ret List
mv.visitTypeInsn(Opcodes.NEW, "java/util/ArrayList");
mv.visitInsn(Opcodes.DUP);
mv.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/util/ArrayList", "<init>", "()V", false);
mv.visitVarInsn(Opcodes.ASTORE, 2);
-
+
// cast the Object to the wrapperType type
mv.visitVarInsn(Opcodes.ALOAD, 1);
mv.visitTypeInsn(Opcodes.CHECKCAST, periodToSlashes(wrapperClass.getName()));
mv.visitVarInsn(Opcodes.ASTORE, 3);
-
+
for (int x = 0; x < getMethods.length; x++) {
Method method = getMethods[x];
if (method == null && fields[x] != null) {
// fallback to reflection mode
return false;
}
-
+
if (method == null) {
Label l3 = createLabel();
mv.visitLabel(l3);
@@ -417,12 +417,12 @@ final class WrapperHelperCompiler extends ASMHelper {
Label l3 = createLabel();
mv.visitLabel(l3);
mv.visitLineNumber(250 + x, l3);
-
+
mv.visitVarInsn(Opcodes.ALOAD, 2);
mv.visitVarInsn(Opcodes.ALOAD, 3);
- mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL,
- periodToSlashes(wrapperClass.getName()),
- method.getName(),
+ mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL,
+ periodToSlashes(wrapperClass.getName()),
+ method.getName(),
getMethodSignature(method), false);
if (method.getReturnType().isPrimitive()) {
// wrap into Object type
@@ -438,20 +438,20 @@ final class WrapperHelperCompiler extends ASMHelper {
"getValue", "()Ljava/lang/Object;", false);
mv.visitLabel(jumpOverLabel);
}
-
+
mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, "java/util/List", "add", "(Ljava/lang/Object;)Z", true);
mv.visitInsn(Opcodes.POP);
}
}
-
+
// return the list
Label l2 = createLabel();
mv.visitLabel(l2);
mv.visitLineNumber(108, l2);
mv.visitVarInsn(Opcodes.ALOAD, 2);
mv.visitInsn(Opcodes.ARETURN);
-
-
+
+
Label lEnd = createLabel();
mv.visitLabel(lEnd);
mv.visitLocalVariable("this", "L" + newClassName + ";", null, lBegin, lEnd, 0);
@@ -464,13 +464,13 @@ final class WrapperHelperCompiler extends ASMHelper {
mv.visitEnd();
return true;
}
-
-
+
+
private static void createObjectWrapper(MethodVisitor mv, Class<?> cl) {
mv.visitMethodInsn(Opcodes.INVOKESTATIC, NONPRIMITIVE_MAP.get(cl),
- "valueOf", "(" + PRIMITIVE_MAP.get(cl) + ")L"
+ "valueOf", "(" + PRIMITIVE_MAP.get(cl) + ")L"
+ NONPRIMITIVE_MAP.get(cl) + ";", false);
}
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentMarshaller.java
----------------------------------------------------------------------
diff --git a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentMarshaller.java b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentMarshaller.java
index cc6d162..40c6156 100644
--- a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentMarshaller.java
+++ b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentMarshaller.java
@@ -45,14 +45,14 @@ public class JAXBAttachmentMarshaller extends AttachmentMarshaller {
atts = attachments;
isXop = attachments != null;
}
-
+
public QName getLastMTOMElementName() {
return lastElementName;
}
public String addMtomAttachment(byte[] data, int offset, int length, String mimeType, String elementNS,
String elementLocalName) {
-
+
Attachment att = AttachmentUtil.createMtomAttachment(
isXop, mimeType, elementNS, data, offset, length, threshold);
if (att != null) {
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentSchemaValidationHack.java
----------------------------------------------------------------------
diff --git a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentSchemaValidationHack.java b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentSchemaValidationHack.java
index ae5b9ab..709b3bd 100644
--- a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentSchemaValidationHack.java
+++ b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentSchemaValidationHack.java
@@ -35,21 +35,21 @@ import org.apache.cxf.phase.AbstractPhaseInterceptor;
import org.apache.cxf.phase.Phase;
/**
- *
+ *
*/
public final class JAXBAttachmentSchemaValidationHack extends AbstractPhaseInterceptor<Message> {
- public static final JAXBAttachmentSchemaValidationHack INSTANCE
+ public static final JAXBAttachmentSchemaValidationHack INSTANCE
= new JAXBAttachmentSchemaValidationHack();
- private static final String SAVED_DATASOURCES
+ private static final String SAVED_DATASOURCES
= JAXBAttachmentSchemaValidationHack.class.getName() + ".SAVED_DATASOURCES";
private JAXBAttachmentSchemaValidationHack() {
super(Phase.POST_PROTOCOL);
}
-
+
public void handleMessage(Message message) throws Fault {
// This assumes that this interceptor is only use in IN / IN Fault chains.
- if (ServiceUtils.isSchemaValidationEnabled(SchemaValidationType.IN, message)
+ if (ServiceUtils.isSchemaValidationEnabled(SchemaValidationType.IN, message)
&& message.getAttachments() != null) {
Collection<AttachmentDataSource> dss = new ArrayList<>();
for (Attachment at : message.getAttachments()) {
@@ -69,10 +69,10 @@ public final class JAXBAttachmentSchemaValidationHack extends AbstractPhaseInter
}
}
}
-
+
static class EndingInterceptor extends AbstractPhaseInterceptor<Message> {
static final EndingInterceptor INSTANCE = new EndingInterceptor();
-
+
EndingInterceptor() {
super(Phase.PRE_LOGICAL);
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentUnmarshaller.java
----------------------------------------------------------------------
diff --git a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentUnmarshaller.java b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentUnmarshaller.java
index 2a434cb..1aba2b3 100644
--- a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentUnmarshaller.java
+++ b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentUnmarshaller.java
@@ -38,7 +38,7 @@ public class JAXBAttachmentUnmarshaller extends AttachmentUnmarshaller {
private static final Logger LOG = LogUtils.getL7dLogger(JAXBAttachmentUnmarshaller.class);
private Collection<Attachment> attachments;
-
+
public JAXBAttachmentUnmarshaller(Collection<Attachment> attachments) {
super();
this.attachments = attachments;
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java
----------------------------------------------------------------------
diff --git a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java
index fc01732..10da669 100644
--- a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java
+++ b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java
@@ -51,7 +51,7 @@ public class DataReaderImpl<T> extends JAXBDataBase implements DataReader<T> {
boolean unwrapJAXBElement = true;
ValidationEventHandler veventHandler;
boolean setEventHandler = true;
-
+
public DataReaderImpl(JAXBDataBinding binding, boolean unwrap) {
super(binding.getContext());
unwrapJAXBElement = unwrap;
@@ -61,31 +61,31 @@ public class DataReaderImpl<T> extends JAXBDataBase implements DataReader<T> {
public Object read(T input) {
return read(null, input);
}
-
+
private static class WSUIDValidationHandler implements ValidationEventHandler {
ValidationEventHandler origHandler;
WSUIDValidationHandler(ValidationEventHandler o) {
origHandler = o;
}
-
+
public boolean handleEvent(ValidationEvent event) {
// if the original handler has already handled the event, no need for us
- // to do anything, otherwise if not yet handled, then do this 'hack'
+ // to do anything, otherwise if not yet handled, then do this 'hack'
if (origHandler != null && origHandler.handleEvent(event)) {
return true;
} else {
// hack for CXF-3453
String msg = event.getMessage();
- return msg != null
- && msg.contains(":Id")
- && (msg.startsWith("cvc-type.3.1.1")
- || msg.startsWith("cvc-type.3.2.2")
+ return msg != null
+ && msg.contains(":Id")
+ && (msg.startsWith("cvc-type.3.1.1")
+ || msg.startsWith("cvc-type.3.2.2")
|| msg.startsWith("cvc-complex-type.3.1.1")
|| msg.startsWith("cvc-complex-type.3.2.2"));
}
}
}
-
+
public void setProperty(String prop, Object value) {
if (prop.equals(JAXBDataBinding.UNWRAP_JAXB_ELEMENT)) {
unwrapJAXBElement = Boolean.TRUE.equals(value);
@@ -100,9 +100,9 @@ public class DataReaderImpl<T> extends JAXBDataBase implements DataReader<T> {
if (veventHandler == null) {
veventHandler = databinding.getValidationEventHandler();
}
- setEventHandler = MessageUtils.getContextualBoolean(m,
+ setEventHandler = MessageUtils.getContextualBoolean(m,
JAXBDataBinding.SET_VALIDATION_EVENT_HANDLER, true);
-
+
Object unwrapProperty = m.get(JAXBDataBinding.UNWRAP_JAXB_ELEMENT);
if (unwrapProperty == null) {
unwrapProperty = m.getExchange().get(JAXBDataBinding.UNWRAP_JAXB_ELEMENT);
@@ -112,7 +112,7 @@ public class DataReaderImpl<T> extends JAXBDataBase implements DataReader<T> {
}
}
}
-
+
private Unmarshaller createUnmarshaller() {
try {
Unmarshaller um = null;
@@ -124,7 +124,7 @@ public class DataReaderImpl<T> extends JAXBDataBase implements DataReader<T> {
um.setEventHandler(new WSUIDValidationHandler(veventHandler));
}
if (databinding.getUnmarshallerProperties() != null) {
- for (Map.Entry<String, Object> propEntry
+ for (Map.Entry<String, Object> propEntry
: databinding.getUnmarshallerProperties().entrySet()) {
try {
um.setProperty(propEntry.getKey(), propEntry.getValue());
@@ -161,25 +161,25 @@ public class DataReaderImpl<T> extends JAXBDataBase implements DataReader<T> {
// TODO:Cache the JAXBRIContext
QName qname = new QName(null, part.getConcreteName().getLocalPart());
- Object obj = JAXBEncoderDecoder.unmarshalWithBridge(qname,
- part.getTypeClass(),
- anns,
- databinding.getContextClasses(),
- reader,
+ Object obj = JAXBEncoderDecoder.unmarshalWithBridge(qname,
+ part.getTypeClass(),
+ anns,
+ databinding.getContextClasses(),
+ reader,
getAttachmentUnmarshaller());
-
+
onCompleteUnmarshalling();
-
+
return obj;
}
}
-
+
Unmarshaller um = createUnmarshaller();
try {
- Object obj = JAXBEncoderDecoder.unmarshall(um, reader, part,
+ Object obj = JAXBEncoderDecoder.unmarshall(um, reader, part,
unwrapJAXBElement);
onCompleteUnmarshalling();
-
+
return obj;
} finally {
JAXBUtils.closeUnmarshaller(um);
@@ -188,13 +188,13 @@ public class DataReaderImpl<T> extends JAXBDataBase implements DataReader<T> {
public Object read(QName name, T input, Class<?> type) {
Unmarshaller um = createUnmarshaller();
-
+
try {
Object obj = JAXBEncoderDecoder.unmarshall(um, input,
- name, type,
+ name, type,
unwrapJAXBElement);
onCompleteUnmarshalling();
-
+
return obj;
} finally {
JAXBUtils.closeUnmarshaller(um);
@@ -208,7 +208,7 @@ public class DataReaderImpl<T> extends JAXBDataBase implements DataReader<T> {
((UnmarshallerEventHandler) veventHandler).onUnmarshalComplete();
} catch (UnmarshalException e) {
if (e.getLinkedException() != null) {
- throw new Fault(new Message("UNMARSHAL_ERROR", LOG,
+ throw new Fault(new Message("UNMARSHAL_ERROR", LOG,
e.getLinkedException().getMessage()), e);
} else {
throw new Fault(new Message("UNMARSHAL_ERROR", LOG, e.getMessage()), e);
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataWriterImpl.java
----------------------------------------------------------------------
diff --git a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataWriterImpl.java b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataWriterImpl.java
index 53a99ea..a2de176 100644
--- a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataWriterImpl.java
+++ b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataWriterImpl.java
@@ -60,34 +60,34 @@ public class DataWriterImpl<T> extends JAXBDataBase implements DataWriter<T> {
ValidationEventHandler veventHandler;
boolean setEventHandler = true;
private JAXBDataBinding databinding;
-
+
public DataWriterImpl(JAXBDataBinding binding) {
super(binding.getContext());
databinding = binding;
}
-
+
public void write(Object obj, T output) {
write(obj, null, output);
}
-
+
public void setProperty(String prop, Object value) {
if (prop.equals(org.apache.cxf.message.Message.class.getName())) {
org.apache.cxf.message.Message m = (org.apache.cxf.message.Message)value;
veventHandler = (ValidationEventHandler)m.getContextualProperty(
JAXBDataBinding.WRITER_VALIDATION_EVENT_HANDLER);
-
+
if (veventHandler == null) {
veventHandler = (ValidationEventHandler)m.getContextualProperty(
"jaxb-validation-event-handler");
}
if (veventHandler == null) {
veventHandler = databinding.getValidationEventHandler();
- }
- setEventHandler = MessageUtils.getContextualBoolean(m,
+ }
+ setEventHandler = MessageUtils.getContextualBoolean(m,
JAXBDataBinding.SET_VALIDATION_EVENT_HANDLER, true);
}
}
-
+
private static class MtomValidationHandler implements ValidationEventHandler {
ValidationEventHandler origHandler;
JAXBAttachmentMarshaller marshaller;
@@ -96,7 +96,7 @@ public class DataWriterImpl<T> extends JAXBDataBase implements DataWriter<T> {
origHandler = v;
marshaller = m;
}
-
+
public boolean handleEvent(ValidationEvent event) {
// CXF-1194 this hack is specific to MTOM, so pretty safe to leave in here before calling the origHandler.
String msg = event.getMessage();
@@ -104,15 +104,15 @@ public class DataWriterImpl<T> extends JAXBDataBase implements DataWriter<T> {
&& msg.contains(marshaller.getLastMTOMElementName().getLocalPart())) {
return true;
}
-
+
if (origHandler != null) {
return origHandler.handleEvent(event);
}
return false;
}
-
+
}
-
+
public Marshaller createMarshaller(Object elValue, MessagePartInfo part) {
Class<?> cls = null;
if (part != null) {
@@ -129,7 +129,7 @@ public class DataWriterImpl<T> extends JAXBDataBase implements DataWriter<T> {
}
Marshaller marshaller;
try {
-
+
marshaller = context.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_ENCODING, StandardCharsets.UTF_8.name());
marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
@@ -147,7 +147,7 @@ public class DataWriterImpl<T> extends JAXBDataBase implements DataWriter<T> {
}
marshaller.setEventHandler(h);
}
-
+
final Map<String, String> nspref = databinding.getDeclaredNamespaceMappings();
final Map<String, String> nsctxt = databinding.getContextualNamespaceMap();
// set the prefix mapper if either of the prefix map is configured
@@ -158,7 +158,7 @@ public class DataWriterImpl<T> extends JAXBDataBase implements DataWriter<T> {
}
}
if (databinding.getMarshallerProperties() != null) {
- for (Map.Entry<String, Object> propEntry
+ for (Map.Entry<String, Object> propEntry
: databinding.getMarshallerProperties().entrySet()) {
try {
marshaller.setProperty(propEntry.getKey(), propEntry.getValue());
@@ -167,14 +167,14 @@ public class DataWriterImpl<T> extends JAXBDataBase implements DataWriter<T> {
}
}
}
-
+
marshaller.setSchema(schema);
AttachmentMarshaller atmarsh = getAttachmentMarshaller();
marshaller.setAttachmentMarshaller(atmarsh);
-
+
if (schema != null
&& atmarsh instanceof JAXBAttachmentMarshaller) {
- //we need a special even handler for XOP attachments
+ //we need a special even handler for XOP attachments
marshaller.setEventHandler(new MtomValidationHandler(marshaller.getEventHandler(),
(JAXBAttachmentMarshaller)atmarsh));
}
@@ -193,11 +193,11 @@ public class DataWriterImpl<T> extends JAXBDataBase implements DataWriter<T> {
}
return marshaller;
}
-
+
//REVISIT should this go into JAXBUtils?
private static void setContextualNamespaceDecls(Object mapper, Map<String, String> nsctxt) {
try {
- Method m = ReflectionUtil.getDeclaredMethod(mapper.getClass(),
+ Method m = ReflectionUtil.getDeclaredMethod(mapper.getClass(),
"setContextualNamespaceDecls", new Class<?>[]{String[].class});
String[] args = new String[nsctxt.size() * 2];
int ai = 0;
@@ -210,7 +210,7 @@ public class DataWriterImpl<T> extends JAXBDataBase implements DataWriter<T> {
// ignore
LOG.log(Level.WARNING, "Failed to set the contextual namespace map", e);
}
-
+
}
public void write(Object obj, MessagePartInfo part, T output) {
@@ -219,17 +219,17 @@ public class DataWriterImpl<T> extends JAXBDataBase implements DataWriter<T> {
honorJaxbAnnotation = true;
}
checkPart(part, obj);
-
+
if (obj != null
|| !(part.getXmlSchema() instanceof XmlSchemaElement)) {
-
- if (obj instanceof Exception
+
+ if (obj instanceof Exception
&& part != null
- && Boolean.TRUE.equals(part.getProperty(JAXBDataBinding.class.getName()
+ && Boolean.TRUE.equals(part.getProperty(JAXBDataBinding.class.getName()
+ ".CUSTOM_EXCEPTION"))) {
JAXBEncoderDecoder.marshallException(createMarshaller(obj, part),
(Exception)obj,
- part,
+ part,
output);
onCompleteMarshalling();
} else {
@@ -238,23 +238,23 @@ public class DataWriterImpl<T> extends JAXBDataBase implements DataWriter<T> {
JAXBEncoderDecoder.marshall(createMarshaller(obj, part), obj, part, output);
onCompleteMarshalling();
} else if (honorJaxbAnnotation && anns.length > 0) {
- //RpcLit will use the JAXB Bridge to marshall part message when it is
+ //RpcLit will use the JAXB Bridge to marshall part message when it is
//annotated with @XmlList,@XmlAttachmentRef,@XmlJavaTypeAdapter
//TODO:Cache the JAXBRIContext
-
+
JAXBEncoderDecoder.marshalWithBridge(part.getConcreteName(),
part.getTypeClass(),
- anns,
- databinding.getContextClasses(),
- obj,
- output,
+ anns,
+ databinding.getContextClasses(),
+ obj,
+ output,
getAttachmentMarshaller());
}
}
} else if (needToRender(part)) {
JAXBEncoderDecoder.marshallNullElement(createMarshaller(null, part),
output, part);
-
+
onCompleteMarshalling();
}
}
@@ -290,8 +290,8 @@ public class DataWriterImpl<T> extends JAXBDataBase implements DataWriter<T> {
return;
}
if (!typeClass.isInstance(object)) {
- throw new IllegalArgumentException("Part " + part.getName() + " should be of type "
- + typeClass.getName() + ", not "
+ throw new IllegalArgumentException("Part " + part.getName() + " should be of type "
+ + typeClass.getName() + ", not "
+ object.getClass().getName());
}
}
@@ -303,14 +303,14 @@ public class DataWriterImpl<T> extends JAXBDataBase implements DataWriter<T> {
}
return false;
}
-
+
private void onCompleteMarshalling() {
if (setEventHandler && veventHandler instanceof MarshallerEventHandler) {
try {
((MarshallerEventHandler) veventHandler).onMarshalComplete();
} catch (MarshalException e) {
if (e.getLinkedException() != null) {
- throw new Fault(new Message("MARSHAL_ERROR", LOG,
+ throw new Fault(new Message("MARSHAL_ERROR", LOG,
e.getLinkedException().getMessage()), e);
} else {
throw new Fault(new Message("MARSHAL_ERROR", LOG, e.getMessage()), e);
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/BareInInterceptorTest.java
----------------------------------------------------------------------
diff --git a/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/BareInInterceptorTest.java b/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/BareInInterceptorTest.java
index 20eb683..975b235 100644
--- a/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/BareInInterceptorTest.java
+++ b/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/BareInInterceptorTest.java
@@ -64,7 +64,7 @@ import static org.easymock.EasyMock.createNiceControl;
import static org.easymock.EasyMock.expect;
public class BareInInterceptorTest extends Assert {
-
+
PhaseInterceptorChain chain;
MessageImpl message;
Bus bus;
@@ -74,7 +74,7 @@ public class BareInInterceptorTest extends Assert {
EndpointInfo endpointInfo;
EndpointImpl endpoint;
BindingOperationInfo operation;
-
+
@Before
public void setUp() throws Exception {
bus = BusFactory.newInstance().createBus();
@@ -89,16 +89,16 @@ public class BareInInterceptorTest extends Assert {
.andStubReturn(new ArrayList<Interceptor<? extends Message>>());
expect(binding.getOutFaultInterceptors())
.andStubReturn(new ArrayList<Interceptor<? extends Message>>());
-
- bfm.registerBindingFactory("http://schemas.xmlsoap.org/wsdl/soap/", bf);
-
+
+ bfm.registerBindingFactory("http://schemas.xmlsoap.org/wsdl/soap/", bf);
+
}
-
+
@Test
public void testInterceptorInbound() throws Exception {
setUpUsingHelloWorld();
- BareInInterceptor interceptor = new BareInInterceptor();
+ BareInInterceptor interceptor = new BareInInterceptor();
message.setContent(XMLStreamReader.class, XMLInputFactory.newInstance()
.createXMLStreamReader(getTestStream(getClass(), "resources/GreetMeDocLiteralReq.xml")));
@@ -114,14 +114,14 @@ public class BareInInterceptorTest extends Assert {
Object obj = parameters.get(0);
assertTrue(obj instanceof GreetMe);
GreetMe greet = (GreetMe)obj;
- assertEquals("TestSOAPInputPMessage", greet.getRequestType());
+ assertEquals("TestSOAPInputPMessage", greet.getRequestType());
}
@Test
public void testInterceptorInbound1() throws Exception {
setUpUsingDocLit();
- BareInInterceptor interceptor = new BareInInterceptor();
+ BareInInterceptor interceptor = new BareInInterceptor();
message.setContent(XMLStreamReader.class, XMLInputFactory.newInstance()
.createXMLStreamReader(getTestStream(getClass(), "resources/sayHiDocLitBareReq.xml")));
@@ -137,18 +137,18 @@ public class BareInInterceptorTest extends Assert {
Object obj = parameters.get(0);
assertTrue(obj instanceof TradePriceData);
TradePriceData greet = (TradePriceData)obj;
- assertTrue(1.0 == greet.getTickerPrice());
- assertEquals("CXF", greet.getTickerSymbol());
+ assertTrue(1.0 == greet.getTickerPrice());
+ assertEquals("CXF", greet.getTickerSymbol());
}
-
+
@Test
public void testInterceptorInboundBareNoParameter() throws Exception {
setUpUsingDocLit();
-
- BareInInterceptor interceptor = new BareInInterceptor();
+
+ BareInInterceptor interceptor = new BareInInterceptor();
message.setContent(XMLStreamReader.class, XMLInputFactory.newInstance()
.createXMLStreamReader(getTestStream(getClass(), "resources/bareNoParamDocLitBareReq.xml")));
-
+
XMLStreamReader reader = message.getContent(XMLStreamReader.class);
// skip to the end element of soap body, so that we can serve an empty request to
// interceptor
@@ -164,7 +164,7 @@ public class BareInInterceptorTest extends Assert {
List<?> parameters = message.getContent(List.class);
assertNull(parameters);
}
-
+
@Test
public void testInterceptorOutbound() throws Exception {
setUpUsingHelloWorld();
@@ -185,7 +185,7 @@ public class BareInInterceptorTest extends Assert {
GreetMeResponse greet = (GreetMeResponse)obj;
assertEquals("TestSOAPOutputPMessage", greet.getResponseType());
}
-
+
//TODO: remove duplicate code in setUpUsingHelloWorld and setUpUsingDocLit
private void setUpUsingHelloWorld() throws Exception {
String ns = "http://apache.org/hello_world_soap_http";
@@ -215,8 +215,8 @@ public class BareInInterceptorTest extends Assert {
exchange.put(Service.class, service);
exchange.put(Endpoint.class, endpoint);
exchange.put(Binding.class, endpoint.getBinding());
- }
-
+ }
+
private void setUpUsingDocLit() throws Exception {
String ns = "http://apache.org/hello_world_doc_lit_bare";
WSDLServiceFactory factory = new WSDLServiceFactory(bus, getClass()
@@ -245,7 +245,7 @@ public class BareInInterceptorTest extends Assert {
exchange.put(Endpoint.class, endpoint);
exchange.put(Binding.class, endpoint.getBinding());
}
-
+
public InputStream getTestStream(Class<?> clz, String file) {
return clz.getResourceAsStream(file);
}
@@ -257,5 +257,5 @@ public class BareInInterceptorTest extends Assert {
public XMLStreamWriter getXMLStreamWriter(OutputStream os) {
return StaxUtils.createXMLStreamWriter(os);
}
-
+
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/BareOutInterceptorTest.java
----------------------------------------------------------------------
diff --git a/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/BareOutInterceptorTest.java b/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/BareOutInterceptorTest.java
index 572cac1..140c98c 100644
--- a/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/BareOutInterceptorTest.java
+++ b/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/BareOutInterceptorTest.java
@@ -47,14 +47,14 @@ import org.junit.Test;
public class BareOutInterceptorTest extends TestBase {
BareOutInterceptor interceptor;
-
+
private ByteArrayOutputStream baos;
private XMLStreamWriter writer;
-
+
@Before
public void setUp() throws Exception {
super.setUp();
-
+
interceptor = new BareOutInterceptor();
baos = new ByteArrayOutputStream();
writer = getXMLStreamWriter(baos);
@@ -75,13 +75,13 @@ public class BareOutInterceptorTest extends TestBase {
public void testWriteOutbound() throws Exception {
GreetMeResponse greetMe = new GreetMeResponse();
greetMe.setResponseType("responseType");
-
+
message.setContent(List.class, Arrays.asList(greetMe));
interceptor.handleMessage(message);
writer.close();
-
+
assertNull(message.getContent(Exception.class));
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
@@ -91,7 +91,7 @@ public class BareOutInterceptorTest extends TestBase {
StaxUtils.toNextElement(reader);
assertEquals(new QName("http://apache.org/hello_world_soap_http/types", "greetMeResponse"),
reader.getName());
-
+
StaxUtils.nextEvent(reader);
StaxUtils.toNextElement(reader);
assertEquals(new QName("http://apache.org/hello_world_soap_http/types", "responseType"),
@@ -102,14 +102,14 @@ public class BareOutInterceptorTest extends TestBase {
public void testWriteInbound() throws Exception {
GreetMe greetMe = new GreetMe();
greetMe.setRequestType("requestType");
-
+
message.setContent(List.class, Arrays.asList(greetMe));
message.put(Message.REQUESTOR_ROLE, Boolean.TRUE);
-
+
interceptor.handleMessage(message);
-
+
writer.close();
-
+
assertNull(message.getContent(Exception.class));
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
@@ -118,7 +118,7 @@ public class BareOutInterceptorTest extends TestBase {
StaxUtils.toNextElement(reader);
assertEquals(new QName("http://apache.org/hello_world_soap_http/types", "greetMe"),
reader.getName());
-
+
StaxUtils.nextEvent(reader);
StaxUtils.toNextElement(reader);
assertEquals(new QName("http://apache.org/hello_world_soap_http/types", "requestType"),
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/DataBindingMarshallerPropertiesTest.java
----------------------------------------------------------------------
diff --git a/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/DataBindingMarshallerPropertiesTest.java b/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/DataBindingMarshallerPropertiesTest.java
index 82b594b..a583648 100644
--- a/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/DataBindingMarshallerPropertiesTest.java
+++ b/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/DataBindingMarshallerPropertiesTest.java
@@ -25,15 +25,15 @@ import java.util.Map;
import org.junit.Test;
public class DataBindingMarshallerPropertiesTest extends TestBase {
- @Test
+ @Test
public void testInitializeUnmarshallerProperties() throws Exception {
JAXBDataBinding db = new JAXBDataBinding();
Map<String, Object> unmarshallerProperties = new HashMap<String, Object>();
unmarshallerProperties.put("someproperty", "somevalue");
db.setUnmarshallerProperties(unmarshallerProperties);
-
+
db.initialize(service);
-
+
assertTrue("somevalue".equals(db.getUnmarshallerProperties().get("someproperty")));
}
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/DatatypeFactoryTest.java
----------------------------------------------------------------------
diff --git a/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/DatatypeFactoryTest.java b/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/DatatypeFactoryTest.java
index ff16ccb..ce40be6 100644
--- a/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/DatatypeFactoryTest.java
+++ b/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/DatatypeFactoryTest.java
@@ -24,7 +24,7 @@ import org.junit.Assert;
import org.junit.Test;
public class DatatypeFactoryTest {
-
+
@Test
public void testNewFactory() throws Exception {
Class.forName("org.apache.cxf.jaxb.DatatypeFactory");
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/FixNamespacesXMLEventWriter.java
----------------------------------------------------------------------
diff --git a/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/FixNamespacesXMLEventWriter.java b/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/FixNamespacesXMLEventWriter.java
index cae032b..55d2f61 100644
--- a/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/FixNamespacesXMLEventWriter.java
+++ b/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/FixNamespacesXMLEventWriter.java
@@ -29,11 +29,11 @@ import javax.xml.stream.events.XMLEvent;
public class FixNamespacesXMLEventWriter implements XMLEventWriter, MarshallerAwareXMLWriter {
private final XMLEventWriter delegate;
private Marshaller marshaller;
-
+
public FixNamespacesXMLEventWriter(XMLEventWriter delegate) {
this.delegate = delegate;
}
-
+
public void flush() throws XMLStreamException {
delegate.flush();
}