Element exDetail = (Element) DOMUtils.getChild(fault.getDetail(), Node.ELEMENT_NODE);
if (exDetail == null) {
return;
}
QName qname = new QName(exDetail.getNamespaceURI(), exDetail.getLocalName());
FaultInfo faultWanted = null;
MessagePartInfo part = null;
BindingOperationInfo boi = msg.getExchange().get(BindingOperationInfo.class);
if (boi == null) {
return;
}
if (boi.isUnwrapped()) {
boi = boi.getWrappedOperation();
}
for (FaultInfo faultInfo : boi.getOperationInfo().getFaults()) {
for (MessagePartInfo mpi : faultInfo.getMessageParts()) {
if (qname.equals(mpi.getConcreteName())) {
faultWanted = faultInfo;
part = mpi;
break;
}
}
if (faultWanted != null) {
break;
}
}
if (faultWanted == null) {
//did not find it using the proper qualified names, we'll try again with just the localpart
for (FaultInfo faultInfo : boi.getOperationInfo().getFaults()) {
for (MessagePartInfo mpi : faultInfo.getMessageParts()) {
if (qname.getLocalPart().equals(mpi.getConcreteName().getLocalPart())) {
faultWanted = faultInfo;
part = mpi;
break;
}
}
if (faultWanted != null) {
break;
}
}
}
if (faultWanted == null) {
return;
}
Service s = msg.getExchange().get(Service.class);
DataBinding dataBinding = s.getDataBinding();
Object e = null;
if (isDOMSupported(dataBinding)) {
DataReader<Node> reader = this.getNodeDataReader(msg);
reader.setProperty(DataReader.FAULT, fault);
e = reader.read(part, exDetail);
} else {
DataReader<XMLStreamReader> reader = this.getDataReader(msg);
XMLStreamReader xsr = new W3CDOMStreamReader(exDetail);
try {
xsr.nextTag();
} catch (XMLStreamException e1) {
throw new Fault(e1);
}
reader.setProperty(DataReader.FAULT, fault);
e = reader.read(part, xsr);
}
if (!(e instanceof Exception)) {
try {
Class<?> exClass = faultWanted.getProperty(Class.class.getName(), Class.class);
if (e == null) {
Constructor<?> constructor = exClass.getConstructor(new Class[]{String.class});
e = constructor.newInstance(new Object[]{fault.getMessage()});
} else {