When running the test suite, I get (among others) the following error:
[junit] Testcase: test1(cds.healpix.HealpixNestedUltraCompactMOCTest): Caused an ERROR
[junit] Index 6 out of bounds for length 6
[junit] java.lang.ArrayIndexOutOfBoundsException: Index 6 out of bounds for length 6
[junit] at cds.healpix.HealpixNestedUltraCompactMOC.bitSetFromBytes(HealpixNestedUltraCompactMOC.java:147)
[junit] at cds.healpix.HealpixNestedUltraCompactMOC.decompress(HealpixNestedUltraCompactMOC.java:153)
[junit] at cds.healpix.HealpixNestedUltraCompactMOCTest.test1(HealpixNestedUltraCompactMOCTest.java:72)
[junit] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[junit] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[junit] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
I'm pretty sure this happens because of the following code in HealpixNestedUltraCompactMOC.java:
final BitSet bs = new BitSet(8 * compressedMoc.length);
for (int i = 0; i < bs.size(); i++) {
Here, the implicit assumption seems to be that bs.size() is exactly equal to 8 * compressedMoc.length. But I don't think this is the case; the BitSet implementation may be allowed to round up its size to the nearest convenient value (e.g. the next multiple of 32). In this case the code above will break.
When running the test suite, I get (among others) the following error:
I'm pretty sure this happens because of the following code in
HealpixNestedUltraCompactMOC.java
:Here, the implicit assumption seems to be that
bs.size()
is exactly equal to8 * compressedMoc.length
. But I don't think this is the case; theBitSet
implementation may be allowed to round up its size to the nearest convenient value (e.g. the next multiple of 32). In this case the code above will break.