private void logDeploymentException(DeploymentException de) { collector.addException(de); } }
private void logDeploymentException(DeploymentException de) { collector.addException(de); } }
/** * Creates an instance of {@link Class} c using {@link Class#newInstance()}. Exceptions are logged to {@link * ErrorCollector}. * * @param c {@link Class} whose instance is going to be created * @param collector {@link ErrorCollector} which collects the {@link Exception}s. * @param <T> type. * @return new instance of {@link Class}. */ public static <T> T getInstance(Class<T> c, ErrorCollector collector) { T instance = null; try { instance = getInstance(c); } catch (Exception e) { collector.addException(new DeploymentException(LocalizationMessages.CLASS_NOT_INSTANTIATED(c.getName()), e)); } return instance; }
/** * Creates an instance of {@link Class} c using {@link Class#newInstance()}. Exceptions are logged to {@link * ErrorCollector}. * * @param c {@link Class} whose instance is going to be created * @param collector {@link ErrorCollector} which collects the {@link Exception}s. * @param <T> type. * @return new instance of {@link Class}. */ public static <T> T getInstance(Class<T> c, ErrorCollector collector) { T instance = null; try { instance = getInstance(c); } catch (Exception e) { collector.addException(new DeploymentException(LocalizationMessages.CLASS_NOT_INSTANTIATED(c.getName()), e)); } return instance; }
collector.addException( new DeploymentException(LocalizationMessages.COMPONENT_PROVIDER_THREW_EXCEPTION(c.getName()), e));
collector.addException( new DeploymentException(LocalizationMessages.COMPONENT_PROVIDER_THREW_EXCEPTION(c.getName()), e));
errorCollector.addException(new DeploymentException(String.format( "Class %s is not ServerApplicationConfig descendant nor has @ServerEndpoint annotation.", c.getName())));
errorCollector.addException(new DeploymentException(String.format( "Class %s is not ServerApplicationConfig descendant nor has @ServerEndpoint annotation.", c.getName())));
if (!(PrimitivesToWrappers.isPrimitiveWrapper(type) || type.isPrimitive() || type.equals(String.class))) { collector.addException(new DeploymentException( LocalizationMessages.ENDPOINT_WRONG_PATH_PARAM(method.getName(), type.getName()))); } else if (type == Session.class) { if (sessionPresent) { collector.addException(new DeploymentException( LocalizationMessages.ENDPOINT_MULTIPLE_SESSION_PARAM(method.getName()))); } else {
/** * Checks whether the params of the method annotated with {@link javax.websocket.OnMessage} comply with the * specification. * <p> * Voluntary parameters of type {@link javax.websocket.Session} and parameters annotated with {@link * javax.websocket.server.PathParam} are checked in advance in {@link AnnotatedEndpoint}. */ public void checkOnMessageParams(Method method, MessageHandler handler) { try { handlerManager.addMessageHandler(handler); } catch (IllegalStateException ise) { collector.addException(new DeploymentException( LocalizationMessages.CLASS_CHECKER_ADD_MESSAGE_HANDLER_ERROR( annotatedClass.getCanonicalName(), ise.getMessage()), ise.getCause())); } checkOnMessageReturnType(method); }
if (!(PrimitivesToWrappers.isPrimitiveWrapper(type) || type.isPrimitive() || type.equals(String.class))) { collector.addException(new DeploymentException( LocalizationMessages.ENDPOINT_WRONG_PATH_PARAM(method.getName(), type.getName()))); } else if (type == Session.class) { if (sessionPresent) { collector.addException(new DeploymentException( LocalizationMessages.ENDPOINT_MULTIPLE_SESSION_PARAM(method.getName()))); } else {
/** * Checks whether the params of the method annotated with {@link javax.websocket.OnMessage} comply with the * specification. * <p> * Voluntary parameters of type {@link javax.websocket.Session} and parameters annotated with {@link * javax.websocket.server.PathParam} are checked in advance in {@link AnnotatedEndpoint}. */ public void checkOnMessageParams(Method method, MessageHandler handler) { try { handlerManager.addMessageHandler(handler); } catch (IllegalStateException ise) { collector.addException(new DeploymentException( LocalizationMessages.CLASS_CHECKER_ADD_MESSAGE_HANDLER_ERROR( annotatedClass.getCanonicalName(), ise.getMessage()), ise.getCause())); } checkOnMessageReturnType(method); }
collector.addException( new DeploymentException(LocalizationMessages.COMPONENT_PROVIDER_THREW_EXCEPTION(c.getName()), e));
engineProviderClazz = ReflectionHelper.classForNameWithException(containerProviderClassName); } catch (ClassNotFoundException e) { collector.addException(e); throw new RuntimeException(collector.composeComprehensiveException());
engineProviderClazz = ReflectionHelper.classForNameWithException(containerProviderClassName); } catch (ClassNotFoundException e) { collector.addException(e); throw new RuntimeException(collector.composeComprehensiveException());
collector.addException( new DeploymentException(LocalizationMessages.COMPONENT_PROVIDER_THREW_EXCEPTION(c.getName()), e));
collector.addException(new DeploymentException( LocalizationMessages.ENDPOINT_ANNOTATION_NOT_FOUND(ServerEndpoint.class.getSimpleName(), annotatedClass.getName()))); collector.addException(new DeploymentException( LocalizationMessages.ENDPOINT_ANNOTATION_NOT_FOUND(ClientEndpoint.class.getSimpleName(), annotatedClass.getName())));
collector.addException(new DeploymentException( LocalizationMessages.ENDPOINT_ANNOTATION_NOT_FOUND(ServerEndpoint.class.getSimpleName(), annotatedClass.getName()))); collector.addException(new DeploymentException( LocalizationMessages.ENDPOINT_ANNOTATION_NOT_FOUND(ClientEndpoint.class.getSimpleName(), annotatedClass.getName())));
collector.addException(de);
collector.addException(de);