for (ReferenceType referenceType : resourceMethod.getThrownTypes()) {
if (!(referenceType instanceof DeclaredType)) {
throw new ValidationException(resourceMethod.getPosition(), "Method " + resourceMethod + " of " + resourceMethod.getParent().getQualifiedName() + ": thrown type must be a declared type.");
}
TypeDeclaration declaration = ((DeclaredType) referenceType).getDeclaration();
if (declaration == null) {
throw new ValidationException(resourceMethod.getPosition(), "Method " + resourceMethod + " of " + resourceMethod.getParent().getQualifiedName() + ": unknown declaration for " + referenceType);
}
else if (declaration.getAnnotation(javax.xml.ws.WebFault.class) != null) {
WebFault fault = new WebFault((ClassDeclaration) declaration);
if (fault.isImplicitSchemaElement() && visitedFaults.add(fault)) {
model.put("message", fault);
processTemplate(faultBeanTemplate, model);
}