/** * Verify that the return type is void and it's a no-arg method */ private void checkValid(Method m) throws AnnotationProcessorException { if ( !(m.getReturnType().equals(Void.TYPE) && m.getParameterTypes().length == 0) ) { throw new AnnotationProcessorException("Method " + m + "annotated as @BeforeCompletion is not valid"); } }
/** * Receive notification of an error * @param ape The error information * @throws amy exception to stop the annotation processing */ public void error(AnnotationProcessorException ape) throws AnnotationProcessorException { AnnotationInfo info = ape.getLocator(); if (info==null){ logger.severe(ape.getMessage()); } else{ logger.severe(AnnotationUtils.getLocalString( "enterprise.deployment.annotation.error", "{2}\n symbol: {0} location: {1}\n\n", new Object[] { info.getElementType(), info.getAnnotatedElement(), ape.getMessage()})); } } }
private void processForAnnotations(AnnotationInfo element, AccessibleObject o, Map<AccessibleObject, Class[]> methodLevelInterceptors, ManagedBeanDescriptor managedBeanDesc, Class managedBeanClass) throws AnnotationProcessorException { Annotation ann = getMethodAnnotation(o, "javax.interceptor.Interceptors"); if(ann != null) { try { Method valueM = ann.annotationType().getDeclaredMethod("value"); methodLevelInterceptors.put(o, (Class[]) valueM.invoke(ann)); } catch(Exception e) { AnnotationProcessorException ape = new AnnotationProcessorException(e.getMessage(), element); ape.initCause(e); throw ape; } } else { // If the method or constructor excludes // class-level interceptors, explicitly set method-level to an empty list. boolean excludeClassInterceptors = ( getMethodAnnotation(o, "javax.interceptor.ExcludeClassInterceptors") != null ); if( excludeClassInterceptors ) { MethodDescriptor mDesc = getMethodDescriptor(o, managedBeanClass); if (mDesc != null) { managedBeanDesc.setMethodLevelInterceptorChain(mDesc, new LinkedList<InterceptorDescriptor>()); } } } }
} catch(AnnotationProcessorException ape) { log(Level.SEVERE, ape.getLocator(), ape.getMessage()); if (ape.isFatal()) { throw ape; throw new AnnotationProcessorException( AnnotationUtils.getLocalString( "enterprise.deployment.annotation.toomanyerror", annotation.annotationType(), ResultType.FAILED); } catch(Throwable e){ AnnotationProcessorException ape = new AnnotationProcessorException(e.getMessage(), element); ape.initCause(e); throw ape; } else { ctx.getErrorHandler().fine( new AnnotationProcessorException("No handler defined for " + annotation.annotationType()));
if (next.getAnnotation(Local.class) != null) { AnnotationProcessorException fatalException = new AnnotationProcessorException(localStrings.getLocalString( "enterprise.deployment.annotation.handlers.invalidbusinessinterface", "The interface {0} cannot be both a local and a remote business interface.", new Object[]{next.getName()})); fatalException.setFatal(true); throw fatalException; if (next.getAnnotation(Remote.class) != null) { AnnotationProcessorException fatalException = new AnnotationProcessorException(localStrings.getLocalString( "enterprise.deployment.annotation.handlers.invalidbusinessinterface", "The interface {0} cannot be both a local and a remote business interface.", new Object[]{next.getName()})); fatalException.setFatal(true); throw fatalException; if (remoteBusIntfs.contains(next) && localBusIntfs.contains(next)) { AnnotationProcessorException fatalException = new AnnotationProcessorException(localStrings.getLocalString( "enterprise.deployment.annotation.handlers.invalidbusinessinterface", "The interface {0} cannot be both a local and a remote business interface.", new Object[]{next.getName()})); fatalException.setFatal(true); throw fatalException;
DOLUtils.getDefaultLogger().severe(ex.getMessage()); DOLUtils.getDefaultLogger().log(Level.FINE, ex.getMessage(), ex); throw new IllegalStateException(ex); DOLUtils.getDefaultLogger().severe(ex.getMessage()); DOLUtils.getDefaultLogger().log(Level.FINE, ex.getMessage(), ex); throw new IllegalStateException(ex);
} catch(AnnotationProcessorException ape) { log(Level.SEVERE, ape.getLocator(), ape.getMessage()); if (ape.isFatal()) { throw ape; throw new AnnotationProcessorException( AnnotationUtils.getLocalString( "enterprise.deployment.annotation.toomanyerror", annotation.annotationType(), ResultType.FAILED); } catch(Throwable e){ AnnotationProcessorException ape = new AnnotationProcessorException(e.getMessage(), element); ape.initCause(e); throw ape; } else { ctx.getErrorHandler().fine( new AnnotationProcessorException("No handler defined for " + annotation.annotationType()));
Class c = (Class) ainfo.getAnnotatedElement(); AnnotationProcessorException fatalException = new AnnotationProcessorException(localStrings.getLocalString( "enterprise.deployment.annotation.handlers.invalidtypelevelejb", "Invalid TYPE-level @EJB with name() = [{0}] and " + new Object[] { ejbAn.name(), ejbAn.beanInterface(), c }), ainfo); fatalException.setFatal(true); throw fatalException;
DOLUtils.getDefaultLogger().severe(ex.getMessage()); DOLUtils.getDefaultLogger().log(Level.FINE, ex.getMessage(), ex); throw new IllegalStateException(ex); DOLUtils.getDefaultLogger().severe(ex.getMessage()); DOLUtils.getDefaultLogger().log(Level.FINE, ex.getMessage(), ex); throw new IllegalStateException(ex);
/** * Verify that the return type is void and it's a no-arg method */ private void checkValid(Method m) throws AnnotationProcessorException { if ( !(m.getReturnType().equals(Void.TYPE) && m.getParameterTypes().length == 0) ) { throw new AnnotationProcessorException("Method " + m + "annotated as @BeforeCompletion is not valid"); } }
classInterceptors = (Class[]) m.invoke(interceptorsAnn); } catch(Exception e) { AnnotationProcessorException ape = new AnnotationProcessorException(e.getMessage(), element); ape.initCause(e); throw ape; methodLevelInterceptors.put(m, (Class[]) valueM.invoke(ann)); } catch(Exception e) { AnnotationProcessorException ape = new AnnotationProcessorException(e.getMessage(), element); ape.initCause(e); throw ape;
/** * Receive notication of a fine error message * @param ape The warning information * @throws any exception to stop the annotation processing */ public void fine(AnnotationProcessorException ape) throws AnnotationProcessorException { if (logger.isLoggable(Level.FINE)){ AnnotationInfo info = ape.getLocator(); if (info==null){ logger.fine(ape.getMessage()); } else{ logger.fine(AnnotationUtils.getLocalString( "enterprise.deployment.annotation.error", "{2}\n symbol: {0}\n location: {1}\n\n", new Object[] { info.getElementType(), info.getAnnotatedElement(), ape.getMessage()})); } } }
} catch (AnnotationProcessorException e) { RuntimeException re = new RuntimeException("Unable to process ConfigProperty " + "annotation in class ["+claz.getName()+"] : " + e.getMessage()); re.initCause(e); throw re;
/** * Verify that the return type is void and it's a no-arg method */ private void checkValid(Method m) throws AnnotationProcessorException { if ( !(m.getReturnType().equals(Void.TYPE) && m.getParameterTypes().length == 0) ) { throw new AnnotationProcessorException("Method " + m + "annotated as @AfterBegin is not valid"); } }
classInterceptors = (Class[]) m.invoke(interceptorsAnn); } catch(Exception e) { AnnotationProcessorException ape = new AnnotationProcessorException(e.getMessage(), element); ape.initCause(e); throw ape;
/** * Receive notification of a warning * @param ape The warning information * @throws any exception to stop the annotation processing */ public void warning(AnnotationProcessorException ape) throws AnnotationProcessorException { if (logger.isLoggable(Level.WARNING)){ AnnotationInfo info = ape.getLocator(); if (info==null){ logger.warning(ape.getMessage()); } else{ logger.warning(AnnotationUtils.getLocalString( "enterprise.deployment.annotation.error", "{2}\n symbol: {0}\n location: {1}\n\n", new Object[] { info.getElementType(), info.getAnnotatedElement(), ape.getMessage()})); } } }
/** * Verify that the return type is void and it's a no-arg method */ private void checkValid(Method m) throws AnnotationProcessorException { if ( !(m.getReturnType().equals(Void.TYPE) && (m.getParameterTypes().length == 1 && m.getParameterTypes()[0].equals(Boolean.TYPE))) ) { throw new AnnotationProcessorException("Method " + m + "annotated as @AfterCompletion is not valid"); } }
/** * Receive notication of a fine error message * @param ape The warning information * @throws any exception to stop the annotation processing */ public void fine(AnnotationProcessorException ape) throws AnnotationProcessorException { if (logger.isLoggable(Level.FINE)){ AnnotationInfo info = ape.getLocator(); if (info==null){ logger.fine(ape.getMessage()); } else{ logger.fine(AnnotationUtils.getLocalString( "enterprise.deployment.annotation.error", "{2}\n symbol: {0}\n location: {1}\n\n", new Object[] { info.getElementType(), info.getAnnotatedElement(), ape.getMessage()})); } } }
/** * Verify that the return type is void and it's a no-arg method */ private void checkValid(Method m) throws AnnotationProcessorException { if ( !(m.getReturnType().equals(Void.TYPE) && m.getParameterTypes().length == 0) ) { throw new AnnotationProcessorException("Method " + m + "annotated as @AfterBegin is not valid"); } }
/** * Receive notification of an error * @param ape The error information * @throws amy exception to stop the annotation processing */ public void error(AnnotationProcessorException ape) throws AnnotationProcessorException { AnnotationInfo info = ape.getLocator(); if (info==null){ logger.severe(ape.getMessage()); } else{ logger.severe(AnnotationUtils.getLocalString( "enterprise.deployment.annotation.error", "{2}\n symbol: {0} location: {1}\n\n", new Object[] { info.getElementType(), info.getAnnotatedElement(), ape.getMessage()})); } } }