Skip to content
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

Strange exception coming out of bytesToUnsigned #7

Closed
TheWhiteShodow opened this issue Mar 21, 2015 · 2 comments
Closed

Strange exception coming out of bytesToUnsigned #7

TheWhiteShodow opened this issue Mar 21, 2015 · 2 comments

Comments

@TheWhiteShodow
Copy link

I'm loading up a tr13 into a byte buffer then attempting to use it from a memory mapped byte buffer and getting errors attempting to lookup values I put in the tr13. It isn't even very large yet. It appears to be attempting to pull up a value which is much larger than the generated file itself.

Here is the exception:
Exception in thread "main" java.lang.IndexOutOfBoundsException
at java.nio.Buffer.checkIndex(Buffer.java:532)
at java.nio.DirectByteBuffer.get(DirectByteBuffer.java:253)
at com.ning.tr13.util.VInt.bytesToUnsigned(VInt.java:165)
at com.ning.tr13.impl.bytes.ByteBufferBytesTrieLookup._findValue(ByteBufferBytesTrieLookup.java:81)
at com.ning.tr13.impl.bytes.ByteBufferBytesTrieLookup.findValue(ByteBufferBytesTrieLookup.java:36)
at MemoryMappedLookup.testString(MemoryMappedLookup.java:174)

Any thoughts it I'm somehow causing this? There is quite a lot of code to try and post a small sample. I will try and cook up something if this doesn't ring any bells with anybody.

@TheWhiteShodow
Copy link
Author

I have more to report. I was passing true to the second argument of SimpleBytesTrieBuilder.buildAndWrite. I think I started passing true after reading the code and comments therein. Regardless, wonderful library! Ten out of ten would stumble through the issue again!

@cowtowncoder
Copy link
Contributor

Hi there! Awesome that you were able to figure out the problem. Library is (alas!) not well documented yet, so it is not surprising you got bit by this. If you have suggestions for simple updates to README I would love to incorporate those. Same for javadocs etc as well of course.

I am also curious as to kind of usage you have, if you can share.

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

No branches or pull requests

2 participants