Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@ApiModelProperty throwing NumberFormatException if example value is not set #2265

Closed
nikunjundhad opened this issue Feb 24, 2018 · 30 comments
Labels
Milestone

Comments

@nikunjundhad
Copy link

@nikunjundhad nikunjundhad commented Feb 24, 2018

Hi,

When we don't set example value in @ApiModelProperty for Wrapper class, its try to set empty string ("") as an example and during parsing its throw NumberFormatException, can't we have something which set default value for those wrapper class like for Integer it set 0 in JSON example.
We are facing this issue for IntegerProperty, DecimalProperty, BaseIntegerProperty.
Below i attached Exception log,

NumberFormatException stack trace
NumberFormatException: For input string: ""
      	at java.lang.Integer.parseInt(String)
      	at io.swagger.models.properties.IntegerProperty.setExample(Object)
      	at io.swagger.models.properties.AbstractProperty.setExample(String)
      	at springfox.documentation.swagger2.mappers.ModelMapper.mapProperty(ModelProperty)
      	at springfox.documentation.swagger2.mappers.ModelMapper.mapProperties(SortedMap)
      	at springfox.documentation.swagger2.mappers.ModelMapper.mapProperties(Model)
      	at springfox.documentation.swagger2.mappers.ModelMapper.mapModels(Map)
      	at springfox.documentation.swagger2.mappers.ModelMapper.modelsFromApiListings(Multimap)
      	at springfox.documentation.swagger2.mappers.ServiceModelToSwagger2MapperImpl.mapDocumentation(Documentation)
      	at springfox.documentation.swagger2.web.Swagger2Controller.getDocumentation(String, HttpServletRequest)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Method, Object, Object[])
      	at sun.reflect.NativeMethodAccessorImpl.invoke(Object, Object[])
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Object, Object[])
      	at java.lang.reflect.Method.invoke(Object, Object[])
      	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(Object[])
      	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(NativeWebRequest, ModelAndViewContainer, Object[])
      	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletWebRequest, ModelAndViewContainer, Object[])
      	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(HttpServletRequest, HttpServletResponse, HandlerMethod)
      	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(HttpServletRequest, HttpServletResponse, HandlerMethod)
      	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(HttpServletRequest, HttpServletResponse, Object)
      	at org.springframework.web.servlet.DispatcherServlet.doDispatch(HttpServletRequest, HttpServletResponse)
      	at org.springframework.web.servlet.DispatcherServlet.doService(HttpServletRequest, HttpServletResponse)
      	at org.springframework.web.servlet.FrameworkServlet.processRequest(HttpServletRequest, HttpServletResponse)
      	at org.springframework.web.servlet.FrameworkServlet.doGet(HttpServletRequest, HttpServletResponse)
      	at javax.servlet.http.HttpServlet.service(HttpServletRequest, HttpServletResponse)
      	at org.springframework.web.servlet.FrameworkServlet.service(HttpServletRequest, HttpServletResponse)
      	at javax.servlet.http.HttpServlet.service(ServletRequest, ServletResponse)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ServletRequest, ServletResponse)
      	at org.apache.tomcat.websocket.server.WsFilter.doFilter(ServletRequest, ServletResponse, FilterChain)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ServletRequest, ServletResponse)
      	at com.accelevents.security.AuthenticationTokenProcessingFilter.doFilter(ServletRequest, ServletResponse, FilterChain)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ServletRequest, ServletResponse)
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest, ServletResponse)
      	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterInvocation)
      	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(ServletRequest, ServletResponse, FilterChain)
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest, ServletResponse)
      	at com.accelevents.security.AuthenticationTokenProcessingFilter.doFilter(ServletRequest, ServletResponse, FilterChain)
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest, ServletResponse)
      	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ServletRequest, ServletResponse, FilterChain)
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest, ServletResponse)
      	at org.springframework.security.web.session.SessionManagementFilter.doFilter(ServletRequest, ServletResponse, FilterChain)
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest, ServletResponse)
      	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(ServletRequest, ServletResponse, FilterChain)
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest, ServletResponse)
      	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(ServletRequest, ServletResponse, FilterChain)
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest, ServletResponse)
      	at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(ServletRequest, ServletResponse, FilterChain)
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest, ServletResponse)
      	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(ServletRequest, ServletResponse, FilterChain)
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest, ServletResponse)
      	at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(ServletRequest, ServletResponse, FilterChain)
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest, ServletResponse)
      	at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HttpServletRequest, HttpServletResponse, FilterChain)
      	at org.springframework.web.filter.OncePerRequestFilter.doFilter(ServletRequest, ServletResponse, FilterChain)
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest, ServletResponse)
      	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(ServletRequest, ServletResponse, FilterChain)
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest, ServletResponse)
      	at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(HttpServletRequest, HttpServletResponse, FilterChain)
      	at org.springframework.web.filter.OncePerRequestFilter.doFilter(ServletRequest, ServletResponse, FilterChain)
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(ServletRequest, ServletResponse)
      	at org.springframework.security.web.FilterChainProxy.doFilterInternal(ServletRequest, ServletResponse, FilterChain)
      	at org.springframework.security.web.FilterChainProxy.doFilter(ServletRequest, ServletResponse, FilterChain)
      	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(Filter, ServletRequest, ServletResponse, FilterChain)
      	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(ServletRequest, ServletResponse, FilterChain)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ServletRequest, ServletResponse)
      	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(HttpServletRequest, HttpServletResponse, FilterChain)
      	at org.springframework.web.filter.OncePerRequestFilter.doFilter(ServletRequest, ServletResponse, FilterChain)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ServletRequest, ServletResponse)
      	at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpServletRequest, HttpServletResponse, FilterChain)
      	at org.springframework.web.filter.OncePerRequestFilter.doFilter(ServletRequest, ServletResponse, FilterChain)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ServletRequest, ServletResponse)
      	at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HttpServletRequest, HttpServletResponse, FilterChain)
      	at org.springframework.web.filter.OncePerRequestFilter.doFilter(ServletRequest, ServletResponse, FilterChain)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ServletRequest, ServletResponse)
      	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(HttpServletRequest, HttpServletResponse, FilterChain)
      	at org.springframework.web.filter.OncePerRequestFilter.doFilter(ServletRequest, ServletResponse, FilterChain)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ServletRequest, ServletResponse)
      	at org.springframework.boot.web.support.ErrorPageFilter.doFilter(HttpServletRequest, HttpServletResponse, FilterChain)
      	at org.springframework.boot.web.support.ErrorPageFilter.access$000(ErrorPageFilter, HttpServletRequest, HttpServletResponse, FilterChain)
      	at org.springframework.boot.web.support.ErrorPageFilter$1.doFilterInternal(HttpServletRequest, HttpServletResponse, FilterChain)
      	at org.springframework.web.filter.OncePerRequestFilter.doFilter(ServletRequest, ServletResponse, FilterChain)
      	at org.springframework.boot.web.support.ErrorPageFilter.doFilter(ServletRequest, ServletResponse, FilterChain)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ServletRequest, ServletResponse)
      	at org.apache.catalina.core.StandardWrapperValve.invoke(Request, Response)
      	at org.apache.catalina.core.StandardContextValve.invoke(Request, Response)
      	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Request, Response)
      	at org.apache.catalina.core.StandardHostValve.invoke(Request, Response)
      	at org.apache.catalina.valves.ErrorReportValve.invoke(Request, Response)
      	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(Request, Response)
      	at org.apache.catalina.core.StandardEngineValve.invoke(Request, Response)
      	at org.apache.catalina.connector.CoyoteAdapter.service(Request, Response)
      	at org.apache.coyote.http11.AbstractHttp11Processor.process(SocketWrapper)
      	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(SocketWrapper, SocketStatus)
      	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun()
      	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run()
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor$Worker)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run()
      	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run()
      	at java.lang.Thread.run()
@dilipkrish dilipkrish added the bug label Feb 25, 2018
@nikunjundhad

This comment has been minimized.

Copy link
Author

@nikunjundhad nikunjundhad commented Feb 26, 2018

@dilipkrish for this annotation @APIModelProperty we are receiving another exception ClassNotFound.
Here i am attaching exception log please check that as well.

ClassNotFoundException stack trace
ClassNotFoundException
      	at java.lang.Class.forName(String)
      	at springfox.documentation.swagger.schema.ApiModelProperties$7.apply(ApiModelProperty)
      	at springfox.documentation.swagger.schema.ApiModelProperties$7.apply(Object)
      	at com.google.common.base.Present.transform(Function)
      	at springfox.documentation.swagger.schema.ApiModelPropertyPropertyBuilder.apply(ModelPropertyContext)
      	at springfox.documentation.schema.plugins.SchemaPluginsManager.property(ModelPropertyContext)
      	at springfox.documentation.schema.property.OptimizedModelPropertiesProvider.beanModelProperty(ResolvedMethod, BeanPropertyDefinition, ModelContext)
      	at springfox.documentation.schema.property.OptimizedModelPropertiesProvider.access$100(OptimizedModelPropertiesProvider, ResolvedMethod, BeanPropertyDefinition, ModelContext)
      	at springfox.documentation.schema.property.OptimizedModelPropertiesProvider$2.apply(ResolvedMethod)
      	at springfox.documentation.schema.property.OptimizedModelPropertiesProvider$2.apply(Object)
      	at com.google.common.base.Present.transform(Function)
      	at springfox.documentation.schema.property.OptimizedModelPropertiesProvider.candidateProperties(ResolvedType, AnnotatedMember, BeanPropertyDefinition, ModelContext)
      	at springfox.documentation.schema.property.OptimizedModelPropertiesProvider.propertiesFor(ResolvedType, ModelContext)
      	at springfox.documentation.schema.property.CachingModelPropertiesProvider$1.load(ModelContext)
      	at springfox.documentation.schema.property.CachingModelPropertiesProvider$1.load(Object)
      	at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(Object, CacheLoader)
      	at com.google.common.cache.LocalCache$Segment.loadSync(Object, int, LocalCache$LoadingValueReference, CacheLoader)
      	at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(Object, int, CacheLoader)
      	at com.google.common.cache.LocalCache$Segment.get(Object, int, CacheLoader)
      	at com.google.common.cache.LocalCache.get(Object, CacheLoader)
      	at com.google.common.cache.LocalCache.getOrLoad(Object)
      	at com.google.common.cache.LocalCache$LocalLoadingCache.get(Object)
      	at springfox.documentation.schema.property.CachingModelPropertiesProvider.propertiesFor(ResolvedType, ModelContext)
      	at springfox.documentation.schema.DefaultModelDependencyProvider.propertiesFor(ModelContext, ResolvedType)
      	at springfox.documentation.schema.DefaultModelDependencyProvider.nonTrivialProperties(ModelContext, ResolvedType)
      	at springfox.documentation.schema.DefaultModelDependencyProvider.resolvedPropertiesAndFields(ModelContext, ResolvedType)
      	at springfox.documentation.schema.DefaultModelDependencyProvider.resolvedDependencies(ModelContext)
      	at springfox.documentation.schema.DefaultModelDependencyProvider.resolvedTypeParameters(ModelContext, ResolvedType)
      	at springfox.documentation.schema.DefaultModelDependencyProvider.resolvedDependencies(ModelContext)
      	at springfox.documentation.schema.DefaultModelDependencyProvider.dependentModels(ModelContext)
      	at springfox.documentation.schema.CachingModelDependencyProvider$1.load(ModelContext)
      	at springfox.documentation.schema.CachingModelDependencyProvider$1.load(Object)
      	at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(Object, CacheLoader)
      	at com.google.common.cache.LocalCache$Segment.loadSync(Object, int, LocalCache$LoadingValueReference, CacheLoader)
      	at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(Object, int, CacheLoader)
      	at com.google.common.cache.LocalCache$Segment.get(Object, int, CacheLoader)
      	at com.google.common.cache.LocalCache.get(Object, CacheLoader)
      	at com.google.common.cache.LocalCache.getOrLoad(Object)
      	at com.google.common.cache.LocalCache$LocalLoadingCache.get(Object)
      	at springfox.documentation.schema.CachingModelDependencyProvider.dependentModels(ModelContext)
      	at springfox.documentation.schema.DefaultModelProvider.dependencies(ModelContext)
      	at springfox.documentation.schema.CachingModelProvider.dependencies(ModelContext)
      	at springfox.documentation.spring.web.scanners.ApiModelReader.populateDependencies(ModelContext, Map)
      	at springfox.documentation.spring.web.scanners.ApiModelReader.read(RequestMappingContext)
      	at springfox.documentation.spring.web.scanners.ApiListingScanner.scan(ApiListingScanningContext)
      	at springfox.documentation.spring.web.scanners.ApiDocumentationScanner.scan(DocumentationContext)
      	at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.scanDocumentation(DocumentationContext)
      	at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.start()
      	at org.springframework.context.support.DefaultLifecycleProcessor.doStart(Map, String, boolean)
      	at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor, Map, String, boolean)
      	at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start()
      	at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(boolean)
      	at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh()
      	at org.springframework.context.support.AbstractApplicationContext.finishRefresh()
      	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh()
      	at org.springframework.context.support.AbstractApplicationContext.refresh()
      	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh()
      	at org.springframework.boot.SpringApplication.refresh(ApplicationContext)
      	at org.springframework.boot.SpringApplication.refreshContext(ConfigurableApplicationContext)
      	at org.springframework.boot.SpringApplication.run(String[])
      	at org.springframework.boot.web.support.SpringBootServletInitializer.run(SpringApplication)
      	at org.springframework.boot.web.support.SpringBootServletInitializer.createRootApplicationContext(ServletContext)
      	at org.springframework.boot.web.support.SpringBootServletInitializer.onStartup(ServletContext)
      	at org.springframework.web.SpringServletContainerInitializer.onStartup(Set, ServletContext)
      	at org.apache.catalina.core.StandardContext.startInternal()
      	at org.apache.catalina.util.LifecycleBase.start()
      	at org.apache.catalina.core.ContainerBase.addChildInternal(Container)
      	at org.apache.catalina.core.ContainerBase.addChild(Container)
      	at org.apache.catalina.core.StandardHost.addChild(Container)
      	at org.apache.catalina.startup.HostConfig.deployWAR(ContextName, File)
      	at org.apache.catalina.startup.HostConfig$DeployWar.run()
      	at java.util.concurrent.Executors$RunnableAdapter.call()
      	at java.util.concurrent.FutureTask.run()
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor$Worker)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run()
      	at java.lang.Thread.run()
@dilipkrish

This comment has been minimized.

Copy link
Member

@dilipkrish dilipkrish commented Feb 27, 2018

@nikunjundhad That seems like you've got an ApiModelProperty#dataType that is not a fully qualified class name

@dilipkrish dilipkrish added the next label Feb 28, 2018
@dilipkrish

This comment has been minimized.

Copy link
Member

@dilipkrish dilipkrish commented Mar 10, 2018

@nikunjundhad what version of springfox are u using?

@dilipkrish

This comment has been minimized.

Copy link
Member

@dilipkrish dilipkrish commented Mar 10, 2018

I suspect this is fixed. Would you mind testing with 2.8.0-SNAPSHOT and reporting back. Im closing this issue for now. If its not fixed please re-open this issue

@dilipkrish dilipkrish closed this Mar 10, 2018
@ghost ghost removed the next label Mar 10, 2018
@nikunjundhad

This comment has been minimized.

Copy link
Author

@nikunjundhad nikunjundhad commented Mar 11, 2018

@dilipkrish i am using latest version 2.8.0

@dilipkrish

This comment has been minimized.

Copy link
Member

@dilipkrish dilipkrish commented Mar 11, 2018

Would be great if you could try 2.8.1-SNAPSHOT and confirm if its fixed.

@kyleki

This comment has been minimized.

Copy link

@kyleki kyleki commented Apr 11, 2018

I'm experiencing the exact same thing as the OP with the NumberFormatException in 2.8.1-SNAPSHOT. Is there a fix in the works for this or should I just ignore the warning via my log config?

It feels like this is some sort of regression since it was supposed to be fixed here:
#1100

@dilipkrish

This comment has been minimized.

Copy link
Member

@dilipkrish dilipkrish commented Apr 11, 2018

Possibly a slightly different stack trace? Or perhaps a breaking test would be useful. I have a feeling It should be fixed @kyleki

@kyleki

This comment has been minimized.

Copy link

@kyleki kyleki commented Apr 11, 2018

Here's the stacktrace I'm getting:

Stack trace
2018-04-11 10:22:01.794  WARN 6587 --- [nio-8080-exec-6] i.s.m.p.AbstractSerializableParameter    : Illegal DefaultValue null for parameter type integer

java.lang.NumberFormatException: For input string: ""
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) ~[na:1.8.0_151]
	at java.lang.Long.parseLong(Long.java:601) ~[na:1.8.0_151]
	at java.lang.Long.valueOf(Long.java:803) ~[na:1.8.0_151]
	at io.swagger.models.parameters.AbstractSerializableParameter.getExample(AbstractSerializableParameter.java:395) ~[swagger-models-1.5.18.jar:1.5.18]
	at sun.reflect.GeneratedMethodAccessor141.invoke(Unknown Source) ~[na:na]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_151]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_151]
	at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:664) [jackson-databind-2.8.6.jar:2.8.6]
	at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:690) [jackson-databind-2.8.6.jar:2.8.6]
	at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155) [jackson-databind-2.8.6.jar:2.8.6]
	at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serializeContents(IndexedListSerializer.java:119) [jackson-databind-2.8.6.jar:2.8.6]
	at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:79) [jackson-databind-2.8.6.jar:2.8.6]
	at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:18) [jackson-databind-2.8.6.jar:2.8.6]
	at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:704) [jackson-databind-2.8.6.jar:2.8.6]
	at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:690) [jackson-databind-2.8.6.jar:2.8.6]
	at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155) [jackson-databind-2.8.6.jar:2.8.6]
	at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:704) [jackson-databind-2.8.6.jar:2.8.6]
	at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:690) [jackson-databind-2.8.6.jar:2.8.6]
	at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155) [jackson-databind-2.8.6.jar:2.8.6]
	at com.fasterxml.jackson.databind.ser.std.MapSerializer.serializeFields(MapSerializer.java:633) [jackson-databind-2.8.6.jar:2.8.6]
	at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:536) [jackson-databind-2.8.6.jar:2.8.6]
	at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:30) [jackson-databind-2.8.6.jar:2.8.6]
	at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:704) [jackson-databind-2.8.6.jar:2.8.6]
	at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:690) [jackson-databind-2.8.6.jar:2.8.6]
	at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155) [jackson-databind-2.8.6.jar:2.8.6]
	at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:292) [jackson-databind-2.8.6.jar:2.8.6]
	at com.fasterxml.jackson.databind.ObjectMapper._configAndWriteValue(ObjectMapper.java:3681) [jackson-databind-2.8.6.jar:2.8.6]
	at com.fasterxml.jackson.databind.ObjectMapper.writeValueAsString(ObjectMapper.java:3057) [jackson-databind-2.8.6.jar:2.8.6]
	at springfox.documentation.spring.web.json.JsonSerializer.toJson(JsonSerializer.java:38) [springfox-spring-web-2.8.1-SNAPSHOT.jar:2.8.1-SNAPSHOT]
	at springfox.documentation.swagger2.web.Swagger2Controller.getDocumentation(Swagger2Controller.java:98) [springfox-swagger2-2.8.1-SNAPSHOT.jar:2.8.1-SNAPSHOT]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_151]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_151]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_151]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_151]
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) [spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) [spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116) [spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) [spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) [spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) [spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) [spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) [spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) [spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) [spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:622) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) [spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat-embed-websocket-8.5.11.jar:8.5.11]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:96) [spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:108) [spring-boot-actuator-1.5.1.RELEASE.jar:1.5.1.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) [spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:105) [spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81) [spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) [spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:106) [spring-boot-actuator-1.5.1.RELEASE.jar:1.5.1.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:474) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:783) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:798) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1434) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_151]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_151]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.11.jar:8.5.11]
	at java.lang.Thread.run(Thread.java:748) [na:1.8.0_151]
@dilipkrish

This comment has been minimized.

Copy link
Member

@dilipkrish dilipkrish commented Apr 11, 2018

@kyleki Oh I assumed it was an exception that was thrown... I didnt realize you meant a warning log message with stack trace. Is the issue that we want to not show the stack trace?

@kyleki

This comment has been minimized.

Copy link

@kyleki kyleki commented Apr 11, 2018

I'd prefer that the empty example is properly handled rather than attempting to cast it to a number. However, in lieu of that, just showing the warning without the stack trace would be nice. In the meantime, I've added the following to my application.properties file to hide the warning and stack trace:
logging.level.io.swagger.models.parameters.AbstractSerializableParameter=ERROR

@dilipkrish

This comment has been minimized.

Copy link
Member

@dilipkrish dilipkrish commented Apr 11, 2018

@kyleki I dug into that some, unfortunately thats not in the library we control. Its probably better that the swagger-core library handles it appropriately, or we have to use your solution. I'd rather not have a bunch of code in this library that conditionally sets the example.

@dilipkrish dilipkrish added wontfix and removed not-reproducable labels Apr 11, 2018
@kyleki

This comment has been minimized.

Copy link

@kyleki kyleki commented Apr 11, 2018

Yeah, they claim it was fixed back in 2016:
swagger-api/swagger-core#1568

Unfortunately it seems like it's still not fixed or was broken in a subsequent change. I'll log the issue over there to see if anything can be done with it in swagger-core. Thanks @dilipkrish !

@HADB

This comment has been minimized.

Copy link

@HADB HADB commented Aug 12, 2018

I encountered this problem after I upgraded springfox from 2.8.0 to 2.9.2.

@dilipkrish

This comment has been minimized.

Copy link
Member

@dilipkrish dilipkrish commented Aug 12, 2018

@HADB this is not a problem with springfox as I've outlined above

@ajcRodrigues

This comment has been minimized.

Copy link

@ajcRodrigues ajcRodrigues commented Aug 15, 2018

Hi everybody,

I solved this issue removing old swagger version (1.5.20) and add new one.

In pom.xml

<dependency>
	<groupId>io.springfox</groupId>
	<artifactId>springfox-swagger2</artifactId>
	<version>2.9.2</version>
	<exclusions>
		<exclusion>
			<groupId>io.swagger</groupId>
			<artifactId>swagger-annotations</artifactId>
		</exclusion>
		<exclusion>
			<groupId>io.swagger</groupId>
			<artifactId>swagger-models</artifactId>
		</exclusion>
	</exclusions>
</dependency>
<dependency>
	<groupId>io.springfox</groupId>
	<artifactId>springfox-swagger-ui</artifactId>
	<version>2.9.2</version>
</dependency>
<dependency>
	<groupId>io.swagger</groupId>
	<artifactId>swagger-annotations</artifactId>
	<version>1.5.21</version>
</dependency>
<dependency>
	<groupId>io.swagger</groupId>
	<artifactId>swagger-models</artifactId>
	<version>1.5.21</version>
</dependency>
@dilipkrish

This comment has been minimized.

Copy link
Member

@dilipkrish dilipkrish commented Aug 29, 2018

@ajcRodrigues Thanks!

@jaychang9

This comment has been minimized.

Copy link

@jaychang9 jaychang9 commented Aug 29, 2018

@ajcRodrigues It works! Greate job!

@RaymondMouthaan

This comment has been minimized.

Copy link

@RaymondMouthaan RaymondMouthaan commented Sep 1, 2018

@ajcRodrigues, Thanks 👍

@sojw

This comment has been minimized.

Copy link

@sojw sojw commented Sep 5, 2018

@ajcRodrigues , WOW! Thanks!

EugeneVintsiv added a commit to EugeneVintsiv/iextrading-grabber that referenced this issue Sep 16, 2018
EugeneVintsiv added a commit to EugeneVintsiv/iextrading-grabber that referenced this issue Sep 16, 2018
@binakot

This comment has been minimized.

Copy link

@binakot binakot commented Sep 27, 2018

@ajcRodrigues Thanks! It works like a charm 🍸

For Gradle's users:

compile("io.springfox:springfox-swagger2:2.9.2") {
    exclude module: 'swagger-annotations'
    exclude module: 'swagger-models'
}
compile("io.swagger:swagger-annotations:1.5.21")
compile("io.swagger:swagger-models:1.5.21")
ZhangMan1126 added a commit to EMResearch/EMB that referenced this issue Oct 3, 2018
an issue of old-version of swagger @ApiParam throwing NumberFormatException (related to NcsRest.java).  

Find a solution to remove the old version of swagger from springfox from springfox/springfox#2265
ZhangMan1126 added a commit to EMResearch/EMB that referenced this issue Oct 3, 2018
an issue of old-version of swagger @ApiParam throwing NumberFormatException (related to NcsRest.java).

Find a solution to remove the old version of swagger from springfox from springfox/springfox#2265
@WindStill

This comment has been minimized.

Copy link

@WindStill WindStill commented Oct 16, 2018

@ajcRodrigues Thanks!

@dustinbrown

This comment has been minimized.

Copy link

@dustinbrown dustinbrown commented Nov 15, 2018

@ajcRodrigues Thank you very much, works great.

@sf-jyk

This comment has been minimized.

Copy link

@sf-jyk sf-jyk commented Nov 28, 2018

Thank you 👍 It was nice solution to me.

@chrisinmtown

This comment has been minimized.

Copy link

@chrisinmtown chrisinmtown commented Dec 20, 2018

What's an example @apimodel property that causes this issue? Can we developers fix up our annotations to silence this? I checked all of mine on Integer and Long type, all have an example value that's a valid number, yet the warning messages still appear in my app's log.

Alternately, if I understood this correctly, springfox version 2.9.2 references swagger-models and swagger-annotations libraries at version 1.5.20; to squelch this annoying warning springfox POM needs to use versions 1.15.21 instead. Did I get that right? Is this change scheduled for a future version of springfox?

@sev7e0

This comment has been minimized.

Copy link

@sev7e0 sev7e0 commented Dec 27, 2018

@ajcRodrigues Thanks!!! 👍

@hokkun-dayo

This comment has been minimized.

Copy link

@hokkun-dayo hokkun-dayo commented Feb 4, 2019

JFYI, this issue was resolved at swagger-api/swagger-core#2865

@Abhirajs89

This comment has been minimized.

Copy link

@Abhirajs89 Abhirajs89 commented Feb 11, 2019

@ajcRodrigues Thanks!

honnel added a commit to synyx/urlaubsverwaltung that referenced this issue Mar 11, 2019
honnel added a commit to synyx/urlaubsverwaltung that referenced this issue Mar 11, 2019
honnel added a commit to synyx/urlaubsverwaltung that referenced this issue Mar 11, 2019
honnel added a commit to synyx/urlaubsverwaltung that referenced this issue Mar 11, 2019
thiloplanz pushed a commit to thiloplanz/urlaubsverwaltung that referenced this issue Mar 23, 2019
@myhgc

This comment has been minimized.

Copy link

@myhgc myhgc commented May 29, 2019

@ajcRodrigues Thanks! 2.9.2 the version still 1.5.20

@yanaair

This comment has been minimized.

Copy link

@yanaair yanaair commented Oct 28, 2019

Hello @dilipkrish ! Will there be a newer version of springfox that will include 1.5.21 version of swagger-annotations and swagger-models?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.