본문 바로가기

JAVA/Error

[Swagger] java.lang.NumberFormatException: For input string: ""

 

 

java.lang.NumberFormatException: For input string: ""

 

swagger2에서 던지는 에러에 대한 핸들링이 제대로 이루어지지 않아 발생하는 에러.

swagger-models와 swagger-annotation를 downgrade 해야 함.

Maven

<!-- swagger -->
<dependency>
	<groupId>io.springfox</groupId>
	<artifactId>springfox-swagger-ui</artifactId>
	<version>2.9.2</version>
</dependency>
<dependency>
	<groupId>io.springfox</groupId>
    <artifactId>springfox-swagger2</artifactId>
	<version>2.9.2</version>
	<!-- solved NumberFormatException in swagger2 -->
	<exclusions>
		<exclusion>
			<groupId>io.swagger</groupId>
			<artifactId>swagger-annotations</artifactId>
		</exclusion>
		<exclusion>
			<groupId>io.swagger</groupId>
			<artifactId>swagger-models</artifactId>
		</exclusion>
	</exclusions>
</dependency>
<!-- solved NumberFormatException in swagger2 -->
<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>

 

Gradle

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")