return collision;
}
@SuppressWarnings("unchecked")
private void processFault(JavaMethod method, Fault fault) throws ToolException {
JavaModel model = method.getInterface().getJavaModel();
Message faultMessage = fault.getMessage();
String name = ProcessorUtil.mangleNameToClassName(faultMessage.getQName().getLocalPart());
String namespace = faultMessage.getQName().getNamespaceURI();
String packageName = ProcessorUtil.parsePackageName(namespace, env.mapPackageName(namespace));
while (isNameCollision(packageName, name)) {
name = name + "_Exception";
}
collector.addExceptionClassName(packageName, name, packageName + "." + name);
method.addException(new JavaException(name, name, namespace));
Map<String, Part> faultParts = faultMessage.getParts();
Collection<Part> faultValues = faultParts.values();
JavaExceptionClass expClass = new JavaExceptionClass(model);
expClass.setName(name);
expClass.setNamespace(namespace);
expClass.setPackageName(packageName);
S2JJAXBModel jaxbModel = (S2JJAXBModel)env.get(ToolConstants.RAW_JAXB_MODEL);
for (Part part : faultValues) {
String fName = part.getName();
String fType = ProcessorUtil.resolvePartType(part, jaxbModel);
String fNamespace = ProcessorUtil.resolvePartNamespace(part);
String fPackageName = ProcessorUtil.parsePackageName(fNamespace, env.mapPackageName(fNamespace));
JavaField fField = new JavaField(fName, fType, fNamespace);
fField.setQName(ProcessorUtil.getElementName(part));
if (!method.getInterface().getPackageName().equals(fPackageName)) {
fField.setClassName(fPackageName + "." + fType);
}
if (!fType.equals(ProcessorUtil.resolvePartType(part))) {
fField.setClassName(ProcessorUtil.resolvePartType(part, jaxbModel, true));
}
expClass.addField(fField);
}
model.addExceptionClass(name, expClass);
}