Skip to content

fail to parse config text with white space #3367

@nzomkxia

Description

@nzomkxia
  • I have searched the issues of this repository and believe that this is not a duplicate.
  • I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: 2.7.0
  • Operating System version: Mac OS
  • Java version: JDK1.8

Steps to reproduce this issue

  1. create dubbo.properties with trailing white space
dubbo.provider.timeout=6666    
  1. start dubbo provider
  2. will cause an exception:
java.lang.NumberFormatException: For input string: "6666   "
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.lang.Integer.parseInt(Integer.java:580)
	at java.lang.Integer.valueOf(Integer.java:766)
	at org.apache.dubbo.common.utils.ClassHelper.convertPrimitive(ClassHelper.java:277)
	at org.apache.dubbo.config.AbstractConfig.refresh(AbstractConfig.java:568)
	at java.util.concurrent.ConcurrentHashMap$ValuesView.forEach(ConcurrentHashMap.java:4707)
	at org.apache.dubbo.config.context.ConfigManager.refreshAll(ConfigManager.java:308)
	at org.apache.dubbo.config.AbstractInterfaceConfig.startConfigCenter(AbstractInterfaceConfig.java:241)
	at org.apache.dubbo.config.ServiceConfig.checkAndUpdateSubConfigs(ServiceConfig.java:267)
	at org.apache.dubbo.config.ServiceConfig.export(ServiceConfig.java:328)
	at org.apache.dubbo.config.spring.ServiceBean.onApplicationEvent(ServiceBean.java:104)
	at org.apache.dubbo.config.spring.ServiceBean.onApplicationEvent(ServiceBean.java:55)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:400)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:354)
	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:886)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:161)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1242)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1230)
	at org.apache.dubbo.demo.DubboProviderApplication.main(DubboProviderApplication.java:13)

Pls. provide [GitHub address] to reproduce this issue.

Expected Result

What do you expected from the above steps?

Actual Result

What actually happens?

If there is an exception, please attach the exception trace:

Just put your stack trace here!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions