FaultDescription faultDesc = null;
if (elementQName != null) {
for (int i = 0; i < operationDesc.getFaultDescriptions().length && faultDesc == null;
i++) {
FaultDescription fd = operationDesc.getFaultDescriptions()[i];
FaultBeanDesc faultBeanDesc = marshalDesc.getFaultBeanDesc(fd);
QName tryQName = new QName(faultBeanDesc.getFaultBeanNamespace(),
faultBeanDesc.getFaultBeanLocalName());
if (log.isErrorEnabled()) {
log.debug(" FaultDescription qname is (" + tryQName +
") and detail element qname is (" + elementQName + ")");
}
if (elementQName.equals(tryQName)) {
faultDesc = fd;
}
}
}
if (faultDesc == null && elementQName != null) {
// If not found, retry the search using just the local name
for (int i = 0; i < operationDesc.getFaultDescriptions().length && faultDesc == null;
i++) {
FaultDescription fd = operationDesc.getFaultDescriptions()[i];
FaultBeanDesc faultBeanDesc = marshalDesc.getFaultBeanDesc(fd);
String tryName = faultBeanDesc.getFaultBeanLocalName();
if (elementQName.getLocalPart().equals(tryName)) {
faultDesc = fd;
}
}
}
if (faultDesc == null) {
// This is a system exception if the method does not throw a checked exception or if
// the detail block is missing or contains multiple items.
exception = createSystemException(xmlfault, message);
} else {
if (log.isErrorEnabled()) {
log.debug("Ready to demarshal service exception. The detail entry name is " +
elementQName);
}
FaultBeanDesc faultBeanDesc = marshalDesc.getFaultBeanDesc(faultDesc);
boolean isLegacy =
(faultDesc.getFaultInfo() == null || faultDesc.getFaultInfo().length() == 0);
// Get the JAXB object from the block
JAXBBlockContext blockContext = new JAXBBlockContext(marshalDesc.getPackages());
// Note that faultBean may not be a bean, it could be a primitive
Class faultBeanFormalClass = loadClass(faultBeanDesc.getFaultBeanClassName());
// Use "by java type" marshalling if necessary
if (blockContext.getConstructionType() != JAXBUtils.CONSTRUCTION_TYPE.BY_CONTEXT_PATH &&
isNotJAXBRootElement(faultBeanFormalClass, marshalDesc)) {
blockContext.setProcessType(faultBeanFormalClass);