Skip to content

fail to parse config text with white space #3367

Closed

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!

Activity

  1. CrazyHZM commented on Jan 28, 2019

    @CrazyHZM
    Member

    Deleting the space will succeed. I don't recommend enhancing the handling of the space here. What do you think?

  2. biyuhao commented on Jan 28, 2019

    @biyuhao
    Member

    There is a similar discussion in Springboot project
    spring-projects/spring-boot#13602 (comment)

  3. added this to the 2.7.1 milestone on Jan 30, 2019
  4. chickenlj commented on Jan 30, 2019

    @chickenlj
    Contributor

    White space should definitely be considered.

  5. added 2 commits that reference this issue on Feb 18, 2019
    09559bf
    52eda2f
  6. added a commit that references this issue on Mar 26, 2019
    897b80d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions