localStrings.getLocalString(
"enterprise.deployment.oldDDwithAnnotation",
"{0} in archive {1} is of version {2}, which cannot support annotations in an application. Please upgrade the deployment descriptor to be a version supported by Java EE 5.0 (or later).",
new Object[] {ddName, archiveName, bundleDesc.getSpecVersion()}));
}
AnnotationProcessor ap = SJSASFactory.getAnnotationProcessor();
ProcessingContext ctx = ap.createContext();
if (annotationErrorHandler != null) {
ctx.setErrorHandler(annotationErrorHandler);
}
ctx.setProcessingInput(scanner);
ctx.pushHandler(aeHandler);
// Make sure there is a classloader available on the descriptor
// during annotation processing.
ClassLoader originalBundleClassLoader = null;
try {
originalBundleClassLoader = bundleDesc.getClassLoader();
} catch(Exception e) {
// getClassLoader can throw exception if not available
}
// Only set classloader if it's not already set.
if( originalBundleClassLoader == null ) {
bundleDesc.setClassLoader(classLoader);
}
try {
return ap.process(ctx);
} finally {
if( originalBundleClassLoader == null ) {
bundleDesc.setClassLoader(null);
}
}