Skip to content

VPack parsing error. #80

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sckimos opened this issue Nov 25, 2016 · 1 comment
Closed

VPack parsing error. #80

sckimos opened this issue Nov 25, 2016 · 1 comment
Assignees
Labels
Milestone

Comments

@sckimos
Copy link

sckimos commented Nov 25, 2016

Hi.

Could you check following code out?

// creating json string: { "foo1": { "bar1": "", "bar2": "aaa...aaa" }, "foo2":"test" }
StringBuilder json = new StringBuilder().append("{ \"foo1\": { \"bar1\": \"\", \"bar2\": \"");
for (int i = 0; i < 231; ++i) { // the length 231 is important!
    json.append("a");
}
json.append("\" }, \"foo2\":\"test\" }");
VPackSlice slice = new VPackParser().fromJson(json.toString());
System.out.println(slice.toString());

slice.toString() throws NoSuchElementException:

Exception in thread "main" java.util.NoSuchElementException
	at com.arangodb.velocypack.ObjectIterator$1.getKey(ObjectIterator.java:80)
	at com.arangodb.velocypack.ObjectIterator$1.getKey(ObjectIterator.java:64)
	at com.arangodb.velocypack.VPackParser.parseObject(VPackParser.java:188)
	at com.arangodb.velocypack.VPackParser.parse(VPackParser.java:153)
	at com.arangodb.velocypack.VPackParser.toJson(VPackParser.java:73)
	at com.arangodb.velocypack.VPackSlice.toString(VPackSlice.java:774)
	at net.g1project.arangodbtest.ArangoDBTest.main(ArangoDBTest.java:81)

I printed out slice.getBuffer(), and I think that object length is not set properly in some cases.

0c 1c 01 02 00 00 00 00 00 44 66 6f 6f 31 0b *00* 02 44 62 61 72 31 40 44 62 61 72 32 bf e7 00 00 00 00 00 00 00 61 61 61 61 61 ...

I'm using 4.1.3 version.

Thanks in advance.

@mvollmary mvollmary added the bug label Nov 28, 2016
@mvollmary mvollmary self-assigned this Nov 28, 2016
@mvollmary mvollmary added this to the 4.1.4 milestone Nov 28, 2016
mvollmary pushed a commit that referenced this issue Nov 28, 2016
mvollmary pushed a commit that referenced this issue Dec 13, 2016
@mvollmary
Copy link

Thanks. I released version 4.1.4 with the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants