Git Product home page Git Product logo

Comments (7)

atifaziz avatar atifaziz commented on July 28, 2024
Not sure I completely understand step 2. Any chance you'd be willing to provide a breaking
unit test (ideally as a patch on to TestJsonBuffer fixture) or a code snippet to reproduce
this accurately?

Reported by azizatif on 2011-03-17 22:25:02

from jayrock.

atifaziz avatar atifaziz commented on July 28, 2024
Below is how I tried to reproduce this issue but it does not break (does not cause the
indicated debug assertion to fail):

// 1. Create JsonBuffer from array with objects
JsonBuffer buffer = JsonBuffer.From("[{},{},{}]");
// 2. Create reader from the buffer...
JsonBufferReader reader = buffer.CreateReader();
//    ...and read as long as the token will be Object token
while (reader.TokenClass != JsonTokenClass.Object)
    reader.Read();
// 3. Call reader.BufferValue() this should break
reader.BufferValue();

Note that I interpreted "...and read as long as the token will be Object token" as
"...and read until the token will be Object token" and thus the while loop. Object
tokens cannot appear adjacent, which is why I couldn't code up your original wording.

Reported by azizatif on 2011-03-17 22:55:57

  • Status changed: ``

from jayrock.

atifaziz avatar atifaziz commented on July 28, 2024

Reported by azizatif on 2011-03-17 22:56:11

  • Status changed: New

from jayrock.

atifaziz avatar atifaziz commented on July 28, 2024
Yeah, i will try to make it more clear, probably providing the breaking unit test. I
can do that this evening.

Reported by adikuv on 2011-03-18 11:25:23

from jayrock.

atifaziz avatar atifaziz commented on July 28, 2024
My description did not reproduced the problem. I used your code and modified it to reproduce
the issue. Here is the code:

// 1. Create JsonBuffer from array with objects
JsonBuffer buffer = JsonBuffer.From(@"[{},{""a"":{},""b"":{}}]");
// 2. Create reader from the buffer...
JsonBufferReader reader = buffer.CreateReader();
//    ...read in the first object
while (reader.TokenClass != JsonTokenClass.Object)
    reader.Read();
reader.Read(); // Read Object token
reader.Read(); // Read EndObject token

//    ...create a subbuffer to buffer the next object
JsonBuffer subBuffer = JsonBuffer.From(reader);
//    ...create reader from the subbuffer
JsonBufferReader reader2 = subBuffer.CreateReader();

// 3. Call reader.BufferValue() this should break
reader2.BufferValue();

Reported by adikuv on 2011-03-18 23:25:22

from jayrock.

atifaziz avatar atifaziz commented on July 28, 2024

Reported by azizatif on 2011-03-21 15:59:07

  • Status changed: Accepted
  • Labels added: Component-JSON, Milestone-Release1.0

from jayrock.

atifaziz avatar atifaziz commented on July 28, 2024
Fixed in r889.

Reported by azizatif on 2011-03-21 22:45:06

  • Status changed: Fixed

from jayrock.

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.