Skip to content

JSON.json(Locale) throw StackOverflowError #906

Closed

Description

@takeseem

fix from dubbo:master, 2.5.7 : GenericJSONConverter主要是用在日志部分输出,所以当我们输出locale对象时就发生stack溢出。

java.lang.StackOverflowError
	at com.alibaba.dubbo.common.json.JSONWriter.valueString(JSONWriter.java:189)
	at com.alibaba.dubbo.common.json.GenericJSONConverter$7.encode(GenericJSONConverter.java:100)
	at com.alibaba.dubbo.common.json.GenericJSONConverter.writeValue(GenericJSONConverter.java:338)
	at com.alibaba.dubbo.common.json.GenericJSONConverter.writeValue(GenericJSONConverter.java:347)
	at com.alibaba.dubbo.common.json.GenericJSONConverter.writeValue(GenericJSONConverter.java:395)
	at com.alibaba.dubbo.common.json.GenericJSONConverter.writeValue(GenericJSONConverter.java:347)
	at com.alibaba.dubbo.common.json.GenericJSONConverter.writeValue(GenericJSONConverter.java:395)

Activity

  1. takeseem commented on Nov 22, 2017

    @takeseem
    ContributorAuthor

    老项目有时候伤不起!依赖关系有时候太多了!

    fix see #906,locale的字符串反序列化为Locale对象,我想应该是ok的

    比如jackson的测试代码

    public static void main(String[] args) throws IOException {
    	ObjectMapper mapper = new ObjectMapper();
    	String json = mapper.writeValueAsString(Locale.US);
    	System.out.println(json);
    	System.out.println(mapper.readValue(json, Locale.class));
    }
    
  2. qinliujie commented on Nov 27, 2017

    @qinliujie
    Contributor

    2.5.7 我们已经废弃掉这个了,你再确定一下?

  3. takeseem commented on Nov 28, 2017

    @takeseem
    ContributorAuthor

    我们自己基于原来的accesslog自己加上了一点东西。后面我们会改用fastjson。不过这个遗留代码既然还保留,最好是修复下这个bug,就怕类似我这样用了几年的dubbo时,遗留代码兼容性上有问题。

  4. added a commit that references this issue on May 14, 2018
    9c4017e
  5. added a commit that references this issue on Sep 9, 2019
    1b44392
  6. added a commit that references this issue on Sep 10, 2019
    116c9c3
  7. wochurou commented on Nov 13, 2019

    @wochurou

    telnet调用接口时,接口出参的字段含有枚举时,同样会出现StackOverFlowError的问题

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

    type/bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions