@Test public void logsErrorWhenTryRegisterDuplicateExceptionMapper() throws Exception { providers.addExceptionMapper(RuntimeExceptionMapper.class); providers.addExceptionMapper(runtimeExceptionMapper); assertThatErrorLoggingEventWithThrowableAppended(DuplicateProviderException.class); }
@SuppressWarnings({"unchecked"}) public void addExceptionMapper(Class<? extends ExceptionMapper> exceptionMapperClass) { try { addExceptionMapper(new PerRequestObjectFactory(new ProviderDescriptorImpl(exceptionMapperClass))); } catch (Exception e) { LOG.error(String.format("Failed add ExceptionMapper %s. %s", exceptionMapperClass.getName(), e.getMessage()), e); } }
ProviderBinder implements Providers { @SuppressWarnings({"unchecked"}) public void addExceptionMapper(Class<? extends ExceptionMapper> exceptionMapperClass) { try { addExceptionMapper(new PerRequestObjectFactory(new ProviderDescriptorImpl(exceptionMapperClass))); } catch (Exception e) { LOG.error(String.format("Failed add ExceptionMapper %s. %s", exceptionMapperClass.getName(), e.getMessage()), e); } } }
ProviderBinder implements Providers { @SuppressWarnings({"unchecked"}) public void addExceptionMapper(Class<? extends ExceptionMapper> exceptionMapperClass) { try { addExceptionMapper(new PerRequestObjectFactory(new ProviderDescriptorImpl(exceptionMapperClass))); } catch (Exception e) { LOG.error(String.format("Failed add ExceptionMapper %s. %s", exceptionMapperClass.getName(), e.getMessage()), e); } } protected  ProviderBinder(); }
ProviderBinder implements Providers { @SuppressWarnings({"unchecked"}) public void addExceptionMapper(Class<? extends ExceptionMapper> exceptionMapperClass) { try { addExceptionMapper(new PerRequestObjectFactory(new ProviderDescriptorImpl(exceptionMapperClass))); } catch (Exception e) { LOG.error(String.format("Failed add ExceptionMapper %s. %s", exceptionMapperClass.getName(), e.getMessage()), e); } } protected  ProviderBinder(); static ProviderBinder getInstance(); static void setInstance(ProviderBinder providerBinder); void addContextResolver(Class<? extends ContextResolver> contextResolverClass); void addContextResolver(ContextResolver contextResolver); @SuppressWarnings({"unchecked"}) void addExceptionMapper(Class<? extends ExceptionMapper> exceptionMapperClass); @SuppressWarnings({"unchecked"}) void addExceptionMapper(ExceptionMapper exceptionMapper); void addMessageBodyReader(Class<? extends MessageBodyReader> messageBodyReaderClass); @SuppressWarnings({"unchecked"}) void addMessageBodyReader(MessageBodyReader messageBodyReader); void addMessageBodyWriter(Class<? extends MessageBodyWriter> messageBodyWriter); void addMessageBodyWriter(MessageBodyWriter messageBodyWriter); void addMethodInvokerFilter(Class<? extends MethodInvokerFilter> methodInvokerFilterClass); void addMethodInvokerFilter(MethodInvokerFilter methodInvokerFilter); void addRequestFilter(Class<? extends RequestFilter> requestFilterClass); void addRequestFilter(RequestFilter requestFilter); void addResponseFilter(Class<? extends ResponseFilter> responseFilterClass); void addResponseFilter(ResponseFilter responseFilter); List<MediaType> getAcceptableWriterMediaTypes(Class<?> type, Type genericType, Annotation[] annotations); @Override ContextResolver<T> getContextResolver(Class<T> contextType, MediaType mediaType); @Override ExceptionMapper<T> getExceptionMapper(Class<T> errorType); @Override MessageBodyReader<T> getMessageBodyReader(Class<T> type, Type genericType, Annotation[] annotations, MediaType mediaType); @Override MessageBodyWriter<T> getMessageBodyWriter(Class<T> type, Type genericType, Annotation[] annotations, MediaType mediaType); List<MethodInvokerFilter> getMethodInvokerFilters(String path); List<RequestFilter> getRequestFilters(String path); List<ResponseFilter> getResponseFilters(String path); void addContextResolver(ObjectFactory<ProviderDescriptor> contextResolverFactory); @SuppressWarnings("unchecked") void addExceptionMapper(ObjectFactory<ProviderDescriptor> exceptionMapperFactory); void addMessageBodyReader(ObjectFactory<ProviderDescriptor> readerFactory); void addMessageBodyWriter(ObjectFactory<ProviderDescriptor> writerFactory); void addMethodInvokerFilter(ObjectFactory<FilterDescriptor> filterFactory); void addRequestFilter(ObjectFactory<FilterDescriptor> filterFactory); void addResponseFilter(ObjectFactory<FilterDescriptor> filterFactory); }
ProviderBinder implements Providers { @SuppressWarnings({"unchecked"}) public void addExceptionMapper(Class<? extends ExceptionMapper> exceptionMapperClass) { try { addExceptionMapper(new PerRequestObjectFactory(new ProviderDescriptorImpl(exceptionMapperClass))); } catch (Exception e) { LOG.error(String.format("Failed add ExceptionMapper %s. %s", exceptionMapperClass.getName(), e.getMessage()), e); } } protected  ProviderBinder(); static ProviderBinder getInstance(); static void setInstance(ProviderBinder providerBinder); void addContextResolver(Class<? extends ContextResolver> contextResolverClass); void addContextResolver(ContextResolver contextResolver); @SuppressWarnings({"unchecked"}) void addExceptionMapper(Class<? extends ExceptionMapper> exceptionMapperClass); @SuppressWarnings({"unchecked"}) void addExceptionMapper(ExceptionMapper exceptionMapper); void addMessageBodyReader(Class<? extends MessageBodyReader> messageBodyReaderClass); @SuppressWarnings({"unchecked"}) void addMessageBodyReader(MessageBodyReader messageBodyReader); void addMessageBodyWriter(Class<? extends MessageBodyWriter> messageBodyWriter); void addMessageBodyWriter(MessageBodyWriter messageBodyWriter); void addMethodInvokerFilter(Class<? extends MethodInvokerFilter> methodInvokerFilterClass); void addMethodInvokerFilter(MethodInvokerFilter methodInvokerFilter); void addRequestFilter(Class<? extends RequestFilter> requestFilterClass); void addRequestFilter(RequestFilter requestFilter); void addResponseFilter(Class<? extends ResponseFilter> responseFilterClass); void addResponseFilter(ResponseFilter responseFilter); List<MediaType> getAcceptableWriterMediaTypes(Class<?> type, Type genericType, Annotation[] annotations); @Override ContextResolver<T> getContextResolver(Class<T> contextType, MediaType mediaType); @Override ExceptionMapper<T> getExceptionMapper(Class<T> errorType); @Override MessageBodyReader<T> getMessageBodyReader(Class<T> type, Type genericType, Annotation[] annotations, MediaType mediaType); @Override MessageBodyWriter<T> getMessageBodyWriter(Class<T> type, Type genericType, Annotation[] annotations, MediaType mediaType); List<MethodInvokerFilter> getMethodInvokerFilters(String path); List<RequestFilter> getRequestFilters(String path); List<ResponseFilter> getResponseFilters(String path); void addContextResolver(ObjectFactory<ProviderDescriptor> contextResolverFactory); @SuppressWarnings("unchecked") void addExceptionMapper(ObjectFactory<ProviderDescriptor> exceptionMapperFactory); void addMessageBodyReader(ObjectFactory<ProviderDescriptor> readerFactory); void addMessageBodyWriter(ObjectFactory<ProviderDescriptor> writerFactory); void addMethodInvokerFilter(ObjectFactory<FilterDescriptor> filterFactory); void addRequestFilter(ObjectFactory<FilterDescriptor> filterFactory); void addResponseFilter(ObjectFactory<FilterDescriptor> filterFactory);  }