Bug 47289

GemBuilder for Java

3.1.3, 3.1.2, 3.1.1, 3.1, 3.0.1, 3.0

All Platforms

GBJ Error: startindex/numObjs out of range in getObjs() using GbjIterator

When using an instance of GbjIterator to enumerate over a large collection, if the collection is larger than GbjIterator.BatchSize (defaults to 1000), then the following exception is raised when attempting to enumerate to an element beyond the batch size:

com.gemstone.gbjgci.GbjGciException: GBJ Error: startIndex/numObjs out of range in getObjs()
     at com.gemstone.gbjgci.GbjGciInterface.newException(GbjGciInterface.java:324)
     at com.gemstone.gbjgci.GbjGciInterface.getObjs(GbjGciInterface.java:888)
     at com.gemstone.gbjgci.GbjGciSession.getObjs(GbjGciSession.java:486)
     at com.gemstone.gbj.GbjIterator.getNextBatch(GbjIterator.java:112)
     at com.gemstone.gbj.GbjIterator.nextElement(GbjIterator.java:102)
     at Test15.doit(Test15.java:65)
     at Test15.main(Test15.java:80)

Workaround

Increase the size of GbjIterator.BatchSize to a value greater than the largest expected collection size.  This value should not exceed the setting for bufSize used in a GbjSession.initialize( ) or GbjGciInterface.initialize( ) call (see javadocs for details - default value is 100000).

Alternatively, use a java.utils.Enumeration instead.


Last updated: 11/8/17