Coder Social home page Coder Social logo

Comments (8)

taowen avatar taowen commented on May 18, 2024

wow, thank you, such a big bug :(

Just fixed

from java.

ekuleshov avatar ekuleshov commented on May 18, 2024

Thank you. How does affect performance of the stream API? I've tried to run forked java-json-benchmark but it wasn't update for the latest jsoniter and crashing with some exceptions.

from java.

taowen avatar taowen commented on May 18, 2024

this bug will not affect the performance, as the benchmarking only tested the fast path. java-json-benchmark project is out of date, I will update the code when I have time. If performance is your priority, stick with bind-api, it is faster than iterator api. As the readObject() and readArray() has too many branching in it.

from java.

Mahdihp avatar Mahdihp commented on May 18, 2024

connot read big string lentgh filed :
03-06 17:51:09.211 30483-30483/com.mahdi.ketabcell E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.mahdi.ketabcell, PID: 30483
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mahdi.ketabcell/com.mahdi.ketabcell.activity.piccell.ShowPiccellActivity}: com.jsoniter.spi.JsonException: readString: incomplete string, head: 9, peek: {"body":", buf: {"body":"یب سمینبتشسیمن بشمسنیتب منش ستیمبشسینبتا سشیبسشنتیا بنتسیاب نتسیا بنتسیابنسشتیاب نشستی ابنتشسیابنستیابنشسیانبسشایب نسشای بنشسای نبساینبتش سینباشسنیباسشنیبا شسنیبا سنیتبا سشنیت نسیت بت سیتب اسینتبسی باسیبنسیا بنسیاب سیاب سیناب سینتبا سیتنبا سیتنبا سینت باسیبتنسی نتسی بنت سی بتس بس سنیت سین سیسینباسنیب","commentCount":0,"doILike":false,"doISuggest":false,"likeCount":0,"rowId":"58bcf9ef620b1d05f8533103","specialLabel":0,"submitDate":"2017-03-06T05:55:59.460Z","suggestCount":0,"title":"تس می باشد","type":1,"url":["images/cell/544989037.jpg"],"username":"mahdihp"}
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2219)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2269)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5045)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)

from java.

taowen avatar taowen commented on May 18, 2024

@Mahdihp can you give me a txt file with the json string?

from java.

Mahdihp avatar Mahdihp commented on May 18, 2024

{"body":"یبل تیبلتیبمسش یبمک سشیمب سشیکمب تشسکمیبنمسیتبمسشتیب منشستمتبیملتیبملتیبمتلیمبلت یبلتیبل ینبنن اسی باسیش نباسشینباشسینبشسنتیب شسنیاب نشسیابنسشتیابنتسشیابنسشیابنسیشابنسشیاب نسشیاب سشیب سشیبن ت سینبسیبنسیشاب نسیاب سیاب نسیتبا سینا سیا بسیاب نستیشاب نستیبسی","commentCount":0,"doILike":false,"doISuggest":false,"likeCount":1,"rowId":"58bf6ed1c8015f0bd4422c70","specialLabel":0,"submitDate":"2017-03-08T02:39:13.568Z","suggestCount":0,"title":"تست می باشد.","type":1,"url":["images/cell/490661220.jpg"],"username":"mahdihp"}

from java.

taowen avatar taowen commented on May 18, 2024
    public static class TestObject {
        public String body;
        public int commentCount;
    }

    public void test_utf8() {
        String input = "{\"body\":\"یبل تیبلتیبمسش یبمک سشیمب سشیکمب تشسکمیبنمسیتبمسشتیب منشستمتبیملتیبملتیبمتلیمبلت یبلتیبل ینبنن اسی باسیش نباسشینباشسینبشسنتیب شسنیاب نشسیابنسشتیابنتسشیابنسشیابنسیشابنسشیاب نسشیاب سشیب سشیبن ت سینبسیبنسیشاب نسیاب سیاب نسیتبا سینا سیا بسیاب نستیشاب نستیبسی\",\"commentCount\":0,\"doILike\":false,\"doISuggest\":false,\"likeCount\":1,\"rowId\":\"58bf6ed1c8015f0bd4422c70\",\"specialLabel\":0,\"submitDate\":\"2017-03-08T02:39:13.568Z\",\"suggestCount\":0,\"title\":\"تست می باشد.\",\"type\":1,\"url\":[\"images/cell/490661220.jpg\"],\"username\":\"mahdihp\"}";
        TestObject obj = JsonIterator.deserialize(input, TestObject.class);
        assertEquals(0, obj.commentCount);
    }

can not reproduce. please make sure the input is utf8, other encoding is not supported.

from java.

tomcashman avatar tomcashman commented on May 18, 2024

I have been able to reproduce this on latest version. The following test fails:

final String json = "{\"str\":\"{\\\"escapedKey\\\":\\\"escapedValues\\\"}\"}";
final Any any = JsonIterator.deserialize(json);
Assert.assertEquals("{\\\"escapedKey\\\":\\\"escapedValues\\\"}", any.get("str").toString());

from java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.