Result result = getInitializedResult();
addWarningDetails(result,
getVerifierContext().getComponentNameConstructor());
result.setStatus(Result.PASSED); //default status is PASSED
for(EntityManagerReferenceDescriptor emRefDesc : descriptor.getEntityManagerReferenceDescriptors()) {
Set<InjectionTarget> injectionTargets = emRefDesc.getInjectionTargets();
if(injectionTargets != null) {
for(InjectionTarget it : injectionTargets) {
String itClassName = it.getClassName();
String errMsg = smh.getLocalString(className + ".warning",
"Found a persistence unit by name [ {0} ] injected into [ {1} ].",
new Object[]{emRefDesc.getUnitName(), itClassName});
try {
Class c = Class.forName(itClassName, false, getVerifierContext().getClassLoader());
if(!(Servlet.class.isAssignableFrom(c))) {
result.warning(errMsg);
} else if (!(SingleThreadModel.class.isAssignableFrom(c))) {
result.warning(errMsg);
}
} catch(Exception ex) {
result.warning(errMsg);
}
}
}
}
return result;