incorrect pointer math in AbstractExcerpt.position()
Closed this issue · 4 comments
i noticed that skipBytes() doesn't work correctly, it turned out to be a problem with position(). this code works:
@Override
public Excerpt position(int position) {
if (position < 0 || position >= capacity()) throw new IndexOutOfBoundsException();
this.position = start + position; // start has to be added
return this;
}
I will fix this soon.
Can you provide a unit test which fails currently?
It isn't a unit test per se, this code prompted me to have a look:
Excerpt excerpt = currentTsc.createExcerpt();
try {
excerpt.index(index);
excerpt.skipBytes(offset);
return excerpt.readInt();
} finally {
excerpt.finish();
}
After excerpt.index() call position field is set to a rather large offset and is reset to "offset" value when skipBytes() is called.
Cheers,
Vlad
-----Original Message-----
From: Peter Lawrey [mailto:reply@reply.github.com]
Sent: 26 March 2012 10:01
To: Ilyuschenko, Vlad
Subject: Re: [Java-Chronicle] incorrect pointer math in AbstractExcerpt.position() (#6)
Can you provide a unit test which fails currently?
Reply to this email directly or view it on GitHub:
#6 (comment)
Fixed now