mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Jean-Noel Rouvignac
24.27.2015 258d1bf1393a666901f11a07d5247674c2aca872
refs
author Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Friday, April 24, 2015 11:27 +0200
committer Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Friday, April 24, 2015 11:27 +0200
commit258d1bf1393a666901f11a07d5247674c2aca872
tree 01d44333e5d00153c33af4649c4d487923421d63 tree | zip | gz
parent 7b44fa6b33c5441b25e900fb906e280641ce3737 view | diff
(CR-6756) Fixed IllegalArgumentException when import triggers index entry limits

IllegalArgumentException was triggered in ImportIDSet.addEntryID() when called with a negative entryID.
The negative entryID was read in IndexInputBuffer.mergeIDSet().
The problem comes from Importer.ScratchFileWriterTask.writeByteStreams() which writes a special value instead of an entryID which means "treat this ImportIDSet has undefined".
First problem, this special value is written as a byte, but read as a long. I fixed the code to write it as a long.
Second problem, the (illogical) code handling this specific case in ImportIDSet.addEntryID() was removed as part of r11948. I fixed this by properly handling this case at a higher level in IndexInputBuffer.mergeIDSet().
I finally applied similar changes to the JE code to explicit what it is doing.



pluggable.ImportIDSet.java:
Changed setUndefined() from private to package private.
Extracted method setUndefinedWithSize().

pluggable.IndexInputBuffer.java:
Added UNDEFINED_SIZE constant.
In mergeIDSet(), handled the undefined size case.
Added toString().

pluggable.Importer.java:
In writeByteStreams(), wrote UNDEFINED_SIZE as a long to the BAOS.
Changed toString() to output the index name.

pluggable.IndexOutputBuffer.java:
Added toString().



Reflected similar changes to JEB. In addition:

jeb.ImportIDSet.java:
In addEntryID(), reject negative entryIDs.

jeb.Importer.java:
In writeByteStreams(), write a packed long (although the encoded representation is the same as packed int, code was conceptually incorrect) + added writePackedLong() method.

jeb.IndexInputBuffer.java:
Extracted readKey().
In mergeIDSet(), handled the undefined size. There is a difference in behaviour: previous the undefined size could be maintained, but now it is no longer maintained: this is correct since there was no count to maintain for an undefined size.
1 files modified
4 ■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/SuffixContainer.java 4 ●●● diff | view | raw | blame | history